Page 1 of 1

__Window.FindWindow

Posted: Sun Sep 06, 2020 7:20 pm
by DriPro
__Window.FindWindow
Error This function returns 0

Re: __Window.FindWindow

Posted: Fri Sep 18, 2020 7:49 pm
by Serkan
Hi
There is no way to check or update those modules , By looking at the source code i could not see any problems.
For the functions with string arguments , you should use nil where NULL expected because "" is a valid string anyway.
By the MS documentation one of arguments must contain a valid string and the other one must be NULL.

Code: Select all

local hwnd = __Window.FindWindow("progman",nil);
Dialog.Message("Notice", "Handle Of Desktop Window : "..tostring(hwnd), MB_OK);

For the FindWindow and any other function ,you can use __DLL class as well

Code: Select all

g_User32 = __DLL.LoadLibrary("User32.dll","stdcall");
if(g_User32) then
	f_FindWindow = __DLL.GetFunction(g_User32,_long,"FindWindowA",_string,_string);
	if(f_FindWindow) then
		local hwnd = f_FindWindow(nil,"My Project");
		Dialog.Message("Notice", "Handle Of App Window : "..tostring(hwnd), MB_OK);
	end
end
Please next time post a sample project to illustrate the issue , i really do not have time to re-produce the bugs you have posted by creating projects to check .

Re: __Window.FindWindow

Posted: Fri Sep 18, 2020 9:03 pm
by DriPro
OK friend thanks for your time.