> Hi,
> I must be making a very stupid mistake: I am unable to get IDropTarget
> to work. Always when calling RegisterDragDrop I get an (OLE) error
> stating that there is too little memory for this operation.
> The complete code I am using can be found below. There is no type
> library, just a plain new application with the below modifications.
> What am I doing wrong? I am just looking for the most simplistic
> example that lets me RegisterDragDrop something (later implementing
> IDropSource).
> TIA
> Stefan
> *******************
> uses
> ActiveX, ComObj, ComServ,
> .... <standard >;
> type
> TForm1 = class(TForm, IDropTarget)
> Button1: TButton;
> Button2: TButton;
> procedure Button2Click(Sender: TObject);
> procedure Button1Click(Sender: TObject);
> public
> function IDropTarget.DragOver = _DragOver; // kill compiler
> warning
> function DragEnter(const dataObj: IDataObject; grfKeyState:
> Longint;
> pt: TPoint; var dwEffect: Longint): HResult; stdcall;
> function _DragOver(grfKeyState: Longint; pt: TPoint;
> var dwEffect: Longint): HResult; stdcall;
> function DragLeave: HResult; stdcall;
> function Drop(const dataObj: IDataObject; grfKeyState: Longint;
> pt: TPoint;
> var dwEffect: Longint): HResult; stdcall;
> end;
> { implementation section - just stubbed to get everything to compile }
> procedure TForm1.Button1Click(Sender: TObject);
> begin
> OleCheck( RegisterDragDrop(Self.Handle, Self) );
> end;
> procedure TForm1.Button2Click(Sender: TObject);
> begin
> OleCheck( RevokeDragDrop(Self.Handle) );
> end;
> { Interface definition }
> function TForm1.DragEnter(const dataObj: IDataObject; grfKeyState:
> Longint;
> pt: TPoint; var dwEffect: Longint): HResult;
> begin
> Result := S_OK;
> end;
> { _DragOver aliased to IDropTarget.DragOver }
> function TForm1._DragOver(grfKeyState: Longint; pt: TPoint;
> var dwEffect: Longint): HResult;
> begin
> Result := S_OK;
> end;
> function TForm1.DragLeave: HResult;
> begin
> Result := S_OK;
> end;
> function TForm1.Drop(const dataObj: IDataObject; grfKeyState: Longint;
> pt: TPoint;
> var dwEffect: Longint): HResult;
> begin
> Result := S_OK;
> end;
> --
> mailto:Stefan.Hoffmeister (at) Uni-Passau.de
> http://kakadu.rz.uni-passau.de/~w4hoff01/
> PGP public key at homepage