|
-
Sep 26th, 2001, 07:51 AM
#1
Thread Starter
Fanatic Member
FindWindow API. Anyone know how to use it ?
Hi,
There is an API called 'FindWindow'. I want to know how to use it.
It returns the HWND of the window, but I don't know what parameters to pass for Class Name and Window Name
Help!
THE TIME/WEATHER IS 
Don't know how to use APIs or have problem with them,
Download API-Guide & API-Viewer from http://www.allapi.net
-
Sep 26th, 2001, 08:06 AM
#2
Hyperactive Member
Credits to Hack
Borrowed From Hack...
[vbcpde]
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Private Const WM_CLOSE = &H10
Private Const WM_QUIT = &H12
Dim CloseIt As Long
CloseIt = FindWindow(vbNullString, "Caption Of Window To Be Closed")
PostMessage CloseIt, WM_CLOSE, CLng(0), CLng(0)
[/Highlight]
-
Sep 26th, 2001, 08:27 AM
#3
Frenzied Member
The first parameter of the FindWindow API doesn't have to be vbNullString. It can be the class name of the window you are searching.
-
Sep 26th, 2001, 08:49 AM
#4
Thread Starter
Fanatic Member
Whats the class name. In VC++ is it the name of the class I give for 'CFrameWnd' when I use MFC
THE TIME/WEATHER IS 
Don't know how to use APIs or have problem with them,
Download API-Guide & API-Viewer from http://www.allapi.net
-
Sep 26th, 2001, 09:50 AM
#5
Frenzied Member
No, those are only MFC classes.
For example, different windows have different types class names.
BUTTON - button window
#32770 - Dialog windows
LISTBOX - list box
You can give windows your own class names when you create them using CreateWindow API. VB windows have class names like ThunderRT6TextBox etc.
-
Sep 26th, 2001, 09:52 AM
#6
Frenzied Member
You can also use Spy++ (comes with MSVC++) to find the class names for different windows.
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
|