flat assembler
Message board for the users of flat assembler.
Index
> Windows > Getting a Window Handle from a Process |
Author |
|
VitalOne 02 Oct 2004, 05:00
Say I execute a file, using ShellExecute or WinExec or some function, how would I get the window handle of that executed file?
|
|||
02 Oct 2004, 05:00 |
|
Rookie 02 Oct 2004, 07:01
Assuming the app will put a window in the foreground, you can use
GetForegroundWindow. It has no params and returns the handle of the foreground window. |
|||
02 Oct 2004, 07:01 |
|
VitalOne 13 Oct 2004, 00:55
That could work, except on applications where it takes a certain amount of time for it to load.
|
|||
13 Oct 2004, 00:55 |
|
kongo bongo 22 Nov 2004, 23:59
Try this function from the user32.dll
Set the first parameter to NULL, and the second to the name in the mainwindows "titlebar" ( and lets hope there isn't 2 windows with equal name ). Well, there are several other ways to do this, and a good startingpoint to investigate it is the following link: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/windows.asp HWND FindWindow( LPCTSTR lpClassName, LPCTSTR lpWindowName ); Parameters lpClassName [in] Pointer to a null-terminated string that specifies the class name or a class atom created by a previous call to the RegisterClass or RegisterClassEx function. The atom must be in the low-order word of lpClassName; the high-order word must be zero. If lpClassName points to a string, it specifies the window class name. The class name can be any name registered with RegisterClass or RegisterClassEx, or any of the predefined control-class names. If lpClassName is NULL, it finds any window whose title matches the lpWindowName parameter. lpWindowName [in] Pointer to a null-terminated string that specifies the window name (the window's title). If this parameter is NULL, all window names match. Return Value If the function succeeds, the return value is a handle to the window that has the specified class name and window name. If the function fails, the return value is NULL. To get extended error information, call GetLastError. Remarks If the lpWindowName parameter is not NULL, FindWindow calls the GetWindowText function to retrieve the window name for comparison. For a description of a potential problem that can arise, see the Remarks for GetWindowText. To check if the Microsoft® IntelliType version 1.x software is running, call FindWindow as follows: FindWindow("MSITPro::EventQueue",NULL); |
|||
22 Nov 2004, 23:59 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.