|
-
Aug 8th, 2002, 12:46 PM
#1
Thread Starter
Hyperactive Member
How to get the HWND or the Window Caption of all open apps? (SOLVED)
I need to know on certain times what is open and some to close others to minimize...but as a start I need to get the HWNDs and/or the Windows caption ...this is for running it at remote stations...
Some are W9x others are Me, W2000 and XP...
any help on this I'll appreciate it...TIA
Last edited by D12Bit; Aug 8th, 2002 at 03:12 PM.
"Who Dares Wins" - "Quien se Arriesga Gana"
Mail me at: 
-
Aug 8th, 2002, 01:08 PM
#2
Hyperactive Member
Taken straight from the API-GUIDE(a very useful tool):
VB Code:
'Add this code to a form
Private Sub Form_Load()
'KPD-Team 2000
'URL: [url]http://www.allapi.net/[/url]
'Set the form's graphics mode to persistent
Me.AutoRedraw = True
'call the Enumwindows-function
EnumWindows AddressOf EnumWindowsProc, ByVal 0&
End Sub
'Add this code to a module
Declare Function EnumWindows Lib "user32" (ByVal lpEnumFunc As Long, ByVal lParam As Long) As Boolean
Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Declare Function GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (ByVal hwnd As Long) As Long
Public Function EnumWindowsProc(ByVal hwnd As Long, ByVal lParam As Long) As Boolean
Dim sSave As String, Ret As Long
Ret = GetWindowTextLength(hwnd)
sSave = Space(Ret)
GetWindowText hwnd, sSave, Ret + 1
Form1.Print Str$(hwnd) + " " + sSave
'continue enumeration
EnumWindowsProc = True
End Function
-
Aug 8th, 2002, 02:03 PM
#3
Thread Starter
Hyperactive Member
Thanks!...
Worked like a charm!
"Who Dares Wins" - "Quien se Arriesga Gana"
Mail me at: 
-
Aug 8th, 2002, 02:22 PM
#4
Hyperactive Member
No Problem. ALLAPI.net is where you get the API-GUIDE; it is great for simple API functions and learning purposes.
Joe
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
|