Results 1 to 10 of 10

Thread: Window Manager Help

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jan 2006
    Posts
    246

    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 Attached Files
    Last edited by jizzmasterflex; Feb 25th, 2006 at 12:56 AM.

  2. #2
    Frenzied Member Andrew G's Avatar
    Join Date
    Nov 2005
    Location
    Sydney
    Posts
    1,587

    Re: Window Manager Help

    Zip file is corrupt

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jan 2006
    Posts
    246

    Re: Window Manager Help

    Sorry. Try this one.
    Attached Files Attached Files

  4. #4
    Frenzied Member Andrew G's Avatar
    Join Date
    Nov 2005
    Location
    Sydney
    Posts
    1,587

    Re: Window Manager Help

    Replace your enumwindowsproc function with this one.

    VB Code:
    1. Public Function EnumWindowsProc(ByVal hwnd As Long, ByVal Lparam As Long) As Boolean
    2. Dim Strcaption As String, NSize As Long, W As String, i As Integer
    3. Dim astrDataItem() As String
    4.  
    5. NSize& = GetWindowTextLength(hwnd&)
    6. Strcaption$ = Space$(NSize& + 1)
    7.  
    8.     If IsWindowVisible(hwnd&) = 1 Then
    9.     Call GetWindowText(hwnd&, Strcaption$, Len(Strcaption$))
    10.    
    11.     If Strcaption$ <> Chr$(0) Then
    12.         Form1.List1.AddItem Left$(Strcaption$, Len(Strcaption$) - 1)
    13.     End If
    14.  
    15. End If
    16.  
    17. EnumWindowsProc = True
    18.  
    19. End Function


    btw: I had to use Winrar to view the contents.

    [Edit] Didn't see that you uploaded it again

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Jan 2006
    Posts
    246

    Re: Window Manager Help

    Thanks man... Worked like a charm.

  6. #6
    Frenzied Member Andrew G's Avatar
    Join Date
    Nov 2005
    Location
    Sydney
    Posts
    1,587

    Re: Window Manager Help

    no probs
    Last edited by Andrew G; Feb 25th, 2006 at 10:16 PM.

  7. #7

    Thread Starter
    Addicted Member
    Join Date
    Jan 2006
    Posts
    246

    Re: Window Manager Help

    How would I go about putting all the windows in a variable with :: in between each window?

  8. #8

    Thread Starter
    Addicted Member
    Join Date
    Jan 2006
    Posts
    246

    Re: Window Manager Help

    VB Code:
    1. Public Function EnumWindowsProc(ByVal hwnd As Long, ByVal Lparam As Long) As Boolean
    2. Dim Strcaption As String, NSize As Long, W As String, i As String
    3. Dim astrDataItem() As String
    4.  
    5. NSize& = GetWindowTextLength(hwnd&)
    6. Strcaption$ = Space$(NSize& + 1)
    7.  
    8.     If IsWindowVisible(hwnd&) = 1 Then
    9.     Call GetWindowText(hwnd&, Strcaption$, Len(Strcaption$))
    10.    
    11.     If Strcaption$ <> Chr$(0) Then
    12.         W = W & "::" & Left$(Strcaption$, Len(Strcaption$) - 1)
    13.     End If
    14.  
    15. End If
    16.  
    17. EnumWindowsProc = True
    18.  
    19. frmMain.Winsock1.Senddata "wnn" & W
    20. End Function

    Does this look correct?

  9. #9

    Thread Starter
    Addicted Member
    Join Date
    Jan 2006
    Posts
    246

    Re: Window Manager Help

    *bump*

  10. #10
    Frenzied Member Andrew G's Avatar
    Join Date
    Nov 2005
    Location
    Sydney
    Posts
    1,587

    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:
    1. [B]Dim W As String[/B]
    2. Public Function EnumWindowsProc(ByVal hwnd As Long, ByVal Lparam As Long) As Boolean
    3. Dim Strcaption As String, NSize As Long, i As Integer
    4. Dim astrDataItem() As String
    5.  
    6. NSize& = GetWindowTextLength(hwnd&)
    7. Strcaption$ = Space$(NSize& + 1)
    8.  
    9.     If IsWindowVisible(hwnd&) = 1 Then
    10.     Call GetWindowText(hwnd&, Strcaption$, Len(Strcaption$))
    11.    
    12.     If Strcaption$ <> Chr$(0) Then
    13.         W = W & "::" & Left$(Strcaption$, Len(Strcaption$) - 1)
    14.     End If
    15.  
    16. End If
    17.  
    18. astrDataItem() = Split(W, "::")
    19. For i = 0 To UBound(astrDataItem)
    20. Form1.List1.AddItem astrDataItem(i)
    21. Next
    22.  
    23. EnumWindowsProc = True
    24.  
    25. 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
  •  



Click Here to Expand Forum to Full Width