Questions tagged [findwindow]

FindWindow is a Win32 API function from user32.dll retrieving a handle to the top-level window whose class name and window name match the specified strings.

FindWindow function

Please note that it works in current process only! For global search use EnumWindows and EnumWindowsProc functions.

This function does not search child windows. This function does not perform a case-sensitive search.
To search child windows, beginning with a specified child window, use the FindWindowEx function.

150 questions
1
vote
0 answers

Cannot get a handle to an Edit with FindWindowEx

What I'm trying to do is get a handle to a TextBox in another windows form. I'm looking at it through Inspect.exe which is telling me the name is "Login:" and the classname is "Edit" (can't take a screenshot, sorry). I can get a handle to everything…
Smurfy
  • 23
  • 4
1
vote
0 answers

How to use c++ findwindows and sendMessage to c# winform 's button

My c# test target winform only have one button , when click it , will display a messageBox . it look like this : with code : private void button1_Click(object sender, EventArgs e) { MessageBox.Show("msg"); } Now I want to…
yangl
  • 337
  • 1
  • 3
  • 18
1
vote
2 answers

FindWindowEx Windows API returns nothing in AutoIt

I'm using the following code to return handle for a open file dialog box shown from Notepad. Global $Result = DllCall("User32.dll", "HWND", "FindWindowExA", "HWND", WinGetHandle("[CLASS:Notepad]"), "HWND", Null, "STR", "#32770", "STR",…
GTAVLover
  • 1,407
  • 3
  • 22
  • 41
1
vote
2 answers

C++ -- FindWindow win32 API always fails!

I am having problem with FindWindow() function in C++. I am using two programs -- Program A and program B. Both are console-applicaitons in native code. Program A initialises int i and string s with values. Program B reads them from Program A's…
KaiserJohaan
  • 9,028
  • 20
  • 112
  • 199
1
vote
1 answer

getting a delphi app to close a dialog that popped up from a driver

I have a delphi app that tries to open a webcam. Under Windows 7 it fails occasionally (that's another story/question/thread) but the webcam driver also pops up a dialog titled "Video Source" inviting me to select one. If I try to open the driver…
rossmcm
  • 5,493
  • 10
  • 55
  • 118
1
vote
1 answer

How to find PID of window containing X

I can use FindWindow, but the name of the window changes every time I open it. So my question is, how can I either: A) Find the PID of a window that contains 'x' B) Find the PID a window with the name of the exe file? Sorry if the question is…
Tanner H.
  • 304
  • 1
  • 13
1
vote
0 answers

How can I determine the source process/hWnd for a Drag and Drop operation from drop target

My C# Windows application accepts drag operations, and I'd like to be able to identify the hWnd and/or Process ID of the source. Is this possible, and how would I go about determining it? I've tried getting the active window when the drag-over…
ThunderFrame
  • 9,352
  • 2
  • 29
  • 60
1
vote
3 answers

Findwindow and SendMessage

I am trying to figure out why this is not sending a ALT+F to notepad, Private Declare Function FindWindow1 Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Private Const WM_KEYUP = &H101 Private…
StealthRT
  • 10,108
  • 40
  • 183
  • 342
1
vote
2 answers

Use wildcards with FindWindow api call with mfc

I am using FindWindow in an mfc application. HWND hWnd = ::FindWindow(NULL, _T("foobar v5")); I would like to use FindWindow with wildcards so that I can match just foobar. Thanks
dangerousdave
  • 6,331
  • 8
  • 45
  • 62
1
vote
1 answer

If I use CreateEx( ... ) after the main window was created I cannot FindWindow( ... )

I have the following code to create a 'message only' window, the window is always created fine, the problem happens when it is created. Process A ... auto hInstance = ::GetModuleHandle( nullptr ); WNDCLASSEX wcx; wcx.cbSize = sizeof(wcx); wcx.style…
Simon Goodman
  • 1,174
  • 1
  • 8
  • 35
1
vote
5 answers

FindWindow doesn't return IntPtr.Zero, although the window is already closed

I'm trying to control a Java application from my C# program. Before the program begins to input data, it checks if there are any pervious data input windows, and tries to close them. The code for checking if a window exists is: public static bool…
Miklós
  • 223
  • 1
  • 2
  • 9
1
vote
0 answers

Click on button in another program

I want to create a program to control another program like a robot. I have found a solution for C# with user32.dll, but I need one for Java. Are there any methods similar to FindWindow and SendMessage in Java?
Hamed Mahmoudkhani
  • 583
  • 1
  • 6
  • 17
1
vote
1 answer

NSIS close running instance of net program to install

I have done this before with MFC programs without a problem because I could set the class name. This is a no go with net except through a hack. I cannot use the window title either because it is decorated. So FindWindow seems to be out of the…
user1908746
1
vote
1 answer

Only raise event if window handle can be found

I'm having trouble figuring out the correct way to raise an event only if the desired window handle can be found (ie. "DesiredWindow" is currently running on the machine). Currently, my application will SetForegroundWindow and send a keypress to the…
Patrick
  • 430
  • 6
  • 21
1
vote
1 answer

FindWindow in FM

I am trying to use findwindow api call in FM, I can use it find in a VCL application, but not FM. Here is my code function WindowExists(titlename: string): boolean; var hwd: THandle; begin hwd := 0; hwd :=…
Lewis Harris
  • 15
  • 1
  • 7