How do you find the Classnames for other programs ?
szClassname byte "IEFrame", 0
szFilename byte "iexplore.exe", 0
.data?
we WINDOWENTRY32 <>
szCurrentFilename byte 255 dup (?)
szCurrentClassname byte 255 dup (?)
.code
Start:
xor ebx, ebx
mov we.lpszClassname, offset szClassname
mov we.lpszFilename, offset szFilename
invoke EnumWindows, addr EnumFunc, addr we
invoke ExitProcess, ebx
Quote from: Magnum on December 05, 2012, 11:31:31 AM
How do you find the Classnames for other programs ?
That's not possible (I assume you mean the classname of a window).
You can search for a top level window with FindWindow() (http://msdn.microsoft.com/en-us/library/windows/desktop/ms633499(v=vs.85).aspx) either by Titel, by Calssname or both. From the found window handle you can get the Process ID by using GetWindowThreadProcessId (http://msdn.microsoft.com/en-us/library/windows/desktop/ms633522(v=vs.85).aspx)
i suppose EnumProcesses, then GetGUIThreadInfo and GetClassName in the callback
i seem to remember something in the old forum :P
you can google "get window handle from process ID" for clues
Quote from: dedndave on December 05, 2012, 11:53:38 AM
i suppose EnumProcesses, then GetGUIThreadInfo and GetClassName in the callback
i seem to remember something in the old forum :P
Interesting solution, but only sense full if you know that the application has only one window. But even in this case, you can commonly determine the class name by using tools like WinSpy++ and then use FindWindow() to get the window handle.(?)
qWord,
http://www.masmforum.com/board/index.php?topic=11603.0
Classname must be constant for every program based on the code above.
Andy
Quote from: Magnum on December 05, 2012, 12:12:55 PM
qWord,
http://www.masmforum.com/board/index.php?topic=11603.0
Classname must be constant for every program based on the code above.
Andy
no it must not. For example you can dynamically create the class name (or atom). Furthermore, there generally no direct link between a window class and a process. A process can have N windows of K classes -> which is the "correct" class in that case?
Magnum,
maybe misunderstand you: you already have the class name "IEFrame" and/or the image name and you want to enumerate all TLWs and test if their class name and/or the process name match?
In that case, use the window handle in the Enum-Callback with GetClassName() to get the class name. The executable path can be obtained (for example) with GetWindowThreadProcessId() +OpenProcess() and GetProcessImageFileName().
You may describe what you want to do exactly.
the EnumWindows function only enumerates top-level windows (not child windows/controls)
the callback gives you the main window handle for each program that has a window
from that, you can get the main window classname with GetClassName
so - unless you have some specific reason for using EnumProcesses (process IDs), use EnumWindows
The code doesn't use EnumProcess.
Andy
well, maybe it should - lol
you aren't being clear about what you are trying to accomplish
pretend, for a moment, that you are not Secret Sam, and tell us what you want to do
Quote from: Magnum on December 05, 2012, 11:31:31 AM
How do you find the Classnames for other programs ?
sorry, Andy - i shouldn't be so harsh
but - if you use EnumProcesses, the Process ID is passed to the callback routine
generally, i try to avoid the PID and stick with window handles - lol
but - some operations may require it
the simplest way to get the class names for all top-level windows is EnumWindows/GetClassName