Click to See Complete Forum and Search --> : API help of Finding a window and showing it
AlexTheAPI
Dec 13th, 2000, 03:18 PM
I need help Finding a window i don't know the hWnd for and making it the window that i will sendkeys too. i have no question about sendkeys but cannot figure out how to find it or showing it at all. Thanks for the help
Aaron Young
Dec 13th, 2000, 03:34 PM
You can use the FindWindowEx API to find the window by Class or Caption and the ShowWindow() API to make a Window the current Window, i.e.Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
Private Const SW_NORMAL = 1
Private Sub Command1_Click()
Dim lHwnd As Long
lHwnd = FindWindowEx(0, 0, vbNullString, ByVal "Notepad - Untitled")
If lHwnd Then Call ShowWindow(lHwnd, SW_NORMAL)
End Sub
AlexTheAPI
Dec 13th, 2000, 04:00 PM
how would i make it so it looked and showed the window Asheron's Call
?
Aaron Young
Dec 13th, 2000, 06:32 PM
Just change the Notepad - Untitled to Asheron's Call
Chris
Dec 15th, 2000, 02:43 AM
Hi! Aaron, What the diff between FindWindowEx and FindWindow? Perhaps you can explain a bit over here?
I found that FindWindow is less parameter as compare to the FindWindowEx that you've applied.
Option Explicit
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As Any, ByVal lpWindowName As String) As Long
Dim hwnd As Long
hwnd = FindWindow(0&, "Notepad - Untitled")
amitabh
Dec 15th, 2000, 08:23 AM
Although I am not quite clear myself, FindWindowEx can search in child windows also(supposedly in the case of mdi parent and child windows) whereas FindWindow doesnot cover child windows.
Amitabh
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.