Re: [REQUEST] Application Hider ?
Posted: Thu Sep 29, 2011 8:41 pm
There is no need to see XroX's code as this is fairly simple to do.
You can use this to list and hide/show windows:
You can use this to list and hide/show windows:
Code: Select all
Where listWindows is a listbox control. <DllImport("user32.dll")> Shared Function GetWindowText(ByVal hWnd As IntPtr, ByVal lpString As StringBuilder, ByVal nMaxCount As Integer) As Integer
End Function
Dim windowHandles As List(Of IntPtr) = New List(Of IntPtr)
Function del_EnumWindowsProc(ByVal hwnd As IntPtr, ByVal lParam As UInteger) As Boolean
Dim sb As StringBuilder = New StringBuilder(255) ' MAXTITLE = 255
GetWindowText(hwnd, sb, sb.MaxCapacity)
Dim winTitle As String = sb.ToString()
If winTitle.Length > 0 Then
listWindows.Items.Add(winTitle)
windowHandles.Add(hwnd)
End If
Return True
End Function
Delegate Function EnumWindowsProc(ByVal hWnd As IntPtr, ByVal lParam As UInteger) As Boolean
<DllImport("user32.dll")> Shared Function EnumDesktopWindows(ByVal hDesktop As IntPtr, ByVal lpEnumCallbackFunction As [Delegate], ByVal lParam As UInteger) As Boolean
End Function
Private Sub btnList_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnList.Click
windowHandles.Clear()
EnumDesktopWindows(IntPtr.Zero, New EnumWindowsProc(AddressOf del_EnumWindowsProc), 0)
End Sub
<DllImport("user32.dll")> Shared Function ShowWindow(ByVal hWnd As IntPtr, ByVal nCmdShow As Integer) As Boolean
End Function
Const SW_HIDE As Integer = 0
Private Sub btnHide_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnHide.Click
If listWindows.SelectedIndex > -1 Then
ShowWindow(windowHandles(listWindows.SelectedIndex), SW_HIDE)
End If
End Sub
Const SW_NORMAL As Integer = 1
Private Sub btnShow_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnShow.Click
If listWindows.SelectedIndex > -1 Then
ShowWindow(windowHandles(listWindows.SelectedIndex), SW_NORMAL)
End If
End Sub