home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Interactive Guide / c-cplusplus-interactive-guide.iso / c_ref / csource1 / program3 / pmshl.pas < prev    next >
Pascal/Delphi Source File  |  1993-11-23  |  18KB  |  413 lines

  1. {*****************************************************************************\
  2. *
  3. * Module Name: PMSHL.H
  4. *
  5. * OS/2 Presentation Manager Shell constants, types, messages and
  6. * function declarations
  7. *
  8. * Copyright (c) International Business Machines Corporation 1981, 1988-1990
  9. *
  10. \*****************************************************************************}
  11. {| Version:   1.00
  12.  | Original translation: Peter Sawatzki ps
  13.  | Contributing:
  14.  |   Peter Sawatzki ps
  15.  |
  16.  | change history:
  17.  | Date:    Ver: Author:
  18.  | 11/11/93 1.00 ps     original translation by ps
  19. }
  20. Unit PmShl;
  21. Interface
  22. Uses
  23.   Os2Def,
  24.   PmWin;
  25. Const
  26. { common types, constants and function declarations             }
  27. { maximum title length }
  28.   MAXNAMEL = 60;
  29. Type
  30. { window size structure }
  31.   XYWINSIZE = Record
  32.     x,y,cx,cy: SHORT;
  33.     fsWindow: USHORT
  34.   End;
  35.   pXYWINSIZE = ^XYWINSIZE;
  36.  
  37. Const
  38. { Definitions for fsWindow }
  39.   XYF_NOAUTOCLOSE= $0008;
  40.   XYF_MINIMIZED  = $0004;                           { D23914 }
  41.   XYF_MAXIMIZED  = $0002;                           { D23914 }
  42.   XYF_INVISIBLE  = $0001;
  43.   XYF_NORMAL     = $0000;
  44.  
  45. Type
  46. { program handle }
  47.   HPROGRAM = LHANDLE;       { hprog }
  48.   pHPROGRAM = ^HPROGRAM;
  49.  
  50. { ini file handle }
  51.   HINI = LHANDLE;           { hini }
  52.   pHINI = ^HINI;
  53.  
  54. Const
  55.   HINI_PROFILE         = NULL;
  56.   HINI_USERPROFILE     = -1;
  57.   HINI_SYSTEMPROFILE   = -2;
  58.   HINI_USER    = HINI_USERPROFILE;
  59.   HINI_SYSTEM  = HINI_SYSTEMPROFILE;
  60.  
  61. Type
  62.   PRFPROFILE = Record
  63.     cchUserName: ULONG;
  64.     pszUserName: pSZ;
  65.     cchSysName: ULONG;
  66.     pszSysName: pSZ
  67.   End;
  68.   pPRFPROFILE = ^PRFPROFILE;
  69.  
  70. Const
  71. { maximum path length }
  72.   MAXPATHL = 128;
  73.  
  74. { root group handle }
  75.   SGH_ROOT      = HPROGRAM(-1);
  76.  
  77. Type
  78.   HPROGARRAY = Record
  79.     ahprog: Array[0..0] Of HPROGRAM
  80.   End;
  81.   pHPROGARRAY = ^HPROGARRAY;
  82.   PROGCATEGORY = Char;
  83.   pPROGCATEGORY = pChar;
  84.  
  85. Const
  86. { values acceptable for PROGCATEGORY for PM groups }
  87.   PROG_DEFAULT            = PROGCATEGORY(0  );
  88.   PROG_FULLSCREEN         = PROGCATEGORY(1  );
  89.   PROG_WINDOWABLEVIO      = PROGCATEGORY(2  );
  90.   PROG_PM                 = PROGCATEGORY(3  );
  91.   PROG_GROUP              = PROGCATEGORY(5  );
  92.   PROG_REAL               = PROGCATEGORY(4  );{ was 7 }
  93.   PROG_DLL                = PROGCATEGORY(6  );
  94.   PROG_RESERVED           = PROGCATEGORY(255);
  95.  
  96. { visibility flag for PROGTYPE structure }
  97.   SHE_VISIBLE   = $00;
  98.   SHE_INVISIBLE = $01;
  99.   SHE_RESERVED  = $FF;
  100.  
  101. { Protected group flag for PROGTYPE structure }
  102.   SHE_UNPROTECTED = $00;
  103.   SHE_PROTECTED   = $02;
  104.  
  105. Type
  106.   PROGTYPE = Record
  107.     progc: PROGCATEGORY;
  108.     fbVisible: UCHAR
  109.   End;
  110.   pPROGTYPE = ^PROGTYPE;
  111.  
  112.   PROGRAMENTRY = Record
  113.     hprog: HPROGRAM;
  114.     progt: PROGTYPE;
  115.     szTitle: Array[0..MAXNAMEL] Of Char
  116.   End;
  117.   pPROGRAMENTRY = ^PROGRAMENTRY;
  118.  
  119.   PIBSTRUCT = Record
  120.     progt: PROGTYPE;
  121.     szTitle: Array[0..MAXNAMEL] Of Char;
  122.     szIconFileName,
  123.     szExecutable,
  124.     szStartupDir: Array[0..MAXPATHL] Of Char;
  125.     xywinInitial: XYWINSIZE;
  126.     res1: USHORT;
  127.     res2: LHANDLE;
  128.     cchEnvironmentVars: USHORT;
  129.     pchEnvironmentVars: pCH;
  130.     cchProgramParameter: USHORT;
  131.     pchProgramParameter: pCH
  132.   End;
  133.   pPIBSTRUCT = ^PIBSTRUCT;
  134.  
  135. {****************************************************************************}
  136. {                                                                            }
  137. {  Structures associated with 'Prf' calls                                    }
  138. {                                                                            }
  139. {****************************************************************************}
  140.  
  141.   PROGDETAILS = Record
  142.     _Length: ULONG;        { set this to sizeof(PROGDETAILS)  }
  143.     progt: PROGTYPE;
  144.     pad1: Array[0..2] Of USHORT;     { ready for 32-bit PROGTYPE        }
  145.     pszTitle,              { any of the pointers can be NULL  }
  146.     pszExecutable,
  147.     pszParameters,
  148.     pszStartupDir,
  149.     pszIcon,
  150.     pszEnvironment:pSZ;        { this is terminated by  /0/0     }
  151.     swpInitial: SWP;            { this replaces XYWINSIZE         }
  152.     pad2: Array[0..4] Of USHORT;{ ready for 32-bit SWP            }
  153.   End;
  154.   pPROGDETAILS = ^PROGDETAILS;
  155.  
  156.   PROGTITLE = Record
  157.     hprog: HPROGRAM;
  158.     progt: PROGTYPE;
  159.     pad1: Array[0..2] Of USHORT; { padding ready for 32-bit PROGTYPE }
  160.     pszTitle: pSZ
  161.   End;
  162.   pPROGTITLE = ^PROGTITLE;
  163.  
  164.   QFEOUTBLK = Record
  165.     Total,
  166.     Count: USHORT;
  167.     ProgramArr: Array[0..0] Of HPROGRAM
  168.   End;
  169.   pQFEOUTBLK = ^QFEOUTBLK;
  170.  
  171. { Program List API Function Definitions }
  172. {**  Program Use }
  173. Function WinQueryProgramTitles(_hab: HAB; hprogGroup: HPROGRAM;
  174.                                aprogeBuffer: PPROGRAMENTRY; usBufferLen: USHORT; pusTotal: PUSHORT): BOOL;
  175.  
  176. {**  Single Program Manipulation }
  177. Function WinAddProgram(_hab: HAB; ppibProgramInfo: PPIBSTRUCT;
  178.                        hprogGroupHandle: HPROGRAM): HPROGRAM;
  179. Function WinQueryDefinition(_hab: HAB; hprogProgHandle: HPROGRAM;
  180.                             ppibProgramInfo: PPIBSTRUCT; usMaxLength: USHORT): USHORT;
  181.  
  182. {**  Group Manipulation }
  183. Function WinCreateGroup(_hab: HAB; pszTitle: PSZ; ucVisibility: UCHAR;
  184.                         flres1, flres2: ULONG): HPROGRAM;
  185. {****************************************************************************}
  186. {                                                                            }
  187. {  Program List API available 'Prf' calls                                    }
  188. {                                                                            }
  189. {****************************************************************************}
  190.  
  191. Function PrfQueryProgramTitles(_hini: HINI; hprogGroup: HPROGRAM;
  192.                                pTitles: PPROGTITLE; cchBufferMax: ULONG; pulCount: PULONG): ULONG;
  193.  
  194. {***************************************************************************}
  195. {                                                                           }
  196. {  NOTE: string information is concatanated after the array of PROGTITLE    }
  197. {        structures so you need to allocate storage greater than            }
  198. {        sizeof(PROGTITLE)*cPrograms to query programs in a group           }
  199. {                                                                           }
  200. {  PrfQueryProgramTitles recommended usage to obtain titles of all progams  }
  201. {  in a group (Hgroup=SGH_ROOT is for all groups):                          }
  202. {                                                                           }
  203. {  BufLen = PrfQueryProgramTitles( Hini, Hgroup                             }
  204. {                                          , (PPROGTITLE)NULL, 0, &Count);  }
  205. {                                                                           }
  206. {  Alocate buffer of  Buflen                                                }
  207. {                                                                           }
  208. {  Len = PrfQueryProgramTitles( Hini, Hgroup, (PPROGTITLE)pBuffer, BufLen   }
  209. {                                                                , pCount); }
  210. {                                                                           }
  211. {***************************************************************************}
  212.  
  213. Function PrfAddProgram (_hini: HINI; pDetails: PPROGDETAILS;
  214.                         hprogGroup: HPROGRAM): HPROGRAM;
  215. Function PrfChangeProgram (_hini: HINI; hprog: HPROGRAM; pDetails: PPROGDETAILS): BOOL;
  216.  
  217. {*************************************************************************}
  218. {  when adding/changing programs the PROGDETAILS Length field should be   }
  219. {  set to sizeof(PROGDETAILS)                                             }
  220. {*************************************************************************}
  221.  
  222. Function PrfQueryDefinition (_hini: HINI; hprog: HPROGRAM;
  223.                              pDetails: PPROGDETAILS; cchBufferMax: ULONG): ULONG;
  224.  
  225. {***************************************************************************}
  226. {                                                                           }
  227. {  NOTE: string information is concatanated after the PROGDETAILS field     }
  228. {        structure