Home > Back-end >  There a Dll FORM out of error
There a Dll FORM out of error

Time:10-24



I built a FORM in the DLL

In the Form with the Create event added

Application. The OnMessage:=WMDropMessage;


Procedure Tfm_TS. WMDropMessage (var Msg: TMsg; Var Handled: Boolean);
Var
.
The begin
.
end;

When the exit times wrong, how to solve????????????????

CodePudding user response:

What's wrong??

CodePudding user response:

Application of DLL is set to the caller Application

CodePudding user response:

You stick WMDropMessage,,

CodePudding user response:

Attention, leave footprints, take very every day

CodePudding user response:

This Dll is loaded dynamically,


The function openDllModal (DLLName: string; ProcName: string; Vhand: THandle) : THandle; Stdcall;
Type
TDllModalFun=function (hand: THandle) : THandle; Stdcall;
Var
DLLHandle: THandle;//handle to the DLL
PDll: Pointer;
VHd: THandle;
The begin
Try
DLLHandle:=LoadLibrary (PChar (' Modal \ '+ DLLName));
If DLLHandle & gt; 0 then
The begin
PDll:=GetProcAddress call (DLLHandle, PChar (ProcName));
If pDll & lt;> Nil then
The begin
Try
//Result:=TDllModalFun (pDll) (vhand);
VHd:=TDllModalFun (pDll) (vhand);
Result:=vHd;
Except,
On e: the Exception do
The begin
DisplayMessage (' error ', 'execution' + ProcName + 'error function! '+ # 13 + e.M essage);
The Exit;
end;
end;
End the else
The begin
DisplayMessage (' error 'and' load the DLL function error! ');
The Exit;
end;
End the else
The begin
DisplayMessage (' error 'and' access to handle to the DLL error! ');
The Exit;
end;
The finally

//FreeLibrary (DLLHandle);
end;
end;


//FreeLibrary (DLLHandle);

The screen is not an error







This is


Procedure Tfm_TS. WMDropMessage (var Msg: TMsg; Var Handled: Boolean);
Var
WMD: TWMDropFiles;
VWinControl: TWinControl;
The begin
Case Msg. The message of
WM_DROPFILES:
The begin
VWinControl:=FindControl (Msg. HWND);
//ShowMessage (vWinControl. Name + 'send message').
end;
end;

If the Msg. Message=WM_DROPFILES then
The begin
WMD. Msg:=Msg. The message;
WMD. Drop:=Msg. WParam;
WMD. Unused:=Msg. LParam;
WMD. Result:=0;
WMDropFiles (WMD);
Handled:=TRUE;
end;
end;


CodePudding user response:

refer to the second floor BDMH response:
Application of DLL is set to the caller's Application

My Application of Dll is the Application of the main program

CodePudding user response:

reference 1st floor HSFZXJY response:
what's wrong??


The address is wrong I quoted

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Pro_dwhs
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Access violation at address 032 db6d4. Read of address 032 db6d4.
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Sure
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --







CodePudding user response:

refer to 7th floor key_ok response:
reference 1st floor HSFZXJY reply: what's wrong??

The address is wrong I quoted

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Pro_dwhs
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Access violation at address 032 db6d4. Read of address 032 db6d4.
-- -- -- -- -- -- -- -- -- -- -- -- -- -...
well,,

CodePudding user response:



If the screen in the DLL Application. The OnMessage:=WMDropMessage;
Dll can't deal with drag
Because I write directly procedure WMDropFiles2 (var message: TMessage); The message WM_DROPFILES;
Don't trigger

Or in the main program screen FreeLibrary (DLLHandle);



Will not be an error screen Application. The OnMessage:=WMDropMessage; Is certainly not



If the screen FreeLibrary (DLLHandle); So can't release the



  • Related