Log inUsernamePassword
Log me on automatically each visit    
Register
Register
Log in to check your private messages
Log in to check your private messages
Visual Basic Forum for Visual Basic Programmers VB Forum Index » General

Post new topic   Reply to topic
Help with EnumWindows ...
View previous topic :: View next topic  
Author Message
vb_programmer
Freshman


Joined: 03 Jan 2004
Posts: 31

PostPosted: Jan 9th, 2004 02:33 PM    Post subject: Help with EnumWindows ... Reply with quote

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
View user's profile Send private message Visit poster's website Yahoo Messenger ICQ Number
P.T.A.M.
Administrator


Joined: 08 Oct 2003
Posts: 752
Location: Greece

PostPosted: Jan 10th, 2004 04:45 PM    Post subject: Reply with quote

Maybe this can help : http://www.avissoft.com/showthread.php?s=&threadid=208
_________________
No one is completely useless. They can at least be an example of what to avoid.
Back to top
View user's profile Send private message Send e-mail Visit poster's website ICQ Number
vb_programmer
Freshman


Joined: 03 Jan 2004
Posts: 31

PostPosted: Jan 10th, 2004 11:00 PM    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website Yahoo Messenger ICQ Number
P.T.A.M.
Administrator


Joined: 08 Oct 2003
Posts: 752
Location: Greece

PostPosted: Jan 11th, 2004 04:04 PM    Post subject: Reply with quote

You're welcome Smile
_________________
No one is completely useless. They can at least be an example of what to avoid.
Back to top
View user's profile Send private message Send e-mail Visit poster's website ICQ Number
Display posts from previous:   
Post new topic   Reply to topic    Visual Basic Forum for Visual Basic Programmers VB Forum Index » General All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Visual Basic Forum runs phpBB | Forum Template © iOptional
VB Resources | SSL | Visual Basic