Inside DLL function I need handle to app active window. The same GetActiveWindow()
called from DLL function doesn't always return correct handle. Sometimes yes, sometimes no - handle = 0. I can not find the rules. How can I get it in the right way ?
Edit added code sample
Application:
...
function DllFunction: Boolean; stdcall; external 'MyDLL.dll';
...
procedure Form1.Button1Click(Sender: TObject);
begin
DllFunction();
end;
...
Library MyDLL:
...
function DllFunction: Boolean; stdcall;
var
hActiveWindow: HWND;
...
begin
...
// I need the window handle of app Form1
hActiveWindow := GetActiveWindow;
...
end;
exports
DllFunction;
begin
end.