summaryrefslogtreecommitdiff
path: root/src/corelib/gdi/fpg_gdi.pas
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/gdi/fpg_gdi.pas')
-rw-r--r--src/corelib/gdi/fpg_gdi.pas19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/corelib/gdi/fpg_gdi.pas b/src/corelib/gdi/fpg_gdi.pas
index 980339b4..18b04da0 100644
--- a/src/corelib/gdi/fpg_gdi.pas
+++ b/src/corelib/gdi/fpg_gdi.pas
@@ -265,7 +265,10 @@ type
end;
+ { Used mainly for sending drags - being the source of the drag }
TfpgGDIDrag = class(TfpgDragBase)
+ private
+ function StringToHandle(const AString: TfpgString): HGLOBAL;
protected
FSource: TfpgGDIWindow;
function GetSource: TfpgGDIWindow; virtual;
@@ -2747,6 +2750,22 @@ end;
{ TfpgGDIDrag }
+function TfpgGDIDrag.StringToHandle(const AString: TfpgString): HGLOBAL;
+var
+ dest: HGLOBAL;
+ l: integer;
+ p: PChar;
+begin
+ p := PChar(AString);
+ l := Length(AString)+1;
+ { allocate and lock a global memory buffer. Make it fixed
+ data so we don't have to use GlobalLock }
+ dest := GlobalAlloc(GMEM_FIXED, l);
+ { Copy the string into the buffer }
+ Move(p^, PChar(dest)^, l);
+ Result := dest;
+end;
+
function TfpgGDIDrag.GetSource: TfpgGDIWindow;
begin
Result := FSource;