home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: Graphics / Graphics.zip / os2apipm.zip / OS2API / OS2-PMCP.ADS < prev    next >
Text File  |  1996-10-17  |  31KB  |  723 lines

  1.  -- ╔═══════════════════════════════════════════════════════════════════╗
  2.  -- ║       D E S I G N   E N G I N E R I N G              ║D║S║        ║
  3.  -- ║            S O F T W A R E                           ╚═╩═╝        ║
  4.  -- ║                                                                   ║
  5.  -- ║        Package      OS2.PMcp                                      ║
  6.  -- ║                                                                   ║
  7.  -- ║        Author :  Leonid Dulman     1995 , 1996                    ║
  8.  -- ║                                                                   ║
  9.  -- ║             GNU ADA RUNTIME LIBRARY (GNARL) COMPONENTS            ║
  10.  -- ║                                                                   ║
  11.  -- ║                     Shell API                                     ║
  12.  -- ║                     OS2.INI Access functions                      ║
  13.  -- ║                     Heap Manager Interface                        ║
  14.  -- ║                     Atom Manager Interface                        ║
  15.  -- ║                   Get/Set Error Information Interface             ║
  16.  -- ║                   Dynamic Data Exchange ( DDE) Routines           ║
  17.  -- ║                   Load/Delete Library/Procedure                   ║
  18.  -- ║                     Desktop API definitions                       ║
  19.  -- ║                     Palette Manager API definition                ║
  20.  -- ║                                                                   ║
  21.  -- ║                                                                   ║
  22.  -- ╚═══════════════════════════════════════════════════════════════════╝
  23.  
  24.  package Os2.PMcp is
  25.  pragma Preelaborate (PMcp);
  26.  
  27. --    Include Shell API
  28.  subtype HPROGRAM is LHANDLE ;       -- hprog
  29.  type PHPROGRAM  is access all HPROGRAM;
  30.  subtype HAPP  is LHANDLE ;
  31.  subtype HINI  is LHANDLE ;
  32.  type PHINI  is access all HINI;
  33.  
  34.  type PRFPROFILE  is record    -- prfpro
  35.     cchUserName  :ULONG  ;
  36.     pszUserName  :PSZ    ;
  37.     cchSysName   :ULONG  ;
  38.     pszSysName   :PSZ    ;
  39.  end record; -- PRFPROFILE;
  40.  type PPRFPROFILE  is access all PRFPROFILE;
  41.  
  42.        MAXNAMEL:constant:=60;     --   maximum title length
  43.        MAXPATHL:constant:= 128;   -- maximum path length
  44.  
  45.     -- program list section
  46.        -- root group handle
  47.  
  48.  type HPROGARRAY  is record       -- hpga
  49.    ahprog      :HPROGRAM ; --  [1];
  50.  end record; -- HPROGARRAY;
  51.  type PHPROGARRAY  is access all HPROGARRAY;
  52.  
  53.  type PROGCATEGORY  is access function return ULONG ;       -- progc
  54.  
  55.  subtype PPROGCATEGORY  is PROGCATEGORY;
  56.  
  57.     -- values acceptable for PROGCATEGORY for PM groups
  58.  --  PROG_DEFAULT             (PROGCATEGORY)0
  59.  --  PROG_FULLSCREEN          (PROGCATEGORY)1
  60.  --  PROG_WINDOWABLEVIO       (PROGCATEGORY)2
  61.  --  PROG_PM                  (PROGCATEGORY)3
  62.  --  PROG_GROUP               (PROGCATEGORY)5
  63.  --  PROG_REAL                (PROGCATEGORY)4
  64.  --  PROG_VDM                 (PROGCATEGORY)4
  65.  --  PROG_WINDOWEDVDM         (PROGCATEGORY)7
  66.  --  PROG_DLL                 (PROGCATEGORY)6
  67.  --  PROG_PDD                 (PROGCATEGORY)8
  68.  --  PROG_VDD                 (PROGCATEGORY)9
  69.  --  PROG_WINDOW_REAL         (PROGCATEGORY)10
  70.  --  PROG_WINDOW_PROT         (PROGCATEGORY)11
  71.  --  PROG_30_STD              (PROGCATEGORY)11
  72.  --  PROG_WINDOW_AUTO         (PROGCATEGORY)12
  73.  --  PROG_SEAMLESSVDM         (PROGCATEGORY)13
  74.  --  PROG_30_STDSEAMLESSVDM   (PROGCATEGORY)13
  75.  --  PROG_SEAMLESSCOMMON      (PROGCATEGORY)14
  76.  --  PROG_30_STDSEAMLESSCOMMON (PROGCATEGORY)14
  77.  --  PROG_31_STDSEAMLESSVDM   (PROGCATEGORY)15
  78.  --  PROG_31_STDSEAMLESSCOMMON (PROGCATEGORY)16
  79.  --  PROG_31_ENHSEAMLESSVDM   (PROGCATEGORY)17
  80.  --  PROG_31_ENHSEAMLESSCOMMON (PROGCATEGORY)18
  81.  --  PROG_31_ENH              (PROGCATEGORY)19
  82.  --  PROG_31_STD              (PROGCATEGORY)20
  83.  --  PROG_RESERVED            (PROGCATEGORY)255
  84.  
  85.  type PROGTYPE  is record         -- progt
  86.      progc        :PPROGCATEGORY ;
  87.      fbVisible    :ULONG         ;
  88.  end record; -- PROGTYPE;
  89.  type PPROGTYPE  is access all PROGTYPE;
  90.  
  91.  --       visibility flag for PROGTYPE structure
  92.  
  93.  SHE_VISIBLE         :constant Long:= 16#00#;
  94.  SHE_INVISIBLE       :constant Long:= 16#01#;
  95.  SHE_RESERVED        :constant Long:= 16#FF#;
  96.  
  97.  --       Protected group flag for PROGTYPE structure
  98.  SHE_UNPROTECTED     :constant Long:= 16#00#;
  99.  SHE_PROTECTED       :constant Long:= 16#02#;
  100.  
  101.  --       Structures associated with 'Prf' calls
  102.  
  103.  type PROGDETAILS  is record    -- progde
  104.    Length              :ULONG      ;         -- set this to sizeof(PROGDETAILS)
  105.    progt               :PPROGTYPE  ;
  106.    pszTitle            :PSZ        ;       -- any of the pointers can be NULL
  107.    pszExecutable       :PSZ        ;
  108.    pszParameters       :PSZ        ;
  109.    pszStartupDir       :PSZ        ;
  110.    pszIcon             :PSZ        ;
  111.    pszEnvironment      :PSZ        ; -- this is terminated by  /0/0
  112.    swpInitial          :SWP        ;     -- this replaces XYWINSIZE
  113.  end record; -- PROGDETAILS;
  114.  type PPROGDETAILS  is access all PROGDETAILS;
  115.  
  116.  type PROGTITLE  is record             -- progti
  117.     hprog        :HPROGRAM  ;
  118.     progt        :PPROGTYPE ;
  119.     pszTitle     :PSZ       ;
  120.  end record; -- PROGTITLE;
  121.  type PPROGTITLE  is access all PROGTITLE;
  122.  
  123.        -- Program List API Function Definitions
  124.        -- Program List API available 'Prf' calls
  125.  
  126.  function PrfQueryProgramTitles(hin         :HINI       ;
  127.                                 hprogGroup  :HPROGRAM   ;
  128.                                 pTitles     :PPROGTITLE ;
  129.                                 cchBufferMax:ULONG      ;
  130.                                 pulCount    :PULONG     )return ULONG;
  131.  pragma Import(c,PrfQueryProgramTitles, Link_name=>"PrfQueryProgramTitles");
  132.  
  133.        --
  134.        --  NOTE: string information is concatanated after the array of
  135.        --        PROGTITLE structures so you need to allocate storage
  136.        --        greater than sizeof(PROGTITLE)cPrograms to query programs
  137.        --        in a group.
  138.        --
  139.        --  PrfQueryProgramTitles recommended usage to obtain titles of all
  140.        --  programs in a group (Hgroup=SGH_ROOT is for all groups):
  141.        --
  142.        --  BufLen = PrfQueryProgramTitles(Hini; Hgroup;
  143.        --                                  (PPROGTITLE)NULL; 0; &Count)return ULONG;
  144.        --
  145.        --  Alocate buffer of  Buflen
  146.        --
  147.        --  Len = PrfQueryProgramTitles(Hini; Hgroup; (PPROGTITLE)pBuffer;
  148.        --                               BufLen; pCount)return ULONG;
  149.        --
  150.        --
  151.  
  152.  function PrfAddProgram(hin       :HINI         ;
  153.                         pDetails  :PPROGDETAILS ;
  154.                         hprogGroup:HPROGRAM     )return HPROGRAM;
  155.  pragma Import(c,PrfAddProgram, Link_name=>"PrfAddProgram");
  156.  
  157.  function PrfChangeProgram(hin     :HINI         ;
  158.                            hprog   :HPROGRAM     ;
  159.                            pDetails:PPROGDETAILS )return BOOL;
  160.  pragma Import(c,PrfChangeProgram, Link_name=>"PrfChangeProgram");
  161.  
  162.  function PrfQueryDefinition(hin         :HINI         ;
  163.                              hprog       :HPROGRAM     ;
  164.                              pDetails    :PPROGDETAILS ;
  165.                              cchBufferMax:ULONG        )return ULONG;
  166.  pragma Import(c,PrfQueryDefinition, Link_name=>"PrfQueryDefinition");
  167.  
  168.        --
  169.        --  NOTE: string information is concatanated after the PROGDETAILS
  170.        --        field structure so you need to allocate storage greater
  171.        --        than sizeof(PROGDETAILS) to query programs
  172.        --
  173.        --  PrfQueryDefinition recomended usage:
  174.        --
  175.        --  bufferlen = PrfQueryDefinition(Hini;Hprog;(PPROGDETAILS)NULL;0)
  176.        --
  177.        --  Alocate buffer of bufferlen bytes
  178.        --  set Length field (0 will be supported)
  179.        --
  180.        --  (PPROGDETAILS)pBuffer->Length=sizeof(PPROGDETAILS)
  181.        --
  182.        --  len = PrfQueryDefinition(Hini; Hprog; (PPROGDETAILS)pBuffer;
  183.        --      bufferlen)
  184.        --
  185.  
  186.  function PrfRemoveProgram(hin  :HINI     ;
  187.                            hprog:HPROGRAM )return BOOL ;
  188.  pragma Import(c,PrfRemoveProgram, Link_name=>"PrfRemoveProgram");
  189.  
  190.  function PrfQueryProgramHandle(hin         :HINI        ;
  191.                                 pszExe      :PSZ         ;
  192.                         phprogArr   :PHPROGARRAY ;
  193.                                 cchBufferMax:ULONG       ;
  194.                                 pulCount    :PULONG      )return ULONG;
  195.  pragma Import(c,PrfQueryProgramHandle, Link_name=>"PrfQueryProgramHandle");
  196.  
  197.  function PrfCreateGroup(hin         :HINI  ;
  198.                          pszTitle    :PSZ   ;
  199.                          chVisibility:UCHAR )return HPROGRAM;
  200.  pragma Import(c,PrfCreateGroup, Link_name=>"PrfCreateGroup");
  201.  
  202.  function PrfDestroyGroup(hin       :HINI     ;
  203.                           hprogGroup:HPROGRAM )return BOOL ;
  204.  pragma Import(c,PrfDestroyGroup, Link_name=>"PrfDestroyGroup");
  205.  
  206.  function PrfQueryProgramCategory(hin   :HINI ;
  207.                                   pszExe:PSZ  )return PROGCATEGORY  ;
  208.  pragma Import(c,PrfQueryProgramCategory, Link_name=>"PrfQueryProgramCategory");
  209.  
  210.  function WinStartApp(hwndNotify:HWND         ;
  211.                       pDetails  :PPROGDETAILS ;
  212.                       pszParams :PSZ          ;
  213.                       Reserved  :PVOID        ;
  214.                       fbOptions :ULONG        )return HAPP ;
  215.  pragma Import(c,WinStartApp, Link_name=>"_WinStartApp");
  216.  
  217.        -- bit values for Options parameter
  218.   SAF_VALIDFLAGS        :constant Long:= 16#001F#;
  219.   SAF_INSTALLEDCMDLINE  :constant Long:= 16#0001#;   -- use installed parameters
  220.   SAF_STARTCHILDAPP     :constant Long:= 16#0002#;   -- related application
  221.   SAF_MAXIMIZED         :constant Long:= 16#0004#;   -- Start App maximized
  222.   SAF_MINIMIZED         :constant Long:= 16#0008#;   -- Start App minimized; if !SAF_MAXIMIZED
  223.   SAF_BACKGROUND        :constant Long:= 16#0010#;   -- Start app in the background
  224.  
  225.  function WinTerminateApp(hap:HAPP )return BOOL ;
  226.  pragma Import(c,WinTerminateApp, Link_name=>"_WinTerminateApp");
  227.  
  228.  -- switch list section
  229.  
  230.  subtype  HSWITCH is LHANDLE ;        -- hsw
  231.  type PHSWITCH  is access all HSWITCH;
  232.  
  233.  type SWCNTRL   is record         -- swctl
  234.     hwn               :HWND     ;
  235.     hwndIcon          :HWND     ;
  236.     hprog             :HPROGRAM ;
  237.     idProcess         :PID      ;
  238.     idSession         :ULONG    ;
  239.     uchVisibility     :ULONG    ;
  240.     fbJump            :ULONG    ;
  241.     szSwtitle         :Astring(1..MAXNAMEL+4);
  242.     bProgType         :ULONG    ;
  243.  end record; -- SWCNTRL;
  244.  type PSWCNTRL  is access all SWCNTRL;
  245.  
  246.        -- visibility flag for SWCNTRL structure
  247.  SWL_VISIBLE    :constant ULong:= 16#04#;
  248.  SWL_INVISIBLE  :constant ULong:= 16#01#;
  249.  SWL_GRAYED     :constant ULong:= 16#02#;
  250.  
  251.        -- jump flag for SWCNTRL structure
  252.  SWL_JUMPABLE    :constant ULong:= 16#02#;
  253.  SWL_NOTJUMPABLE :constant ULong:= 16#01#;
  254.  
  255.  
  256.        -- Switching Program functions
  257.  
  258.  function WinAddSwitchEntry(psw:PSWCNTRL)return HSWITCH ;
  259.  pragma Import(c,WinAddSwitchEntry, Link_name=>"_WinAddSwitchEntry");
  260.  
  261.  function WinRemoveSwitchEntry(hsw:HSWITCH)return ULONG;
  262.  pragma Import(c,WinRemoveSwitchEntry, Link_name=>"_WinRemoveSwitchEntry");
  263.  
  264.  type SWENTRY   is record         -- swent
  265.      switch     :HSWITCH ;
  266.      swctl      :SWCNTRL ;
  267.  end record; -- SWENTRY;
  268.  type PSWENTRY  is access all SWENTRY;
  269.  
  270.  type SWBLOCK    is record        -- swblk
  271.      cswentry    :ULONG   ;
  272.      aswentry    :SWENTRY ;        --  [1];
  273.  end record; -- SWBLOCK;
  274.  type PSWBLOCK  is access all SWBLOCK;
  275.  
  276.        -- 32-bit versions of these APIs have 32-bit parameters
  277.  
  278.  function WinChangeSwitchEntry(hswitchSwitch   :HSWITCH  ;
  279.                                pswctlSwitchData:PSWCNTRL )return ULONG;
  280.  pragma Import(c,WinChangeSwitchEntry, Link_name=>"_WinChangeSwitchEntry");
  281.  
  282.  function WinCreateSwitchEntry(ha              :HAB      ;
  283.                                pswctlSwitchData:PSWCNTRL )return  HSWITCH;
  284.  pragma Import(c,WinCreateSwitchEntry, Link_name=>"_WinCreateSwitchEntry");
  285.  
  286.  function WinQuerySessionTitle(ha        :HAB   ;
  287.                                usSession :ULONG ;
  288.                                pszTitle  :PSZ   ;
  289.                                usTitlelen:ULONG )return ULONG;
  290.  pragma Import(c,WinQuerySessionTitle, Link_name=>"_WinQuerySessionTitle");
  291.  
  292.  function WinQuerySwitchEntry(hswitchSwitch   :HSWITCH  ;
  293.                               pswctlSwitchData:PSWCNTRL )return ULONG;
  294.  pragma Import(c,WinQuerySwitchEntry, Link_name=>"_WinQuerySwitchEntry");
  295.  
  296.  function WinQuerySwitchHandle(hwn       :HWND ;
  297.                                pidProcess:PID  )return HSWITCH  ;
  298.  pragma Import(c,WinQuerySwitchHandle, Link_name=>"_WinQuerySwitchHandle");
  299.  
  300.  function WinQuerySwitchList(ha                 :HAB      ;
  301.                              pswblkSwitchEntries:PSWBLOCK ;
  302.                              usDataLength       :ULONG    )return ULONG;
  303.  pragma Import(c,WinQuerySwitchList, Link_name=>"_WinQuerySwitchList");
  304.  
  305.  function WinQueryTaskSizePos(ha              :HAB   ;
  306.                               usScreenGroup   :ULONG ;
  307.                               pswpPositionData:PSWP  )return ULONG;
  308.  pragma Import(c,WinQueryTaskSizePos, Link_name=>"_WinQueryTaskSizePos");
  309.  
  310.  function WinQueryTaskTitle(usSession :ULONG ;
  311.                             pszTitle  :PSZ   ;
  312.                             usTitlelen:ULONG )return ULONG;
  313.  pragma Import(c,WinQueryTaskTitle, Link_name=>"_WinQueryTaskTitle");
  314.  
  315.  function WinSwitchToProgram(hswitchSwHandle:HSWITCH )return ULONG;
  316.  pragma Import(c,WinSwitchToProgram, Link_name=>"_WinSwitchToProgram");
  317.  
  318.        -- OS2.INI Access functions
  319.  
  320.  function PrfSuspendWriteToDisk(hin     :HINI ;
  321.                                 fSuspend:BOOL )return BOOL;
  322.  pragma Import(c,PrfSuspendWriteToDisk, Link_name=>"PrfSuspendWriteToDisk");
  323.  
  324.  function PrfQueryProfileInt(hin     :HINI  ;
  325.                              pszApp  :PSZ   ;
  326.                              pszKey  :PSZ   ;
  327.                              sDefault:LONG  )return LONG;
  328.  pragma Import(c,PrfQueryProfileInt, Link_name=>"PrfQueryProfileInt");
  329.  
  330.  function PrfQueryProfileString(hin         :HINI  ;
  331.                                 pszApp      :PSZ   ;
  332.                                 pszKey      :PSZ   ;
  333.                                 pszDefault  :PSZ   ;
  334.                                 pBuffer     :PVOID ;
  335.                                 cchBufferMax:ULONG )return ULONG;
  336.  pragma Import(c,PrfQueryProfileString, Link_name=>"PrfQueryProfileString");
  337.  
  338.  function PrfWriteProfileString(hin    :HINI ;
  339.                                 pszApp :PSZ  ;
  340.                                 pszKey :PSZ  ;
  341.                                 pszData:PSZ  )return BOOL ;
  342.  pragma Import(c,PrfWriteProfileString, Link_name=>"PrfWriteProfileString");
  343.  
  344.  function PrfQueryProfileSize(hin      :HINI   ;
  345.                               pszApp   :PSZ    ;
  346.                               pszKey   :PSZ    ;
  347.                               pulReqLen:PULONG )return BOOL ;
  348.  pragma Import(c,PrfQueryProfileSize, Link_name=>"PrfQueryProfileSize");
  349.  
  350.  function PrfQueryProfileData(hin       :HINI   ;
  351.                               pszApp    :PSZ    ;
  352.                               pszKey    :PSZ    ;
  353.                               pBuffer   :PVOID  ;
  354.                               pulBuffLen:PULONG )return BOOL ;
  355.  pragma Import(c,PrfQueryProfileData, Link_name=>"PrfQueryProfileData");
  356.  
  357.  function PrfWriteProfileData(hin       :HINI  ;
  358.                               pszApp    :PSZ   ;
  359.                               pszKey    :PSZ   ;
  360.                               pData     :PVOID ;
  361.                               cchDataLen:ULONG )return BOOL ;
  362.  pragma Import(c,PrfWriteProfileData, Link_name=>"PrfWriteProfileData");
  363.  
  364.  function PrfOpenProfile(ha         :HAB ;
  365.                          pszFileName:PSZ  )return HINI;
  366.  pragma Import(c,PrfOpenProfile, Link_name=>"PrfOpenProfile");
  367.  
  368.  function PrfCloseProfile(hin :HINI )return BOOL ;
  369.  pragma Import(c,PrfCloseProfile, Link_name=>"PrfCloseProfile");
  370.  
  371.  function PrfReset(ha         :HAB         ;
  372.                    pPrfProfl  :PPRFPROFILE )return BOOL;
  373.  pragma Import(c,PrfReset, Link_name=>"PrfReset");
  374.  
  375.  function PrfQueryProfile(ha         :HAB         ;
  376.                           pPrfProfl  :PPRFPROFILE )return BOOL ;
  377.  pragma Import(c,PrfQueryProfile, Link_name=>"PrfQueryProfile");
  378.  
  379. function WinQueryCp(hm:HMQ)return ULONG ;
  380. pragma Import(c,WinQueryCp, Link_name=>"_WinQueryCp");
  381.  
  382. function WinSetCp(hm        :HMQ   ;
  383.                   idCodePage:ULONG )return BOOL32;
  384. pragma Import(c,WinSetCp, Link_name=>"_WinSetCp");
  385.  
  386. function WinQueryCpList(ha    :HAB    ;
  387.                         ccpMax:ULONG  ;
  388.                         prgcp :PULONG )return ULONG ;
  389. pragma Import(c,WinQueryCpList, Link_name=>"_WinQueryCpList");
  390.  
  391. function WinCpTranslateString(ha        :HAB   ;
  392.                               cpSrc     :ULONG ;
  393.                               pszSrc    :PSZ   ;
  394.                               cpDst     :ULONG ;
  395.                               cchDestMax:ULONG ;
  396.                               pchDest   :PSZ   )return BOOL32;
  397. pragma Import(c,WinCpTranslateString, Link_name=>"_WinCpTranslateString");
  398.  
  399. function WinCpTranslateChar(ha   :HAB   ;
  400.                             cpSrc:ULONG ;
  401.                             chSrc:UCHAR ;
  402.                             cpDst:ULONG )return UCHAR  ;
  403. pragma Import(c,WinCpTranslateChar, Link_name=>"_WinCpTranslateChar");
  404.  
  405. function WinUpper(ha  :HAB   ;
  406.                   idcp:ULONG ;
  407.                   idcc:ULONG ;
  408.                   ps  :PSZ   )return ULONG ;
  409. pragma Import(c,WinUpper, Link_name=>"_WinUpper");
  410.  
  411. function WinUpperChar(ha  :HAB   ;
  412.                       idcp:ULONG ;
  413.                       idcc:ULONG ;
  414.                       c   :ULONG )return ULONG ;
  415. pragma Import(c,WinUpperChar, Link_name=>"_WinUpperChar");
  416.  
  417. function WinNextChar(ha  :HAB   ;
  418.                      idcp:ULONG ;
  419.                      idcc:ULONG ;
  420.                      ps  :PSZ   )return PSZ;
  421. pragma Import(c,WinNextChar, Link_name=>"_WinNextChar");
  422.  
  423. function WinPrevChar(ha      :HAB   ;
  424.                      idcp    :ULONG ;
  425.                      idcc    :ULONG ;
  426.                      pszStart:PSZ   ;
  427.                      ps      :PSZ   )return PSZ;
  428. pragma Import(c,WinPrevChar, Link_name=>"_WinPrevChar");
  429.  
  430. function WinCompareStrings(ha      :HAB   ;
  431.                            idcp    :ULONG ;
  432.                            idcc    :ULONG ;
  433.                            psz1    :PSZ   ;
  434.                            psz2    :PSZ   ;
  435.                            reserved:ULONG )return ULONG ;
  436. pragma Import(c,WinCompareStrings, Link_name=>"_WinCompareString");
  437.  
  438.  WCS_ERROR :constant Long:= 0 ;
  439.  WCS_EQ    :constant Long:= 1 ;
  440.  WCS_LT    :constant Long:= 2 ;
  441.  WCS_GT    :constant Long:= 3 ;
  442.  
  443. --     Heap Manager Interface declarations
  444. --     Atom Manager Interface declarations
  445.  
  446. subtype  HATOMTBL is  LHANDLE;
  447. subtype  ATOM     is  ULONG  ;
  448.  
  449. function WinQuerySystemAtomTable return HATOMTBL;
  450. pragma Import(c,WinQuerySystemAtomTable, Link_name=>"_WinQuerySystemAtomTable");
  451.  
  452. function WinCreateAtomTable(cbInitial:ULONG ;
  453.                             cBuckets :ULONG )return HATOMTBL;
  454. pragma Import(c,WinCreateAtomTable, Link_name=>"_WinCreateAtomTable");
  455.  
  456. function WinDestroyAtomTable(AtomTbl:HATOMTBL )return HATOMTBL;
  457. pragma Import(c,WinDestroyAtomTable, Link_name=>"_WinDestroyAtomTable");
  458.  
  459. function WinAddAtom(AtomTbl    :HATOMTBL  ;
  460.                     pszAtomName:PSZ       )return ATOM;
  461. pragma Import(c,WinAddAtom, Link_name=>"_WinAddAtom");
  462.  
  463. function WinFindAtom(AtomTbl    :HATOMTBL ;
  464.                      pszAtomName:PSZ      )return ATOM;
  465. pragma Import(c,WinFindAtom, Link_name=>"_WinFindAtom");
  466.  
  467. function WinDeleteAtom(AtomTbl:HATOMTBL ;
  468.                        atm    :ATOM     )return ATOM;
  469. pragma Import(c,WinDeleteAtom, Link_name=>"_WinDeleteAtom");
  470.  
  471. function WinQueryAtomUsage(AtomTbl:HATOMTBL ;
  472.                            atm    :ATOM     )return ULONG;
  473. pragma Import(c,WinQueryAtomUsage, Link_name=>"_WinQueryAtomUsage");
  474.  
  475. function WinQueryAtomLength(AtomTbl:HATOMTBL ;
  476.                             atm    :ATOM     )return ULONG;
  477. pragma Import(c,WinQueryAtomLength, Link_name=>"_WinQueryAtomLength");
  478.  
  479. function WinQueryAtomName(AtomTbl     :HATOMTBL ;
  480.                           atm         :ATOM     ;
  481.                           pchBuffer   :PSZ      ;
  482.                           cchBufferMax:ULONG    )return ULONG;
  483. pragma Import(c,WinQueryAtomName, Link_name=>"_WinQueryAtomName");
  484.  
  485. --     Error codes for debugging support
  486. --      16#1001#  16#1021#  16#1034#  16#1036#  16#1050# are reserved
  487.  
  488.  WINDBG_HWND_NOT_DESTROYED           :constant Long:= 16#1022#;
  489.  WINDBG_HPTR_NOT_DESTROYED           :constant Long:= 16#1023#;
  490.  WINDBG_HACCEL_NOT_DESTROYED         :constant Long:= 16#1024#;
  491.  WINDBG_HENUM_NOT_DESTROYED          :constant Long:= 16#1025#;
  492.  WINDBG_VISRGN_SEM_BUSY              :constant Long:= 16#1026#;
  493.  WINDBG_USER_SEM_BUSY                :constant Long:= 16#1027#;
  494.  WINDBG_DC_CACHE_BUSY                :constant Long:= 16#1028#;
  495.  WINDBG_HOOK_STILL_INSTALLED         :constant Long:= 16#1029#;
  496.  WINDBG_WINDOW_STILL_LOCKED          :constant Long:= 16#102a#;
  497.  WINDBG_UPDATEPS_ASSERTION_FAIL      :constant Long:= 16#102b#;
  498.  WINDBG_SENDMSG_WITHIN_USER_SEM      :constant Long:= 16#102c#;
  499.  WINDBG_USER_SEM_NOT_ENTERED         :constant Long:= 16#102d#;
  500.  WINDBG_PROC_NOT_EXPORTED            :constant Long:= 16#102e#;
  501.  WINDBG_BAD_SENDMSG_HWND             :constant Long:= 16#102f#;
  502.  WINDBG_ABNORMAL_EXIT                :constant Long:= 16#1030#;
  503.  WINDBG_INTERNAL_REVISION            :constant Long:= 16#1031#;
  504.  WINDBG_INITSYSTEM_FAILED            :constant Long:= 16#1032#;
  505.  WINDBG_HATOMTBL_NOT_DESTROYED       :constant Long:= 16#1033#;
  506.  WINDBG_WINDOW_UNLOCK_WAIT           :constant Long:= 16#1035#;
  507.  
  508. --     Get/Set Error Information Interface declarations
  509.  
  510. type ERRINFO   is record   -- erri
  511.     cbFixedErrInfo   :ULONG   ;
  512.     idError          :ERRORID ;
  513.     cDetailLevel     :ULONG   ;
  514.     offaoffszMsg     :ULONG   ;
  515.     offBinaryData    :ULONG   ;
  516. end record; -- ERRINFO;
  517. type PERRINFO  is access all ERRINFO;
  518.  
  519. function   WinGetLastError( ha :HAB)return ERRORID ;
  520. pragma Import(c,WinGetLastError, Link_name=>"_WinGetLastError");
  521.  
  522. function   WinGetErrorInfo(ha :HAB )return PERRINFO;
  523. pragma Import(c,WinGetErrorInfo, Link_name=>"_WinGetErrorInfo");
  524.  
  525. function  WinFreeErrorInfo(erinfo:PERRINFO )return BOOL32;
  526. pragma Import(c,WinFreeErrorInfo, Link_name=>"_WinFreeErrorInfo");
  527.  
  528. --     -- include WinSetErrorInfo
  529. --
  530. --  ERRORID APIENTRY WinSetErrorInfo(ERRORID,
  531. --                                   ULONG,
  532. --                                   ...);
  533.  
  534.  SEI_BREAKPOINT   :constant Long:= 16#8000#;--Always enter an INT 3 breakpt
  535.  SEI_NOBEEP       :constant Long:= 16#4000#;--Do not call DosBeep
  536.  SEI_NOPROMPT     :constant Long:= 16#2000#;--Do not prompt the user
  537.  SEI_DBGRSRVD     :constant Long:= 16#1000#;--Reserved for debug use
  538. --   SEI_DEBUGONLY    (SEI_BREAKPOINT | SEI_NOBEEP | SEI_NOPROMPT | SEI_RESERVED)
  539. --
  540.  SEI_STACKTRACE   :constant Long:= 16#0001#;--save the stack trace
  541.  SEI_REGISTERS    :constant Long:= 16#0002#;--save the registers
  542.  SEI_ARGCOUNT     :constant Long:= 16#0004#;--first USHORT in args is arg count
  543.  SEI_DOSERROR     :constant Long:= 16#0008#;--first USHORT in args is OS2 error code
  544.  SEI_RESERVED     :constant Long:= 16#0FE0#;--Reserved for future use
  545.  
  546. --   Note that when SEI_ARGCOUNT, SEI_DOSERROR are specified
  547. --   together, then the implied order of the parameters is:
  548. --
  549. --    WinSetErrorInfo( MAKEERRORID( .... ),
  550. --                     SEI_ARGCOUNT | SEI_DOSERROR,
  551. --                     argCount,
  552. --                     dosErrorCode);
  553. --
  554. --        DDE standard system topic and item strings
  555. --
  556. SZDDESYS_TOPIC            :constant string:= "System"        ;
  557. SZDDESYS_ITEM_TOPICS      :constant string:= "Topics"        ;
  558. SZDDESYS_ITEM_SYSITEMS    :constant string:= "SysItems"      ;
  559. SZDDESYS_ITEM_RTNMSG      :constant string:= "ReturnMessage" ;
  560. SZDDESYS_ITEM_STATUS      :constant string:= "Status"        ;
  561. SZDDESYS_ITEM_FORMATS     :constant string:= "Formats"       ;
  562. SZDDESYS_ITEM_SECURITY    :constant string:= "Security"      ;
  563. SZDDESYS_ITEM_ITEMFORMATS :constant string:= "ItemFormats"   ;
  564. SZDDESYS_ITEM_HELP        :constant string:= "Help"          ;
  565. SZDDESYS_ITEM_PROTOCOLS   :constant string:= "Protocols"     ;
  566. SZDDESYS_ITEM_RESTART     :constant string:= "Restart"       ;
  567.  
  568. --        Dynamic Data Exchange ( DDE) Structure Declarations
  569.  
  570. type CONVCONTEXT   is record   -- cctxt
  571.    cb                :ULONG ;          -- sizeof( CONVCONTEXT)
  572.    fsContext         :ULONG ;
  573.    idCountry         :ULONG ;
  574.    usCodepage        :ULONG ;
  575.    usLangID          :ULONG ;
  576.    usSubLangID       :ULONG ;
  577. end record; -- CONVCONTEXT;
  578. type PCONVCONTEXT  is access all CONVCONTEXT;
  579.  
  580. --         DDECTXT_CASESENSITIVE    :constant Long:= 16#0001
  581.  
  582. type DDEINIT  is record    -- ddei
  583.     cb                  :ULONG   ;         -- sizeof( DDEINIT)
  584.     pszAppName          :PSZ     ;
  585.     pszTopic            :PSZ     ;
  586.     offConvContext      :ULONG   ;
  587. end record; -- DDEINIT;
  588. type PDDEINIT  is access all DDEINIT;
  589.  
  590. type DDESTRUCT   is record   -- dde
  591.     cbData             :ULONG   ;
  592.     fsStatus           :USHORT  ;
  593.     usFormat           :USHORT  ;
  594.     offszItemName      :USHORT  ;
  595.     offabData          :USHORT  ;
  596. end record; -- DDESTRUCT;
  597. type PDDESTRUCT  is access all DDESTRUCT;
  598.  
  599. --         DDE constants for wStatus field
  600.  DDE_FACK                   :constant Long:= 16#0001#;
  601.  DDE_FBUSY                  :constant Long:= 16#0002#;
  602.  DDE_FNODATA                :constant Long:= 16#0004#;
  603.  DDE_FACKREQ                :constant Long:= 16#0008#;
  604.  DDE_FRESPONSE              :constant Long:= 16#0010#;
  605.  DDE_NOTPROCESSED           :constant Long:= 16#0020#;
  606.  DDE_FRESERVED              :constant Long:= 16#00C0#;
  607.  DDE_FAPPSTATUS             :constant Long:= 16#FF00#;
  608.  
  609. --         old DDE public formats - new ones are CF_ constants
  610. --
  611. --         DDEFMT_TEXT                :constant Long:= 16#0001
  612.  
  613. --        Dynamic Data Exchange ( DDE) Routines
  614. --
  615. function WinDdeInitiate(hwndClient  :HWND         ;
  616.                         pszAppName  :PSZ          ;
  617.                         pszTopicName:PSZ          ;
  618.                         pcctxt      :PCONVCONTEXT )return BOOL32;
  619. pragma Import(c,WinDdeInitiate, Link_name=>"_WinDdeInitiate");
  620.  
  621. procedure WinDdeRespond(hwndClient  :HWND         ;
  622.                         hwndServer  :HWND         ;
  623.                         pszAppName  :PSZ          ;
  624.                         pszTopicName:PSZ          ;
  625.                         pcctxt      :PCONVCONTEXT );
  626. pragma Import(c,WinDdeRespond, Link_name=>"_WinDdeRespond");
  627.  
  628. function WinDdePostMsg(hwndTo   :HWND       ;
  629.                        hwndFrom :HWND       ;
  630.                        wm       :ULONG      ;
  631.                        pddest   :PDDESTRUCT ;
  632.                        flOptions:ULONG      )return BOOL32;
  633. pragma Import(c,WinDdePostMsg, Link_name=>"_WinDdePostMsg");
  634.  
  635. --         DDEPM_RETRY     :constant Long:= 16#00000001#;
  636. --         DDEPM_NOFREE    :constant Long:= 16#00000002#;
  637.  
  638. --        -- Dynamic Data Exchange ( DDE) Messages
  639.  
  640.   WM_DDE_FIRST               :constant Long:= 16#00A0#;
  641.   WM_DDE_INITIATE            :constant Long:= 16#00A0#;
  642.   WM_DDE_REQUEST             :constant Long:= 16#00A1#;
  643.   WM_DDE_ACK                 :constant Long:= 16#00A2#;
  644.   WM_DDE_DATA                :constant Long:= 16#00A3#;
  645.   WM_DDE_ADVISE              :constant Long:= 16#00A4#;
  646.   WM_DDE_UNADVISE            :constant Long:= 16#00A5#;
  647.   WM_DDE_POKE                :constant Long:= 16#00A6#;
  648.   WM_DDE_EXECUTE             :constant Long:= 16#00A7#;
  649.   WM_DDE_TERMINATE           :constant Long:= 16#00A8#;
  650.   WM_DDE_INITIATEACK         :constant Long:= 16#00A9#;
  651.   WM_DDE_LAST                :constant Long:= 16#00AF#;
  652.   WM_QUERYCONVERTPOS         :constant Long:= 16#00b0#; -- WM_DBCSFIRST
  653.  
  654. --     -- Return values for WM_QUERYCONVERTPOS
  655. --      QCP_CONVERT                :constant Long:= 16#0001#;
  656. --      QCP_NOCONVERT              :constant Long:= 16#0000#;
  657.  
  658. --  Load/Delete Library/Procedure
  659.  
  660. subtype  HLIB  is HMODULE  ;
  661. subtype  PHLIB is PHMODULE ;
  662.  
  663. function WinDeleteProcedure(ha     :HAB   ;
  664.                             wndproc:PFNWP )return BOOL32;
  665. pragma Import(c,WinDeleteProcedure, Link_name=>"_WinDeleteProcedure");
  666.  
  667. function WinDeleteLibrary(ha       :HAB  ;
  668.                           libhandle:HLIB )return BOOL32;
  669. pragma Import(c,WinDeleteLibrary, Link_name=>"_WinDeleteLibrary");
  670.  
  671. function WinLoadProcedure(ha       :HAB  ;
  672.                           libhandle:HLIB ;
  673.                           procname :PSZ  )return PFNWP  ;
  674. pragma Import(c,WinLoadProcedure, Link_name=>"_WinLoadProcedure");
  675.  
  676. function WinLoadLibrary(ha     :HAB ;
  677.                         libname:PSZ )return HLIB  ;
  678. pragma Import(c,WinLoadLibrary, Link_name=>"_WinLoadLibrary");
  679.  
  680. --        Desktop API definitions
  681.  
  682. type DESKTOP   is record         -- dsk
  683.   cbSize           :ULONG    ;
  684.   hbm              :HBITMAP  ;
  685.   x                :LONG     ;
  686.   y                :LONG     ;
  687.   fl               :ULONG    ;
  688.   lTileCount       :LONG     ;
  689.   szFile           :STRING(1..260);
  690. end record; -- DESKTOP;
  691. type PDESKTOP  is access all DESKTOP;  -- pdsk
  692.  
  693. function WinSetDesktopBkgnd(hwndDesktop:HWND     ;
  694.                             pdskNew    :PDESKTOP )return HBITMAP;
  695. pragma Import(c,WinSetDesktopBkgnd, Link_name=>"_WinSetDesktopBkgnd");
  696.  
  697. function WinQueryDesktopBkgnd(hwndDesktop:HWND     ;
  698.                               pdsk       :PDESKTOP )return BOOL32;
  699. pragma Import(c,WinQueryDesktopBkgnd, Link_name=>"_WinQueryDesktopBkgnd");
  700.  
  701.  SDT_DESTROY         :constant Long:= 16#0001#;
  702.  SDT_NOBKGND         :constant Long:= 16#0002#;
  703.  SDT_TILE            :constant Long:= 16#0004#;
  704.  SDT_SCALE           :constant Long:= 16#0008#;
  705.  SDT_PATTERN         :constant Long:= 16#0010#;
  706.  SDT_CENTER          :constant Long:= 16#0020#;
  707.  SDT_RETAIN          :constant Long:= 16#0040#;
  708.  SDT_LOADFILE        :constant Long:= 16#0080#;
  709.  
  710. --        Palette Manager API definition
  711.  
  712. function WinRealizePalette(hwn  :HWND   ;
  713.                            hp   :HPS    ;
  714.                            pcclr:PULONG )return LONG;
  715. pragma Import(c,WinRealizePalette, Link_name=>"_WinRelizePalette");
  716.  
  717. STR_DLLNAME :constant string:="keyremap" ;
  718.  
  719.  WM_DBCSFIRST               :constant Long:= 16#00b0#;
  720.  WM_DBCSLAST                :constant Long:= 16#00cf#;
  721.  
  722. end os2.PMcp;
  723.