function TForm1.DragEnter(
const dataObj: IDataObject; grfKeyState: Integer;
pt: TPoint;
var dwEffect: Integer): HResult;
var
Form : tagFORMATETC;
begin
dwEffect := DROPEFFECT_COPY;
//Hier iss was
with Form
do
begin
cfFormat := CF_TEXT;
ptd :=
nil;
dwAspect := DVASPECT_CONTENT;
lindex := -1;
tymed := TYMED_HGLOBAL;
end;
Result := dataObj.QueryGetData(Form);
end;
function TForm1.DragLeave: HResult;
begin
Result := S_OK;
end;
function TForm1.DragOver(grfKeyState: Integer; pt: TPoint;
var dwEffect: Integer): HResult;
begin
dwEffect := DROPEFFECT_COPY;
//Guckst du hier
Result := S_OK;
end;
function TForm1.Drop(
const dataObj: IDataObject; grfKeyState: Integer;
pt: TPoint;
var dwEffect: Integer): HResult;
var
aFmtEtc: TFORMATETC;
aStgMed: TSTGMEDIUM;
pData: PChar;
begin
{Make certain the data rendering is available}
if (dataObj =
nil)
then
raise Exception.Create('
IDataObject-Pointer is not valid!');
with aFmtEtc
do
begin
cfFormat := CF_TEXT;
ptd :=
nil;
dwAspect := DVASPECT_CONTENT;
lindex := -1;
tymed := TYMED_HGLOBAL;
end;
{Get the data}
OleCheck(dataObj.GetData(aFmtEtc, aStgMed));
try
{Lock the global memory handle to get a pointer to the data}
pData := GlobalLock(aStgMed.hGlobal);
ScanTextForUrls(
String(pData));
finally
{Finished with the pointer}
GlobalUnlock(aStgMed.hGlobal);
{Free the memory}
ReleaseStgMedium(aStgMed);
end;
Result := S_OK;
end;