Frequently Asked Component Specific Questions
Options |
|
Display all FAQ items |
Displaying items 1 to 1 of 1, page 1 of 1
<< previous next >>

TAdvLockAppLock application with forms in DLLs
A DLL has its own application and screen instance. Therefore, TAdvLockApp cannot know what possible form is active when this form was instantiated from a DLL. The solution for this issue is to initialize the DLL Application & Screen instance to be the same as the main EXE Application and Screen instance. This could be done by exporting a function in the DLL that sets this and call it from the main EXE:
procedure InitDLLAppAndScreen(App: TApplication; scr: Tscreen);
var
MemHandle: HWND;
MemScreen: Tscreen;
begin
MemHandle := Application.Handle;
MemScreen := Screen;
try
Screen := Scr;
Application.Handle := App.Handle;
Application.OnIdle := App.OnIdle;
Application.OnMessage := App.OnMessage;
Application.Icon.Handle := App.Icon.Handle;
Application.UpdateFormatSettings := false;
SetForegroundWindow(Application.Handle);
finally
Application.Handle := MemHandle;
Screen := MemScreen;
end;
end;