Newsgroups : Borland : borland.public.delphi.nativeapi.win32 : 2005 Apr : RegisterDragDrop failure with unknown result.
| Subject: | RegisterDragDrop failure with unknown result. |
| Posted by: | "Jon Jacobs" (jonjacobsatcomcast.net) |
| Date: | Thu, 21 Apr 2005 22:59:33 |
In my call to RegisterDragDrop I get 800700E, which does not match any of the constants expected from that function. What
does that result mean, and why does my attempt to register the treeview fail?
Thanks,
Jon
unit oledrop1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ComCtrls, ActiveX;
type
TForm1 = class(TForm)
TreeView1: TTreeView;
StatusBar1: TStatusBar;
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
TDnD = class(TInterfacedObject, IDropTarget)
private
FControl: TWinControl;
public
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;
var
Form1: TForm1;
DnD: TDnD;
implementation
{$R *.dfm}
{ TDnD }
function TDnD.DragEnter(const dataObj: IDataObject; grfKeyState: Integer;
pt: TPoint; var dwEffect: Integer): HResult;
begin
TForm1(FControl.Owner).StatusBar1.SimpleText := 'Drag Enter';
end;
function TDnD.DragLeave: HResult;
begin
end;
function TDnD.DragOver(grfKeyState: Integer; pt: TPoint;
var dwEffect: Integer): HResult;
begin
end;
function TDnD.Drop(const dataObj: IDataObject; grfKeyState: Integer;
pt: TPoint; var dwEffect: Integer): HResult;
begin
end;
procedure TForm1.FormCreate(Sender: TObject);
var
H: DWord;
S: string;
begin
DnD := TDnD.Create;
DnD.FControl := TreeView1;
H := RegisterDragDrop(TreeView1.Handle, DnD);
if H = S_OK then
S := 'S_OK' else
if H = DRAGDROP_E_INVALIDHWND then
S := 'DRAGDROP_E_INVALIDHWND' else
if H = DRAGDROP_E_ALREADYREGISTERED then
S := 'DRAGDROP_E_ALREADYREGISTERED' else
if H = E_OUTOFMEMORY then
S := 'E_OUTOFMEMORY'
else
S := IntToHex(H, 8);
StatusBar1.SimpleText := S;
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
DnD.Free;
end;
end.