| View previous topic :: View next topic |
| Author |
Message |
vb_programmer Freshman
Joined: 03 Jan 2004 Posts: 31
|
Posted: Jan 9th, 2004 02:33 PM Post subject: Help with EnumWindows ... |
|
|
Hello to All Forum Members ;
While working with EnumWindows , I found that it returns the handles of all Processes running on System including System Processes. Certainly I'm not interested in that. Instead , what I want to do is ... append the Window Titles of only Open Application Windows to say a ListBox.
Here is one of the code samples which I'm following in order to learn EnumWindowsAPI ...
| Code: | Private Sub Form_Load()
'KPD-Team 2000
'URL: [url]http://www.allapi.net/[/url]
'E-Mail: [email]KPDTeam@Allapi.net[/email]
'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 |
Is there any way to filter out those System Processes from the list and get handles of only Open Application Windows ?
Waiting for your reply ... _________________ ----- vb_programmer ------
iNova Creations : Software Development Company !
(www.inovacreations.com)
RutuOnline.com : A Programmer's Resource Center !
(www.rutuonline.filetap.com) |
|
| Back to top |
|
P.T.A.M. Administrator

Joined: 08 Oct 2003 Posts: 752 Location: Greece
|
|
| Back to top |
|
vb_programmer Freshman
Joined: 03 Jan 2004 Posts: 31
|
Posted: Jan 10th, 2004 11:00 PM Post subject: |
|
|
Oh Yes ... thanks a lot ! That link helped me to get the hint about all those APIs ...
I have fused those API with IsWindowVisible and IsWindowEnabled ... and got what I wanted ...
Thanks a lot for your valuable reply ... _________________ ----- vb_programmer ------
iNova Creations : Software Development Company !
(www.inovacreations.com)
RutuOnline.com : A Programmer's Resource Center !
(www.rutuonline.filetap.com) |
|
| Back to top |
|
P.T.A.M. Administrator

Joined: 08 Oct 2003 Posts: 752 Location: Greece
|
Posted: Jan 11th, 2004 04:04 PM Post subject: |
|
|
You're welcome  _________________ No one is completely useless. They can at least be an example of what to avoid. |
|
| Back to top |
|
|