__Window.FindWindow

Suggestions and bug reports forum for Ams Plugin Maker
Post Reply
User avatar
DriPro
Registered User
Posts: 17
Joined: Mon Sep 03, 2018 8:12 pm

__Window.FindWindow

Post by DriPro »

__Window.FindWindow
Error This function returns 0
User avatar
Serkan
Developer
Developer
Posts: 206
Joined: Thu Jul 04, 2013 8:44 pm
Location: Windows.h
Contact:

Post 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 .
User avatar
DriPro
Registered User
Posts: 17
Joined: Mon Sep 03, 2018 8:12 pm

Post by DriPro »

OK friend thanks for your time.
Post Reply