home *** CD-ROM | disk | FTP | other *** search
- ; The following contains samples of dynalinking to a few of the OS/2
- ; Win... calls from EPM. These are building blocks for you to use in
- ; your own code.
-
- ; By Larry Margolis
-
-
- err = dynalink('PMWIN',
- 'WINGETLASTERROR',
- gethwnd(0), 2)
-
- hheap=dynalink('PMWIN',
- 'WINQUERYWINDOWULONG',
- gethwnd(handle) ||
- atoi(4), 2) -- QWL_HHEAP
-
- largest=dynalink('PMWIN',
- 'WINAVAILMEM',
- atol(hheap) ||
- atoi(0) || -- Don't compact
- atoi(0) ) -- reserved
-
- TheTitle = substr('',1,255);
- result = dynalink( 'PMWIN',
- 'WINQUERYDLGITEMTEXT',
- mygethwnd(3) || /* Parent Window handle */
- atoi(267) || /* EntryBox Id */
- atoi(255) || /* Length of text */
- selector(TheTitle)||offset(TheTitle))
- TheTitle = substr(TheTitle,1,result);
-
- call dynalink( 'PMWIN', -- Set focus to the note window (this one)
- 'WINSETFOCUS',
- atoi(0) || /* HWND_DESKTOP is 1 */
- atoi(1) ||
- gethwnd(5) ) /* EPM client */
-
- call dynalink( 'PMWIN',
- 'WINSHOWWINDOW',
- gethwnd(6) ||
- atoi(1) ) -- Set Window State Visible
-
- rect = '????????????????' -- Left, Bottom, Right, Top
- call dynalink( 'PMWIN',
- 'WINQUERYWINDOWRECT',
- gethwnd(EPMINFO_EDITCLIENT) ||
- selector(rect) || /* string selector */
- offset(rect) ) /* string offset */
-
- return dynalink( 'PMWIN',
- 'WINMESSAGEBOX',
- atoi(0) || atoi(1) || -- Parent
- -- atoi(0) || atoi(1) || -- Owner
- gethwnd(EPMINFO_EDITFRAME) || /* edit frame handle */
- selector(text) || -- Text
- offset(text) ||
- selector(caption) || -- Title
- offset(caption) ||
- atoi(0) || -- Window
- atoi(msgtype) ) -- Style
-
- len= dynalink( 'PMWIN',
- 'WINQUERYWINDOWTEXT',
- atol_swap(hwnd) ||
- atoi(255) ||
- selector(str) || /* string selector */
- offset(str) ) /* string offset */
-
- call dynalink( 'PMWIN',
- 'WINSETWINDOWPOS',
- gethwnd(EPMINFO_EDITFRAME) ||
- atoi(0) || atoi(3) || /* HWND_TOP */
- atoi(x) ||
- atoi(y) ||
- atoi(cx) ||
- atoi(cy) ||
- atoi(opts)) /* SWP_MOVE | SWP_SIZE */
-
- call dynalink('PMWIN',
- 'WINQUERYWINDOWPOS',
- gethwnd(EPMINFO_EDITCLIENT) ||
- selector(swp1) ||
- offset(swp1) )
-
- call dynalink( 'PMWIN',
- 'WINPOSTMSG',
- gethwnd(5) || -- Tell client to destroy itself
- atoi(41) || -- WM_CLOSE
- atol(0) ||
- atol(0) )
-
- return dynalink( 'PMWIN',
- 'WINQUERYSYSVALUE',
- atoi(0) || atoi(1) ||
- atoi(20 + (upcase(cxcy)='Y')))
-
- call dynalink( 'PMWIN',
- 'WINSENDMSG',
- gethwnd(17) ||
- atoi(402) || -- MM_SETITEMATTR
- atoi(1) || -- search submenus
- atoi(menuid) ||
- atoi(mask) ||
- atoi(attr), 2)
-
- hab=gethwnd(0) /* get EPM's anchorblock */
- call dynalink('PMWIN', /* Open PM's clipboard */
- 'WINOPENCLIPBRD',
- hab)
- result = dynalink('PMWIN', /* call PM function to */
- 'WINQUERYCLIPBRDDATA', /* look at the data in the cb*/
- hab || /* anchor block */
- atoi(1), /* data format ( TEXT ) */
- 2) /* return a 4 byte result */
-
- call dynalink('PMWIN', -- Empty the clipboard completely
- 'WINEMPTYCLIPBRD', -- before filling it.
- hab)
- call dynalink('PMWIN', /* call PM function to */
- 'WINSETCLIPBRDDATA', /* move data into the PM e cb*/
- hab || /* anchor block */
- atol(result) || /* pointer to text. */
- atoi(1) || /* format (TEXT) */
- atoi(256)) /* selector */
-
- call dynalink('PMWIN',
- 'WINCLOSECLIPBRD',
- hab)
-
- defproc clipcheck(var format) -- Returns error code; if OK, sets FORMAT
- hab=gethwnd(0) -- get EPM's anchorblock
- format = \0\0 -- (reserve two bytes)
- rc=dynalink('PMWIN', -- call PM function to
- 'WINQUERYCLIPBRDFMTINFO', -- look at the data in the cb
- hab || -- anchor block
- atoi(1) || -- data format ( TEXT )
- selector(format) ||
- offset(format))
- format = itoa(format,10) -- Convert format to ASCII
- return rc
-
-
- hAtomTable = dynalink('PMWIN', -- call PM function to
- 'WINQUERYSYSTEMATOMTABLE', -- get handle of system atom table
- '', 2)
-
- atomname = 'some string'\0
- Atom = dynalink('PMWIN', -- call PM function to
- 'WINADDATOM', -- add an atom
- atol_swap(hAtomTable) ||
- selector(atomname) ||
- offset(atomname))
-
- atomname = 'some string'\0
- Atom = dynalink('PMWIN', -- call PM function to
- 'WINFINDATOM', -- find an atom
- atol_swap(hAtomTable) ||
- selector(atomname) ||
- offset(atomname))
-
- atomname = copies(\0, 255)
- len = dynalink('PMWIN', -- call PM function to
- 'WINQUERYATOMNAME', -- return an atom name
- atol_swap(hAtomTable) ||
- atoi(atom) ||
- selector(atomname) ||
- offset(atomname) ||
- atoi(255) )
- if len=0 then
- sayerror 'atom or table invalid'
- else
- sayerror '"'leftstr(atomname, len)'"'
- endif
-