Results 1 to 3 of 3

Thread: POOOOLLLEEEAASSSSEEEEEE???

  1. #1

    Thread Starter
    Addicted Member Mih_Flyer's Avatar
    Join Date
    Mar 2000
    Location
    some place there
    Posts
    241

    Red face

    ok I'm sure i'v seen this 100000 times, but i don't know where to find it, he question is : How do i know the application which are running in windows, got it, only the apps that running at the current time,,please help

  2. #2
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    ...could give this a shot..I haven't

    See full sample and code at (and a follow-up):

    http://support.microsoft.com/support.../Q187/9/13.ASP
    http://support.microsoft.com/support.../Q192/9/86.ASP

    There is also a full sample and code of a viewer at:

    http://www.codearchive.com/vbasic/WinHack2.zip

    If you want just a list of the applications (like WinNT -> Task Manager -> Applications), add three CommandButton and one ListBox to your form, then use this code:

    ---
    Private Declare Function ShowWindow Lib "User32" (ByVal hWnd As Long, ByVal flgs As Long) As Long
    Private Declare Function GetWindow Lib "User32" (ByVal hWnd As Long, ByVal wCmd As Long) As Long
    Private Declare Function GetWindowWord Lib "User32" (ByVal hWnd As Long, ByVal wIndx As Long) As Long
    Private Declare Function GetWindowLong Lib "User32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal wIndx As Long) As Long
    Private Declare Function GetWindowText Lib "User32" Alias "GetWindowTextA" (ByVal hWnd As Long, ByVal lpSting As String, ByVal nMaxCount As Long) As Long
    Private Declare Function GetWindowTextLength Lib "User32" Alias "GetWindowTextLengthA" (ByVal hWnd As Long) As Long
    Private Declare Function SetWindowPos Lib "User32" (ByVal hWnd As Long, ByVal insaft As Long, ByVal x%, ByVal y%, ByVal cx%, ByVal cy%, ByVal flgs As Long) As Long

    Const WS_MINIMIZE = &H20000000
    Const HWND_TOP = 0
    Const SWP_NOSIZE = &H1
    Const SWP_NOMOVE = &H2
    Const SWP_SHOWWINDOW = &H40
    Const GW_HWNDFIRST = 0
    Const GW_HWNDNEXT = 2
    Const GWL_STYLE = (-16)
    Const SW_RESTORE = 9
    Const WS_VISIBLE = &H10000000
    Const WS_BORDER = &H800000
    Const WS_CLIPSIBLINGS = &H4000000
    Const WS_THICKFRAME = &H40000
    Const WS_GROUP = &H20000
    Const WS_TABSTOP = &H10000

    Dim IsTask As Long

    Sub Command3_Click()
    Unload Me
    End Sub

    Sub Command1_Click()
    FindAllApps
    End Sub

    Sub Command2_Click()
    Dim hWnd As Long
    Dim x As Long
    Dim lngWW As Long

    If List1.ListIndex < 0 Then Beep: Exit Sub
    hWnd = List1.ItemData(List1.ListIndex)
    lngWW = GetWindowLong(hWnd, GWL_STYLE)
    If lngWW And WS_MINIMIZE Then
    x = ShowWindow(hWnd, SW_RESTORE)
    End If
    x = SetWindowPos(hWnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE Or SWP_SHOWWINDOW)
    End Sub

    Sub FindAllApps()
    Dim hwCurr As Long
    Dim intLen As Long
    Dim strTitle As String

    List1.Clear
    hwCurr = GetWindow(Me.hWnd, GW_HWNDFIRST)
    Do While hwCurr
    If hwCurr <> Me.hWnd And TaskWindow(hwCurr) Then
    intLen = GetWindowTextLength(hwCurr) + 1
    strTitle = Space$(intLen)
    intLen = GetWindowText(hwCurr, strTitle, intLen)
    If intLen > 0 Then
    List1.AddItem strTitle
    List1.ItemData(List1.NewIndex) = hwCurr
    End If
    End If
    hwCurr = GetWindow(hwCurr, GW_HWNDNEXT)
    Loop
    End Sub

    Sub Form_Load()
    Command1.Caption = "Refresh"
    Command2.Caption = "Switch"
    Command3.Caption = "Exit"
    IsTask = WS_VISIBLE Or WS_BORDER
    FindAllApps
    End Sub

    Sub Form_Paint()
    FindAllApps
    End Sub

    Sub List1_DblClick()
    Command2.Value = True
    End Sub

    Function TaskWindow(hwCurr As Long) As Long
    Dim lngStyle As Long

    lngStyle = GetWindowLong(hwCurr, GWL_STYLE)
    If (lngStyle And IsTask) = IsTask Then TaskWindow = True
    End Function
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  3. #3

    Thread Starter
    Addicted Member Mih_Flyer's Avatar
    Join Date
    Mar 2000
    Location
    some place there
    Posts
    241

    Talking you are the man

    Thanx Alot mate, you helped me so much, and that was very very very fast,, Thanx again

    Bat Version:
    Thanx bat Alot bat mate, bat you bat helped bat me bat so bat much, bat and bat that bat was bat very bat very bat very bat fast,, bat Thanx.


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