Board index » delphi » Clipboard to Pchar to Clipboard

Clipboard to Pchar to Clipboard

I have a need to take the data on the clipboard, format it, then send it back
to the clipboard so it can be pasted. In other words I need to get the
clipboard data as a pchar to manipulate it. I can use GetTextBuf, but I don't
know how to get the size of what's on the clipboard.

Any help is appreciated.

James Carr
http://users.aol.com/carrprog

 

Re:Clipboard to Pchar to Clipboard


Quote
>know how to get the size of what's on the clipboard.

>Any help is appreciated.

 Do something like

   Clipboard.Open;
   wh := GetClipboardData(cf_Text);
   if (wh = 0) then exit;
   wp := GlobalLock(wh);

   // Now you just create the string e.g.,

   S := StrNew(wp);

  // Don't for get to unlock!!! Other programs will be MAD
   GlobalUnlock(wh);

  Clipboard.Close;

Hope this helps
   -John_Mer...@Brown.EDU

Quote

>James Carr
>http://users.aol.com/carrprog

Other Threads