kp ob das hilft aber das habe ich selbst mal benutzt
Delphi-Quellcode:
procedure CopyTextToClipboard(aWnd: HWND; aText: PChar);
var
Data: THandle;
DataPtr: Pointer;
Size: Integer;
oldWND: HWND;
begin
Size := Length(aText) + 1;
OpenClipboard(aWnd); //Open Clipboard
try
EmptyClipboard; // Clear Clipboard
oldWND := SetClipboardViewer(aWnd); // Clipboard für Programm registr.
Data := GlobalAlloc(GMEM_MOVEABLE or GMEM_DDESHARE, Size); // Get Memory
try
DataPtr := GlobalLock(Data);
try
Move(aText^, DataPtr^, Size);
SetClipboardData(CF_TEXT, Data); // Clpbrd-Format as Text & send Text
finally
GlobalUnlock(Data);
end;
except
GlobalFree(Data); // Free res. Memory
raise; // Get global Memory Err
end;
ChangeClipboardChain(aWnd, oldWND);
finally
CloseClipboard; //Close Clipboard
end;
end;
Aufruf mit
CopyTextToClipboard(0, PChar('text'));