The ClipStac API =================== You can use the API by registering the following messages via the Windows' RegisterMessage function. Please see the file CSAPI.H. Messages sent to ClipStac: -------------------------- SendMessage(0xffff,WM_CLIPSTACREGISTER,your_hWnd,0L); Send this message to initiate a ClipStac conversation. hWnd = 0xffff msg = WM_CLIPSTACREGISTER wParam = your_hWnd lParam = 0L Send this message to 0xffff to broadcast the message to every desktop window. If ClipStac is running, it will respond by Posting the same message back to you with wParam=0, LOWORD(lParam)=ClipStac's hWnd, and HIWORD(lParam)=your hWnd. Beware, however, that this will also send a WM_CLIPSTACREGISTER to your own program, so check the lParam to filter this out. BOOL SendMessage(hWndClipStac,WM_CLIPSTACPUSH,0,0L); Pushes the current Clipboard contents onto the top of the Stack (ClipStack[0]), and returns TRUE if successful, FALSE if not BOOL SendMessage(hWndClipStac,WM_CLIPSTACPOP,index,0L); Pops the contents of ClipStack[index] off the Stack and into the Clipboard. The index should be a valid ClipStack index. Returns TRUE if successful, FALSE if not. int SendMessage(hWndClipStac,WM_CLIPSTACFIND,0,LPSTR); Finds the first stack item that contains LPSTR in its identifying info. If found, returns the index of that item, otherwise -1. LPSTR SendMessage(hWndClipStac,WM_CLIPSTACGET,index,0L); Returns the identifying info of a stack item from ClipStack[index]. The return value is LPSTR or NULL. void SendMessage(hWndClipStac,WM_CLIPSTACDEREGISTER,0,0L); Send this message when your program is about to terminate (or whenever you have finished using ClipStac's services) so that ClipStac will remove your hWnd from its internal list. int SendMessage(hWndClipStac,WM_CLIPSTACNUMITEMS,0,0L); Send this message to find out how many items are in ClipStac's list. Messages received from ClipStac: -------------------------------- WM_CLIPSTACEXIT - ClipStac will send this message to your program if ClipStac is about to terminate, provided that you previously registered yourself with WM_CLIPSTACREGISTER. WM_CLIPSTACREGISTER - ClipStac will post this message to your program if your program first sends the same message with its hWnd as the wParam. ClipStac's reply will have wParam=0, LOWORD(lParam)=ClipStac's hWnd, and HIWORD(lParam)=your hWnd. ============================ THE CSTEST.CPP PROGRAM ------------------------ CSTEST.CPP is a program that tests the ClipStac API. To use it, first make sure something is in the Clipboard (text or bitmap). If you run CSTEST.EXE without first loading ClipStac, CSTEST will wait a few seconds and then warn you that "ClipStac was not found." It does this by attempting to register itself with ClipStac, and when that fails, exiting. If you run CSTEST after loading ClipStac, it will: -Register the ClipStac API messages defined in CSAPI.H. -Register itself with ClipStac. -Push the Clipboard contents onto the ClipStac stack. -Pop the item in ClipStac[0] into the Clipboard. -Retrieve the identifying info on ClipStac[0]. -Find the ClipStac item that corresponds to that info. -DeRegister itself with ClipStac and exit. =================