[fpc-pascal] GetClipboardFormatName causing an Error 216
James Richters
james.richters at productionautomation.net
Fri Jan 1 00:11:47 CET 2021
I have my project working the way I want it to, but I have one little quirk I am hoping to fix.
When I look at the clipboard, the entry for MSDEVColumnSelect has zero length.
I’m not too familiar with PChars, but is there a way to set it to zero length?
I set it to #0 and it works ok with the #0 in there with Notepadd++ but I think it’s technically not correct.
Is there some way to call SetClipboardData(); to have it write just the format ID and zero length data?
Here’s a code snip of the relevant section:
EmptyClipBoard;
h:=GlobalAlloc(GMEM_MOVEABLE or GMEM_DDESHARE,l+1);
pp:=pchar(GlobalLock(h));
move(p^,pp^,l+1);
GlobalUnlock(h);
res:=(SetClipboardData(CF_OEMTEXT,h)=h);
h:=GlobalAlloc(GMEM_MOVEABLE or GMEM_DDESHARE,l+1);
pp:=pchar(GlobalLock(h));
OemToCharBuffA(p,pp,l+1);
SetClipboardData(CF_TEXT,h);
GlobalUnlock(h);
If Vertical then
Begin
q:=#0;
h:=GlobalAlloc(GMEM_MOVEABLE or GMEM_DDESHARE,l+1);
pp:=pchar(GlobalLock(h));
move(q^,pp^,l+1);
SetClipboardData(MSDEVColumnSelect,h);
GlobalUnlock(h);
q:=#2#0;
h:=GlobalAlloc(GMEM_MOVEABLE or GMEM_DDESHARE,l+1);
pp:=pchar(GlobalLock(h));
move(q^,pp^,l+1);
SetClipboardData(BorlandIDEBlockType,h);
GlobalUnlock(h);
End;
James
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20201231/7bf126e9/attachment-0001.htm>
More information about the fpc-pascal
mailing list