pmshl.pas 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385
  1. {
  2. $Id$
  3. This file is part of the Free Pascal run time library.
  4. Copyright (c) 2003 by Yuri Prokushev ([email protected]).
  5. OS/2 Presentation Manager Shell constants, types, messages and
  6. function declarations.
  7. See the file COPYING.FPC, included in this distribution,
  8. for details about the copyright.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  12. **********************************************************************}
  13. {Warning: This code is alfa. Future versions
  14. of this unit might not be compatible.}
  15. unit pmshl;
  16. Interface
  17. uses
  18. Os2Def, PmWin;
  19. // common types, constants and function declarations
  20. // maximum title length
  21. const
  22. MaxNameL=60;
  23. // program handle
  24. type
  25. HProgram=Cardinal; // hprog
  26. PHProgram=^HProgram;
  27. HAPP=Cardinal;
  28. // ini file handle
  29. type
  30. HINI=Cardinal; // hini
  31. PHINI=^HINI;
  32. const
  33. HINI_PROFILE = 0;
  34. HINI_USERPROFILE =-1;
  35. HINI_SYSTEMPROFILE =-2;
  36. HINI_USER = HINI_USERPROFILE;
  37. HINI_SYSTEM = HINI_SYSTEMPROFILE;
  38. type
  39. PPrfProfile=^PrfProfile;
  40. PrfProfile=record // prfpro
  41. cchUserName: Cardinal;
  42. pszUserName: PChar;
  43. cchSysName: Cardinal;
  44. pszSysName: PChar;
  45. end;
  46. // program list section
  47. // maximum path length
  48. const
  49. MAXPATHL=128;
  50. // root group handle
  51. const
  52. SGH_ROOT = -1;
  53. type
  54. PHPROGARRAY=^HPROGARRAY;
  55. HPROGARRAY=record // hpga
  56. ahprog: Array[1..1] of HProgram;
  57. end;
  58. PROGCATEGORY=Cardinal; // progc
  59. PPROGCATEGORY=^PROGCATEGORY;
  60. // values acceptable for PROGCATEGORY for PM groups
  61. const
  62. PROG_DEFAULT =0;
  63. PROG_FULLSCREEN =1;
  64. PROG_WINDOWABLEVIO =2;
  65. PROG_PM =3;
  66. PROG_GROUP =5;
  67. PROG_REAL =4;
  68. PROG_VDM =4;
  69. PROG_WINDOWEDVDM =7;
  70. PROG_DLL =6;
  71. PROG_PDD =8;
  72. PROG_VDD =9;
  73. PROG_WINDOW_REAL =10;
  74. PROG_WINDOW_PROT =11;
  75. PROG_30_STD =11;
  76. PROG_WINDOW_AUTO =12;
  77. PROG_SEAMLESSVDM =13;
  78. PROG_30_STDSEAMLESSVDM =13;
  79. PROG_SEAMLESSCOMMON =14;
  80. PROG_30_STDSEAMLESSCOMMON =14;
  81. PROG_31_STDSEAMLESSVDM =15;
  82. PROG_31_STDSEAMLESSCOMMON =16;
  83. PROG_31_ENHSEAMLESSVDM =17;
  84. PROG_31_ENHSEAMLESSCOMMON =18;
  85. PROG_31_ENH =19;
  86. PROG_31_STD =20;
  87. PROG_DOS_GAME =21;
  88. PROG_WIN_GAME =22;
  89. PROG_DOS_MODE =23;
  90. PROG_RESERVED =255;
  91. type
  92. PProgType=^ProgType;
  93. ProgType=record // progt
  94. progc: ProgCategory;
  95. fbVisible: Cardinal;
  96. end;
  97. // visibility flag for PROGTYPE structure
  98. const
  99. SHE_VISIBLE = $00;
  100. SHE_INVISIBLE = $01;
  101. SHE_RESERVED = $FF;
  102. // Protected group flag for PROGTYPE structure
  103. const
  104. SHE_UNPROTECTED =$00;
  105. SHE_PROTECTED =$02;
  106. // Structures associated with 'Prf' calls
  107. type
  108. PPROGDETAILS=^PROGDETAILS;
  109. PROGDETAILS=record // progde
  110. Length: Cardinal; // set this to sizeof(PROGDETAILS)
  111. progt: ProgType;
  112. pszTitle: PChar; // any of the pointers can be NULL
  113. pszExecutable: PChar;
  114. pszParameters: PChar;
  115. pszStartupDir: PChar;
  116. pszIcon: PChar;
  117. pszEnvironment: PChar; // this is terminated by /0/0
  118. swpInitial: SWP; // this replaces XYWINSIZE
  119. end;
  120. PPROGTITLE=^PROGTITLE;
  121. PROGTITLE=record // progti
  122. hprog: HProgram;
  123. progt: ProgType;
  124. pszTitle: PChar;
  125. End;
  126. // Program List API Function Definitions
  127. // Program List API available 'Prf' calls
  128. Function PrfQueryProgramTitles(ahini: HINI; hprogGroup: HProgram;
  129. var pTitles: PROGTITLE; cchBufferMax: Cardinal;
  130. var pulCount: Cardinal): Cardinal; cdecl;
  131. external 'PMSHAPI' index 113;
  132. //*********************************************************************/
  133. //* NOTE: string information is concatanated after the array of */
  134. //* PROGTITLE structures so you need to allocate storage */
  135. //* greater than sizeof(PROGTITLE)*cPrograms to query programs */
  136. //* in a group. */
  137. //* */
  138. //* PrfQueryProgramTitles recommended usage to obtain titles of all */
  139. //* programs in a group (Hgroup=SGH_ROOT is for all groups): */
  140. //* */
  141. //* BufLen = PrfQueryProgramTitles(Hini, Hgroup, */
  142. //* (PPROGTITLE)NULL, 0, &Count); */
  143. //* */
  144. //* Alocate buffer of Buflen */
  145. //* */
  146. //* Len = PrfQueryProgramTitles(Hini, Hgroup, (PPROGTITLE)pBuffer, */
  147. //* BufLen, pCount); */
  148. //* */
  149. //*********************************************************************/
  150. Function PrfAddProgram(ahini: HINI; var pDetails: PROGDETAILS;
  151. hprogGroup: HProgram): HProgram; cdecl;
  152. external 'PMSHAPI' index 109;
  153. Function PrfChangeProgram(ahini: HINI;hprog: HProgram;
  154. var pDetails: PROGDETAILS): Longbool; cdecl;
  155. external 'PMSHAPI' index 110;
  156. Function PrfQueryDefinition(ahini: HINI; hprog: HProgram;
  157. var pDetails: PROGDETAILS;
  158. cchBufferMax: Cardinal): Cardinal; cdecl;
  159. external 'PMSHAPI' index 111;
  160. //*********************************************************************/
  161. //* NOTE: string information is concatanated after the PROGDETAILS */
  162. //* field structure so you need to allocate storage greater */
  163. //* than sizeof(PROGDETAILS) to query programs */
  164. //* */
  165. //* PrfQueryDefinition recomended usage: */
  166. //* */
  167. //* bufferlen = PrfQueryDefinition(Hini,Hprog,(PPROGDETAILS)NULL,0) */
  168. //* */
  169. //* Alocate buffer of bufferlen bytes */
  170. //* set Length field (0 will be supported) */
  171. //* */
  172. //* (PPROGDETAILS)pBuffer->Length=sizeof(PPROGDETAILS) */
  173. //* */
  174. //* len = PrfQueryDefinition(Hini, Hprog, (PPROGDETAILS)pBuffer, */
  175. //* bufferlen) */
  176. //*********************************************************************/
  177. Function PrfRemoveProgram(ahini: HINI; hprog: HProgram): Longbool; cdecl;
  178. external 'PMSHAPI' index 104;
  179. Function PrfQueryProgramHandle(ahini: HINI; const pszExe: PChar;
  180. aphprogArray: HPROGARRAY; cchBufferMax: Cardinal;
  181. var pulCount: Cardinal): Longbool; cdecl;
  182. external 'PMSHAPI' index 58;
  183. Function PrfCreateGroup(ahini: HINI; const pszTitle: PChar;
  184. chVisibility: Byte): HProgram; cdecl;
  185. external 'PMSHAPI' index 55;
  186. Function PrfDestroyGroup(ahini: HINI; hprogGroup: HProgram): Longbool; cdecl;
  187. external 'PMSHAPI' index 106;
  188. Function PrfQueryProgramCategory(ahini: HINI; const pszExe: PChar): PROGCATEGORY; cdecl;
  189. external 'PMSHAPI' index 59;
  190. Function WinStartApp(hwndNotify: HWND; var pDetails: PROGDETAILS; const pszParams: PChar;
  191. Reserved: Pointer; fbOptions: Cardinal): HAPP; cdecl;
  192. external 'PMSHAPI' index 119;
  193. // bit values for Options parameter
  194. const
  195. SAF_VALIDFLAGS =$001F;
  196. SAF_INSTALLEDCMDLINE =$0001; // use installed parameters
  197. SAF_STARTCHILDAPP =$0002; // related application
  198. SAF_MAXIMIZED =$0004; // Start App maximized
  199. SAF_MINIMIZED =$0008; // Start App minimized, if !SAF_MAXIMIZED
  200. SAF_BACKGROUND =$0010; // Start app in the background
  201. Function WinTerminateApp(ahapp: HAPP): Longbool; cdecl;
  202. external 'PMSHAPI' index 130;
  203. // switch list section
  204. type
  205. HSWITCH=Cardinal; // hsw
  206. PHSWITCH=^HSWITCH;
  207. PSWCNTRL=^SWCNTRL;
  208. SWCNTRL=record // swctl
  209. hwnd_: HWND;
  210. hwndIcon: HWND;
  211. hprog: HProgram;
  212. idProcess: Cardinal;
  213. idSession: Cardinal;
  214. uchVisibility: Cardinal;
  215. fbJump: Cardinal;
  216. szSwtitle: Array[1..MaxNameL+4] of Char;
  217. bProgType: Cardinal;
  218. end;
  219. // visibility flag for SWCNTRL structure
  220. const
  221. SWL_VISIBLE =$04;
  222. SWL_INVISIBLE =$01;
  223. SWL_GRAYED =$02;
  224. // jump flag for SWCNTRL structure
  225. const
  226. SWL_JUMPABLE =$02;
  227. SWL_NOTJUMPABLE =$01;
  228. // Switching Program functions
  229. Function WinAddSwitchEntry(VAR aps: SWCNTRL): HSWITCH; cdecl;
  230. external 'PMSHAPI' index 120;
  231. Function WinRemoveSwitchEntry(ah:HSWITCH): Cardinal; cdecl;
  232. external 'PMSHAPI' index 129;
  233. type
  234. PSWENTRY=^SWENTRY;
  235. SWENTRY=record // swent
  236. hswitch_: HSWITCH;
  237. swctl: SWCNTRL;
  238. end;
  239. PSWBLOCK=^SWBLOCK;
  240. SWBLOCK=record // swblk
  241. cswentry: Cardinal;
  242. aswentry: Array[1..1] of SWENTRY;
  243. End;
  244. // 32-bit versions of these APIs have 32-bit parameters
  245. Function WinChangeSwitchEntry(hswitchSwitch: HSWITCH;
  246. var pswctlSwitchData: SWCNTRL): Cardinal; cdecl;
  247. external 'PMSHAPI' index 123;
  248. Function WinCreateSwitchEntry(ahab: HAB; var pswctlSwitchData: SWCNTRL): HSWITCH; cdecl;
  249. external 'PMSHAPI' index 121;
  250. Function WinQuerySessionTitle(ahab: HAB; usSession: Cardinal;
  251. var pszTitle: PChar;
  252. usTitlelen: Cardinal): Cardinal; cdecl;
  253. external 'PMSHAPI' index 122;
  254. Function WinQuerySwitchEntry(hswitchSwitch: HSWITCH;
  255. var pswctlSwitchData: SWCNTRL): Cardinal; cdecl;
  256. external 'PMSHAPI' index 124;
  257. Function WinQuerySwitchHandle(ahwnd: HWND; pidProcess: Cardinal): HSWITCH; cdecl;
  258. external 'PMSHAPI' index 125;
  259. Function WinQuerySwitchList(ahab: HAB;var pswblkSwitchEntries: SWBLOCK;
  260. usDataLength: Cardinal): Cardinal; cdecl;
  261. external 'PMSHAPI' index 126;
  262. Function WinQueryTaskSizePos(ahab: HAB; usScreenGroup: Cardinal;
  263. var pswpPositionData: SWP): Cardinal; cdecl;
  264. external 'PMSHAPI' index 127;
  265. Function WinQueryTaskTitle(usSession: Cardinal; var pszTitle: PChar;
  266. usTitlelen: Cardinal): Cardinal; cdecl;
  267. external 'PMSHAPI' index 128;
  268. Function WinSwitchToProgram(hswitchSwHandle: HSWITCH): Cardinal; cdecl;
  269. external 'PMSHAPI' index 131;
  270. // OS2.INI Access functions
  271. Function PrfQueryProfileInt(ahini: HINI; const pszApp, pszKey: PChar;
  272. sDefault: Longint): Longint; cdecl;
  273. external 'PMSHAPI' index 114;
  274. Function PrfQueryProfileString(ahini: HINI; const pszApp, pszKey, pszDefault: PChar;
  275. var pBuffer; cchBufferMax: Cardinal): Cardinal; cdecl;
  276. external 'PMSHAPI' index 115;
  277. Function PrfWriteProfileString(ahini: HINI; const pszApp, pszKey, pszData: PChar): Longbool; cdecl;
  278. external 'PMSHAPI' index 116;
  279. Function PrfQueryProfileSize(ahini: HINI; const pszApp, pszKey: PChar;
  280. var pulReqLen: Cardinal): Longbool; cdecl;
  281. external 'PMSHAPI' index 101;
  282. Function PrfQueryProfileData(ahini: HINI; const pszApp, pszKey: PChar; var pBuffer;
  283. var pulBuffLen: Cardinal): Longbool; cdecl;
  284. external 'PMSHAPI' index 117;
  285. Function PrfWriteProfileData(ahini: HINI; const pszApp, pszKey: PChar; var pData;
  286. cchDataLen: Cardinal): Longbool; cdecl;
  287. external 'PMSHAPI' index 118;
  288. Function PrfOpenProfile(ahab: HAB;const pszFileName: PChar): HINI; cdecl;
  289. external 'PMSHAPI' index 102;
  290. Function PrfCloseProfile(ahini: HINI): Longbool; cdecl;
  291. external 'PMSHAPI' index 103;
  292. Function PrfReset(ahab: HAB; var apPrfProfile: PrfProfile): Longbool; cdecl;
  293. external 'PMSHAPI' index 108;
  294. Function PrfQueryProfile(ahab: HAB; var apPrfProfile: PrfProfile): Longbool; cdecl;
  295. external 'PMSHAPI' index 107;
  296. // public message, broadcast on WinReset
  297. const
  298. PL_ALTERED=$008E; // WM_SHELLFIRST + 0E
  299. Implementation
  300. End.
  301. {
  302. $Log$
  303. Revision 1.1 2003-03-02 02:04:12 hajny
  304. + PMShl added
  305. }