1. getting data from clipboard...
- Posted by wooseob <wooseoblee at empal.com> Apr 16, 2005
- 407 views
Hi, all i want to know how to get text data from clipboard. from my prog. i found Jacques Deschenes's WINCLIP.EW and found 'GetClipboardData' routine in it, but don't know how to use it. GetClipboardData returns atom. this returned atom value is the memory address for the clipboard data???? if so, how to get that data as the text sequence in my prog? Anybody can give a short usage example for WINCLIP.EW Thanks in advance!
2. Re: getting data from clipboard...
- Posted by CChris <christian.cuvier at agriculture.gouv.fr> Apr 19, 2005
- 419 views
wooseob wrote: > > > Hi, all > i want to know how to get text data from clipboard. from my prog. > i found Jacques Deschenes's WINCLIP.EW and found 'GetClipboardData' routine > in it, but don't know how to use it. GetClipboardData returns atom. this > returned atom value is the memory address for the clipboard data???? if so, > how to get that data as the text sequence in my prog? > Anybody can give a short usage example for WINCLIP.EW > Thanks in advance! > The atom GetClipboardData() returns is a _handle_ (not an address) of a local buffer the data is in, or 0 on failure. To access this handle, you must do the following: - call GlobalLock on this returned handle. Then you get an address. - Copy or inspect data - call GlobalUnlock on the handle. This buffer is owned by Windows. Copy the data in some sequence for later use. Never try to free this buffer, and be sure to unlock it when done. The data is plain text, where line end in \r\n. Data ends in a trailing zero. To get this data without hassles, you may need some routine like win32lib's w32peek_string(address). HTH CChris
3. Re: getting data from clipboard...
- Posted by wooseob <wooseoblee at empal.com> Apr 20, 2005
- 407 views
CChris wrote: > > wooseob wrote: > > > > > > Hi, all > > i want to know how to get text data from clipboard. from my prog. > > i found Jacques Deschenes's WINCLIP.EW and found 'GetClipboardData' routine > > in it, but don't know how to use it. GetClipboardData returns atom. this > > returned atom value is the memory address for the clipboard data???? if so, > > how to get that data as the text sequence in my prog? > > Anybody can give a short usage example for WINCLIP.EW > > Thanks in advance! > > > > The atom GetClipboardData() returns is a _handle_ (not an address) of a local > buffer > > the data is in, or 0 on failure. > To access this handle, you must do the following: > > - call GlobalLock on this returned handle. Then you get an address. > - Copy or inspect data > - call GlobalUnlock on the handle. > > This buffer is owned by Windows. Copy the data in some sequence for later use. > Never try to free this buffer, and be sure to unlock it when done. > > The data is plain text, where line end in \r\n. Data ends in a trailing zero. > To get this data without hassles, you may need some routine like win32lib's > w32peek_string(address). > > HTH > CChris > Thanks CChris, I've finally succeeded in getting clipboard data!!^^;