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 » API

Post new topic   Reply to topic
desktop windows
View previous topic :: View next topic  
Author Message
ice_531
Newbie


Joined: 02 Dec 2003
Posts: 6

PostPosted: Jan 26th, 2004 08:41 PM    Post subject: desktop windows Reply with quote

ineed a way to send an api call to ALL desktop windows....basically every window that is open....even the taskbar n systray if possible.

SetLayeredWindowAttributes
want to use the transparency api...on them all

and also is there a way to change their color aswell?? I havent found an answer on that yet :rolleyes:
_________________
blAh.
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address
P.T.A.M.
Administrator


Joined: 08 Oct 2003
Posts: 752
Location: Greece

PostPosted: Jan 27th, 2004 04:27 AM    Post subject: Reply with quote

This (http://www.avissoft.com/showthread.php?s=&threadid=208) will help you get the handles of all active proccesses (like in Ctrl-Alt-Del list)...
_________________
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
ice_531
Newbie


Joined: 02 Dec 2003
Posts: 6

PostPosted: Jan 27th, 2004 12:25 PM    Post subject: Reply with quote

Thx ptam.. but do you know if its possible to put the hwnd into an array and send an api call to them....ex
SetLayeredWindowAttributes (hWnd(0), 0 , 128)
and jus go threw them ....this is really the main thing i want to achieve but it is confussing me a bit
_________________
blAh.
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address
P.T.A.M.
Administrator


Joined: 08 Oct 2003
Posts: 752
Location: Greece

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

I think it'll be better in a collection... Look at this code :

Code:
'Add this code to a form
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


With a little modification I think that this'll work :

Code:
'Form
Option Explicit
Private Sub Command1_Click()
    Dim i As Integer

    For i = 1 To Col.Count
        MsgBox Col.Item(i)
    Next
End Sub
Private Sub Form_Load()
    Set Col = New Collection
    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 Col As Collection
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
    Col.Add Str$(hwnd) + " " + sSave
    EnumWindowsProc = True
End Function

_________________
No one is completely useless. They can at least be an example of what to avoid.


Last edited by P.T.A.M. on Jan 27th, 2004 04:47 PM; edited 1 time in total
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 » API 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