1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
#NoTrayIcon
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_outfile=..\..\..\Desktop\WinHider.exe
#AutoIt3Wrapper_Compression=0
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <GUIListView.au3>
#include <StaticConstants.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>
#include <WinAPI.au3>
#include <Misc.au3>
#include <Array.au3>
#include <Process.au3>
Opt("WinTitleMatchMode", 4)
#Region ### START Koda GUI section - Main Form ### Form=C:\Program Files\KodaGUI\Forms\WinMan.kxf
$Form1 = GUICreate("WinMan - v.1.1", 425, 273, 314, 153)
$Tab1 = GUICtrlCreateTab(8, 7, 409, 258)
GUICtrlSetResizing(-1, $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
$TabSheet1 = GUICtrlCreateTabItem("Main")
$Search_Box = GUICtrlCreateInput("", 116, 55, 203, 21)
$Search_Button = GUICtrlCreateButton("Search", 324, 54, 60, 23, $WS_GROUP)
GUICtrlCreateLabel("Enter the Classname, Title or Handle of the window to search for.", 18, 36, 310, 17)
$WinRefresh = GUICtrlCreateButton("Refresh List", 131, 233, 83, 23, $WS_GROUP)
$WinListView = GUICtrlCreateListView("Title|Classname|Handle|Visible", 18, 83, 387, 144)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 135)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 100)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 2, 80)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 3, 50)
$Hide_Win = GUICtrlCreateButton("Hide", 18, 233, 54, 23, $WS_GROUP)
$Show_Win = GUICtrlCreateButton("Show", 75, 233, 54, 23, $WS_GROUP)
$Combo1 = GUICtrlCreateCombo("Title", 18, 55, 93, 25, BitOR($CBS_DROPDOWNLIST, $CBS_AUTOHSCROLL))
GUICtrlSetData(-1, "Handle|Classname")
$TabSheet3 = GUICtrlCreateTabItem("Window Hotkeys")
$TabSheet2 = GUICtrlCreateTabItem("Settings")
GUICtrlCreateTabItem("")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
#Region ### START Koda GUI section - WinInfo Form ### Form=C:\Program Files\KodaGUI\Forms\WinInfo.kxf
$WinInfo = GUICreate(" Window Info", 348, 223, 365, 163, BitOR($WS_SYSMENU, $WS_CAPTION, $WS_POPUP, $WS_POPUPWINDOW, $WS_BORDER, $WS_CLIPSIBLINGS), BitOR($WS_EX_TOOLWINDOW, $WS_EX_WINDOWEDGE))
$size = WinGetClientSize($WinInfo, "")
$y = (@DesktopHeight / 2) - ($size[1] / 2) - 50
$x = (@DesktopWidth / 2) - ($size[0] / 2)
WinMove($WinInfo, "", $x, $y)
$ListView1 = GUICtrlCreateListView("Property|Value", 8, 8, 330, 179)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 100)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 224)
$CopyValue = GUICtrlCreateButton("Copy value to Clipboard", 6, 191, 132, 25, $WS_GROUP)
#EndRegion ### END Koda GUI section ###
$infoWin = False
$hContextMenu = GUICtrlCreateContextMenu($WinListView)
$item1 = GUICtrlCreateMenuItem("Hide", $hContextMenu)
$item2 = GUICtrlCreateMenuItem("Show", $hContextMenu)
GUICtrlCreateMenuItem("", $hContextMenu)
$item3 = GUICtrlCreateMenuItem("View Window Info", $hContextMenu)
GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")
populateWinList()
Func searchWindows()
Local $winList = WinList()
Local $winNums
If GUICtrlRead($Combo1) = "Title" Then
$winNums = _ArrayFindAll($winList, GUICtrlRead($Search_Box), 0, 0, 0, 1, 0)
ElseIf GUICtrlRead($Combo1) = "Handle" Then
$winNums = _ArrayFindAll($winList, GUICtrlRead($Search_Box), 0, 0, 0, 1, 1)
ElseIf GUICtrlRead($Combo1) = "Classname" Then
$winNums = WinList("[CLASS:" & GUICtrlRead($Search_Box) & "]")
EndIf
_GUICtrlListView_BeginUpdate($WinListView)
_GUICtrlListView_DeleteAllItems(GUICtrlGetHandle($WinListView))
If Not @error Then
For $i = 0 To UBound($winNums) - 1
If GUICtrlRead($Combo1) = "Title" Then
_GUICtrlListView_AddItem($WinListView, $winList[$winNums[$i]][0])
_GUICtrlListView_AddSubItem($WinListView, $i, _WinAPI_GetClassName($winList[$winNums[$i]][1]), 1)
_GUICtrlListView_AddSubItem($WinListView, $i, $winList[$winNums[$i]][1], 2)
If IsVisible($winList[$winNums[$i]][1]) Then
_GUICtrlListView_AddSubItem($WinListView, $i, "Visible", 3)
Else
_GUICtrlListView_AddSubItem($WinListView, $i, "Hidden", 3)
EndIf
ElseIf GUICtrlRead($Combo1) = "Classname" Then
ConsoleWrite("Results found: " & $winNums[0][0] & @CR)
If Not _WinAPI_GetClassName($winNums[$i][1]) = 0 Then
_GUICtrlListView_AddItem($WinListView, WinGetTitle("[CLASS:" & _WinAPI_GetClassName($winNums[$i][1]) & "]"))
_GUICtrlListView_AddSubItem($WinListView, $i - 1, _WinAPI_GetClassName($winNums[$i][1]), 1)
_GUICtrlListView_AddSubItem($WinListView, $i - 1, $winNums[$i][1], 2)
If IsVisible($winNums[$i][1]) Then
_GUICtrlListView_AddSubItem($WinListView, $i - 1, "Visible", 3)
Else
_GUICtrlListView_AddSubItem($WinListView, $i - 1, "Hidden", 3)
EndIf
EndIf
ElseIf GUICtrlRead($Combo1) = "Handle" Then
_GUICtrlListView_AddItem($WinListView, WinGetTitle("[CLASS:" & _WinAPI_GetClassName($winList[$winNums[$i]][1]) & "]"))
_GUICtrlListView_AddSubItem($WinListView, $i, _WinAPI_GetClassName($winList[$winNums[$i]][1]), 1)
_GUICtrlListView_AddSubItem($WinListView, $i, $winList[$winNums[$i]][1], 2)
If IsVisible($winList[$winNums[$i]][1]) Then
_GUICtrlListView_AddSubItem($WinListView, $i, "Visible", 3)
Else
_GUICtrlListView_AddSubItem($WinListView, $i, "Hidden", 3)
EndIf
EndIf
Next
EndIf
_GUICtrlListView_EndUpdate($WinListView)
EndFunc ;==>searchWindows
Func hideWindow()
Local $ItemNum = _GUICtrlListView_GetSelectionMark($WinListView)
Local $WinClass = _GUICtrlListView_GetItemText($WinListView, $ItemNum, 1)
WinSetState("[CLASS:" & $WinClass & "]", "", @SW_HIDE)
populateWinList()
EndFunc ;==>hideWindow
Func showWindow()
Local $ItemNum = _GUICtrlListView_GetSelectionMark($WinListView)
Local $WinClass = _GUICtrlListView_GetItemText($WinListView, $ItemNum, 1)
WinSetState("[CLASS:" & $WinClass & "]", "", @SW_SHOW)
populateWinList()
EndFunc ;==>showWindow
Func showWinInfo()
$infoWin = True
Local $ItemNum = _GUICtrlListView_GetSelectionMark($WinListView)
Local $WinTitle = _GUICtrlListView_GetItemText($WinListView, $ItemNum, 0)
Local $WinClass = _GUICtrlListView_GetItemText($WinListView, $ItemNum, 1)
Local $WinHandle = _GUICtrlListView_GetItemText($WinListView, $ItemNum, 2)
Local $WinSP = WinGetPos("[CLASS:" & $WinClass & "]")
Local $WinSize = $WinSP[3] & ", " & $WinSP[2]
Local $WinPos = "X: " & $WinSP[0] & ", Y: " & $WinSP[1]
Local $WinProcess = "PID: " & WinGetProcess("[CLASS:" & $WinClass & "]") & ", Name: " & _ProcessGetName(WinGetProcess("[CLASS:" & $WinClass & "]"))
_GUICtrlListView_BeginUpdate($ListView1)
_GUICtrlListView_DeleteAllItems(GUICtrlGetHandle($ListView1))
_GUICtrlListView_AddItem($ListView1, "Title:")
_GUICtrlListView_AddItem($ListView1, "Handle:")
_GUICtrlListView_AddItem($ListView1, "Visible:")
_GUICtrlListView_AddItem($ListView1, "Classname:")
_GUICtrlListView_AddItem($ListView1, "Size:")
_GUICtrlListView_AddItem($ListView1, "Position:")
_GUICtrlListView_AddItem($ListView1, "Process:")
_GUICtrlListView_AddSubItem($ListView1, 0, $WinTitle, 1)
_GUICtrlListView_AddSubItem($ListView1, 1, $WinHandle, 1)
If IsVisible($WinHandle) Then
_GUICtrlListView_AddSubItem($ListView1, 2, "Visible", 1)
Else
_GUICtrlListView_AddSubItem($ListView1, 2, "Hidden", 1)
EndIf
_GUICtrlListView_AddSubItem($ListView1, 3, $WinClass, 1)
_GUICtrlListView_AddSubItem($ListView1, 4, $WinSize, 1)
_GUICtrlListView_AddSubItem($ListView1, 5, $WinPos, 1)
_GUICtrlListView_AddSubItem($ListView1, 6, $WinProcess, 1)
_GUICtrlListView_EndUpdate($ListView1)
GUISetState(@SW_SHOW, $WinInfo)
EndFunc ;==>showWinInfo
Func populateWinList()
Local $winList = WinList()
_GUICtrlListView_BeginUpdate($WinListView)
_GUICtrlListView_DeleteAllItems(GUICtrlGetHandle($WinListView))
For $i = 1 To $winList[0][0]
If $winList[$i][0] <> "" Then
; Title...
_GUICtrlListView_AddItem($WinListView, $winList[$i][0])
Else
; No title?
_GUICtrlListView_AddItem($WinListView, "(No title)")
EndIf
; Handle...
_GUICtrlListView_AddSubItem($WinListView, $i - 1, $winList[$i][1], 2)
; Classname
_GUICtrlListView_AddSubItem($WinListView, $i - 1, _WinAPI_GetClassName($winList[$i][1]), 1)
; Visible?
If IsVisible($winList[$i][1]) Then
_GUICtrlListView_AddSubItem($WinListView, $i - 1, "Visible", 3)
Else
_GUICtrlListView_AddSubItem($WinListView, $i - 1, "Hidden", 3)
EndIf
Next
_GUICtrlListView_EndUpdate($WinListView)
EndFunc ;==>populateWinList
Func copyValue()
Local $ItemNum = _GUICtrlListView_GetSelectionMark($ListView1)
Local $Value = _GUICtrlListView_GetItemText($ListView1, $ItemNum, 1)
ClipPut($Value)
EndFunc ;==>copyValue
Func IsVisible($handle)
If BitAND(WinGetState($handle), 2) Then
Return True
Else
Return False
EndIf
EndFunc ;==>IsVisible
Func WM_NOTIFY($hWnd, $Msg, $wParam, $lParam)
Local $hWnd_ListView, $tNMHDR, $hWndFrom, $iCode
$hWnd_ListView = $WinListView
If Not IsHWnd($hWnd_ListView) Then $hWnd_ListView = GUICtrlGetHandle($WinListView)
$tNMHDR = DllStructCreate($tagNMHDR, $lParam)
$hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
$iCode = DllStructGetData($tNMHDR, "Code")
$Return = 0
Switch $hWndFrom
Case $hWnd_ListView
Switch $iCode
Case $NM_RCLICK
Local $tInfo = DllStructCreate($tagNMLISTVIEW, $lParam)
Local $iItem = DllStructGetData($tInfo, "Index")
If $iItem >= 0 Then
$Return = $GUI_RUNDEFMSG
EndIf
EndSwitch
EndSwitch
Return $Return
EndFunc ;==>WM_NOTIFY
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
If $infoWin = True Then
GUISetState(@SW_HIDE, $WinInfo)
$infoWin = False
Else
Exit
EndIf
Case $Hide_Win, $item1
hideWindow()
Case $Show_Win, $item2
showWindow()
Case $WinRefresh
populateWinList()
Case $item3
showWinInfo()
Case $CopyValue
copyValue()
Case $Search_Button
searchWindows()
EndSwitch
WEnd
Enjoy the site? All donations are appreciated

Free Text Host is brought to you by Dagon Design
This site contains no adware, spyware, or popups
Questions? Comments?     Privacy Policy     Report abuse here