This question refers to this one along with its accepted answer posted here on stackoverflow.
I don't feel comfortable at Windows API programming.
Exploring the way EasyGPS by Topografix handles clipboard manipulations, I discovered that it uses a custom clipboard format named GPX
wich is actually plain XML text (GPX to be precise). Using Clipboard.AsText is excluded.
I stumble at this stage:
program ProbeClipboard;
{$APPTYPE CONSOLE}
uses
SysUtils,
Windows,
ClipBrd;
var
CF_GPX: Cardinal;
ClipboardData: THandle;
begin
CF_GPX:=RegisterClipboardFormat('GPX');
if ClipBoard.HasFormat(CF_GPX) then
begin
Writeln('GPX format available in clipboard');
//
OpenClipboard(0);
ClipboardData := GetClipboardData(CF_GPX);
if ClipboardData = 0 then
raise Exception.Create('Clipboard data Error');
/// How to use GlobalLock and GlobalUnLock
/// so that I can paste the Clipboard data
/// to a TMemo instance for example
CloseClipboard;
end;
end.
Please, help me to fix that program.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…