Feb 25th, 2006, 12:49 AM
#1
Thread Starter
Addicted Member
Window Manager Help
Hey, I'm trying to make a window manager for my computer but I'm having some problems with it. I got the windows to show in a listbox and I can close them now.. But the problem is that there is always a space in between the items. Can soemone please take a quick glance at my source and tell me what I am doing wrong?
Attached Files
Last edited by jizzmasterflex; Feb 25th, 2006 at 12:56 AM .
Feb 25th, 2006, 12:52 AM
#2
Re: Window Manager Help
Zip file is corrupt
Feb 25th, 2006, 12:56 AM
#3
Thread Starter
Addicted Member
Re: Window Manager Help
Attached Files
Feb 25th, 2006, 12:56 AM
#4
Re: Window Manager Help
Replace your enumwindowsproc function with this one.
VB Code:
Public Function EnumWindowsProc(ByVal hwnd As Long, ByVal Lparam As Long) As Boolean
Dim Strcaption As String, NSize As Long, W As String, i As Integer
Dim astrDataItem() As String
NSize& = GetWindowTextLength(hwnd&)
Strcaption$ = Space$(NSize& + 1)
If IsWindowVisible(hwnd&) = 1 Then
Call GetWindowText(hwnd&, Strcaption$, Len(Strcaption$))
If Strcaption$ <> Chr$(0) Then
Form1.List1.AddItem Left$(Strcaption$, Len(Strcaption$) - 1)
End If
End If
EnumWindowsProc = True
End Function
btw: I had to use Winrar to view the contents.
[Edit] Didn't see that you uploaded it again
Feb 25th, 2006, 01:04 AM
#5
Thread Starter
Addicted Member
Re: Window Manager Help
Thanks man... Worked like a charm.
Feb 25th, 2006, 01:07 AM
#6
Re: Window Manager Help
no probs
Last edited by Andrew G; Feb 25th, 2006 at 10:16 PM .
Feb 25th, 2006, 12:01 PM
#7
Thread Starter
Addicted Member
Re: Window Manager Help
How would I go about putting all the windows in a variable with :: in between each window?
Feb 25th, 2006, 12:18 PM
#8
Thread Starter
Addicted Member
Re: Window Manager Help
VB Code:
Public Function EnumWindowsProc(ByVal hwnd As Long, ByVal Lparam As Long) As Boolean
Dim Strcaption As String, NSize As Long, W As String, i As String
Dim astrDataItem() As String
NSize& = GetWindowTextLength(hwnd&)
Strcaption$ = Space$(NSize& + 1)
If IsWindowVisible(hwnd&) = 1 Then
Call GetWindowText(hwnd&, Strcaption$, Len(Strcaption$))
If Strcaption$ <> Chr$(0) Then
W = W & "::" & Left$(Strcaption$, Len(Strcaption$) - 1)
End If
End If
EnumWindowsProc = True
frmMain.Winsock1.Senddata "wnn" & W
End Function
Does this look correct?
Feb 25th, 2006, 02:02 PM
#9
Thread Starter
Addicted Member
Feb 25th, 2006, 10:15 PM
#10
Re: Window Manager Help
If you want all the windows to be seperated by :: then you will need to dim w in the declarations, cause if its decalered inside the sub, eachtime w will be "" so it will erase the previous value so therefore
VB Code:
[B]Dim W As String[/B]
Public Function EnumWindowsProc(ByVal hwnd As Long, ByVal Lparam As Long) As Boolean
Dim Strcaption As String, NSize As Long, i As Integer
Dim astrDataItem() As String
NSize& = GetWindowTextLength(hwnd&)
Strcaption$ = Space$(NSize& + 1)
If IsWindowVisible(hwnd&) = 1 Then
Call GetWindowText(hwnd&, Strcaption$, Len(Strcaption$))
If Strcaption$ <> Chr$(0) Then
W = W & "::" & Left$(Strcaption$, Len(Strcaption$) - 1)
End If
End If
astrDataItem() = Split(W, "::")
For i = 0 To UBound(astrDataItem)
Form1.List1.AddItem astrDataItem(i)
Next
EnumWindowsProc = True
End Function
Last edited by Andrew G; Feb 25th, 2006 at 10:28 PM .
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