|
-
Dec 13th, 2000, 04:18 PM
#1
Thread Starter
Junior Member
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
-
Dec 13th, 2000, 04:34 PM
#2
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.
Code:
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
-
Dec 13th, 2000, 05:00 PM
#3
Thread Starter
Junior Member
Okay did that
how would i make it so it looked and showed the window Asheron's Call
?
-
Dec 13th, 2000, 07:32 PM
#4
Just change the Notepad - Untitled to Asheron's Call
-
Dec 15th, 2000, 03:43 AM
#5
PowerPoster
FindWindow vs FindWindowEx
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.
Code:
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")
-
Dec 15th, 2000, 09:23 AM
#6
PowerPoster
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|