1. getting data from clipboard...

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!

new topic     » topic index » view message » categorize

2. Re: getting data from clipboard...

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

new topic     » goto parent     » topic index » view message » categorize

3. Re: getting data from clipboard...

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!!^^;

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu