Hallo zusammen,
nach langem habe ich auch mal wieder ein Projekt zu Ende gebracht. Es ist der Ursprungsgedanke meines Projektes Window(s) Management gewesen, welches ich nie fertig gestellt habe. Diverse Bugs sind dort noch vorhanden und eigentlich hatte ich am Ende soviel mehr dort reingepackt, dass ich selber den Überblick und die Lust verloren habe. Hier nun das wichtigste, WinMan.
Es ist noch nicht komplett fertig, da ich noch mit kleinen Problemen zu kämpfen habe und auch noch etwas Feinschliff fehlt, aber im Grund funktioniert schon alles.
Was macht das Programm?
Man kann damit den Zustand der sichtbaren Fenster verändern, um anschließend besser damit arbeiten zu können. Dazu ist ein kleines Fenster am oberen Bildrand zusehen. Mit einem Klick darauf kann man die Einstellungen des bis dato aktiven Fensters bearbeiten. Rechts daneben ist ein weiteres kl. Kästchen (bei Win7 erscheint dort ein Icon, bei XP leider nicht), womit man das Fenster wechseln kann.
Danach öffnen sich die Settings mit folgenden Einstellungen:
- Fenster umbenennen
- Transparent machen
- On Top setzen
- verstecken/ anzeigen
- ressistent gg Eingaben machen
- das Umbenennen des Fensters verbieten/ Verbot aufheben
- Fenster schließen (mehrere Methoden)
- Fenster verschieben (halbiert nach oben, unten, ..., in Systray)
- Prozess Prio ändern
- Informationen anzeigen lassen
Spoiler anzeigen
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_icon=main.ico
#AutoIt3Wrapper_Compression=4
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include "O:\DropBox\AutoIT\Includes\ModernMenuRaw.au3"
#Include "O:\Dropbox\AutoIt\Includes\HotKey.au3"
#include 'O:\Dropbox\AutoIt\Includes\ArrayMore.au3'
#include "O:\Dropbox\AutoIt\Includes\PathSplitExt.au3"
#Include <GUIImageList.au3>
#include <Array.au3>
#include <Process.au3>
#Include <Date.au3>
#include <GUIButton.au3>
#include <Misc.au3>
#include <WindowsConstants.au3>
#Include <WinAPI.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <EditConstants.au3>
#include <StaticConstants.au3>
#include <ButtonConstants.au3>
; Mouseover zum einblenden des MainGUI
; TransGUI lässt sich nicht per Button schließen/ reagiert nicht auf CloseNotNeeded()
; Hotkey-Fehler
; TransGUI wird nicht aktiviert
;-----------------------------------------------------------------------------
; Variables
;-----------------------------------------------------------------------------
Global $Title = "WinMan"
Global $Version = " v 0.11"
;~ Global $ini = @scriptdir & "\WinMan.ini"
$hUser32_DLL = DllOpen("user32.dll")
Global $WinHandle, $WinTitle, $Pid, $ProcessName, $RenameGUI, $RenameInput, $CloseGUI, $PrioGUI, $MoveGUI, $InfoGui, $TransGUI
Global $Windows, $WindowGUI, $B1, $B2, $B3, $B4, $B5, $B6
Global $i_transcolor, $Transparency, $GetTrans, $HotKeySet = 1
Global $WindowArray[1][2]
$WindowArray[0][0] = 0
Dim $arTrayWin[500][3]; TrayIconID, WinTitle, WinHandle
$arTrayWin[0][0] = 0
;~ If Not IsDeclared("GWL_EXSTYLE") Then Global Const $GWL_EXSTYLE = -20
If Not IsDeclared("GCL_HICONSM") Then Global Const $GCL_HICONSM = -34
If Not IsDeclared("GCL_HICON") Then Global Const $GCL_HICON = -14
Global Const $VK_RETURN = 0x0D
;-----------------------------------------------------------------------------
; Allow only one Instance
;-----------------------------------------------------------------------------
If _Singleton(@ScriptName, 1) = 0 Then Exit Msgbox(16,"Warning","An occurence is already running", 5)
[/autoit] [autoit][/autoit] [autoit];-----------------------------------------------------------------------------
; Options
;-----------------------------------------------------------------------------
Opt("GUIOnEventMode", 1)
OnAutoItExitRegister("_Exit")
HotKeySet("^!{Space}", "ToogleHotKeys")
;~ Opt("TrayMenuMode",1)
;~ Opt("TrayOnEventMode",1)
;~ TraySetClick(8)
;-----------------------------------------------------------------------------
; Windows
;-----------------------------------------------------------------------------
$WinWidth = 200
$WinTransActive = 200
$WinTransPassive = 100
$MainGUI = GUICreate($Title & $Version, $WinWidth, 17, @DesktopWidth / 2, 0, BitOR($WS_BORDER,$WS_POPUP,$WS_VISIBLE,$DS_SETFOREGROUND,$WS_SYSMENU), BitOR($WS_EX_OVERLAPPEDWINDOW,$WS_EX_TOPMOST,$WS_EX_TOOLWINDOW))
WinSetOnTop($MainGUI, "", 1)
WinSetTrans($MainGUI, "", $WinTransPassive)
GUISetFont(7, 350, Default, "Comic Sans MS", $MainGUI)
$MainButton = GUICtrlCreateButton("[Active]", 0, 0, $WinWidth - 17, 17)
GUICtrlSetOnEvent(-1, "ClickMainButton")
$ChangeWindowButton = GUICtrlCreateButton(" ", $WinWidth - 17, 0, 17, 17)
GUICtrlSetOnEvent(-1, "ClickChangeWindowButton")
GUICtrlSetImage(-1, "main.ico", 1, 0)
$SettingGUI = GUICreate($Title & " Settings", $WinWidth, 176, @DesktopWidth / 2, 25, BitOR($WS_BORDER,$WS_POPUP,$WS_VISIBLE,$DS_SETFOREGROUND,$WS_SYSMENU), BitOR($WS_EX_OVERLAPPEDWINDOW,$WS_EX_TOPMOST,$WS_EX_TOOLWINDOW), $MainGui)
GUISetOnEvent($GUI_EVENT_CLOSE, "SettingESC", $SettingGUI)
WinSetOnTop($SettingGUI, "", 1)
WinSetTrans($SettingGUI, "", $WinTransActive)
GUISetFont(7, 350, Default, "Comic Sans MS", $SettingGUI)
GUISetState(@SW_HIDE, $SettingGUI)
GUICtrlCreateButton("Rename", 0, 0, $WinWidth, 17)
GUICtrlSetOnEvent(-1, "ClickRename")
$TransButton = GUICtrlCreateButton("Transparence", 0, 17, $WinWidth, 17)
GUICtrlSetOnEvent(-1, "ClickTransparence")
$OnTopButton = GUICtrlCreateButton("Top", 0, 34, $WinWidth, 17)
GUICtrlSetOnEvent(-1, "ClickOnTop")
$VisibleButton = GUICtrlCreateButton("Visible", 0, 51, $WinWidth, 17)
GUICtrlSetOnEvent(-1, "ClickVisible")
$RessistentButton = GUICtrlCreateButton("Ressistent", 0, 68, $WinWidth, 17)
GUICtrlSetOnEvent(-1, "ClickRessistent")
$VariableButton = GUICtrlCreateButton("variable Window Title", 0, 85, $WinWidth, 17)
GUICtrlSetOnEvent(-1, "ClickWindowTitle")
GUICtrlCreateButton("Close and Kill >>>", 0, 105, $WinWidth, 17)
GUICtrlSetOnEvent(-1, "ClickCloseWindowMenu")
GUICtrlCreateButton("Halve and Move to >>>", 0, 122, $WinWidth, 17)
GUICtrlSetOnEvent(-1, "ClickMoveResizeMenu")
GUICtrlCreateButton("Process-Priority >>>", 0, 139, $WinWidth, 17)
GUICtrlSetOnEvent(-1, "ClickProcessPriorityMenu")
GUICtrlCreateButton("more Information", 0, 159, $WinWidth, 17)
GUICtrlSetOnEvent(-1, "ClickInformation")
GUISetState(@SW_SHOW, $MainGUI)
ToogleHotKeys()
While 1
$Info = GUIGetCursorInfo($MainGUI)
If $Info[4] = 3 And WinGetState($Title) = 5 Then
$WinHandleOld = $WinHandle
$WinHandle = WinGetHandle("[active]")
If $WinHandle = WinGetHandle($MainGUI) Or $WinHandle = WinGetHandle($SettingGUI) Then
$WinHandle = $WinHandleOld
EndIf
ConsoleWrite($Info[4]&" "&WinGetTitle($WinHandle)&" "&@CRLF)
EndIf
If $WindowArray[0][0] > 0 Then
For $i = $WindowArray[0][0] To 1 Step -1
$WindowArray[$i][1] = HWnd($WindowArray[$i][1])
If IsVisible($WindowArray[$i][1]) Then
If $WindowArray[$i][0] <> WinGetTitle($WindowArray[$i][1]) Then WinSetTitle($WindowArray[$i][1], "", $WindowArray[$i][0])
Else
ConsoleWrite($WindowArray[$i][1] & @TAB & WinExists($WindowArray[$i][1]) & @TAB & IsVisible($WindowArray[$i][1]) & @CRLF)
_ArrayDelete($WindowArray, $i)
EndIf
Next
$WindowArray[0][0] = UBound($WindowArray) - 1
EndIf
If Not WinActive("WinMan") And WinGetState($SettingGUI) = 7 Then ClickMainButton()
Sleep(100)
WEnd
;-----------------------------------------------------------------------------
; On-Event Button-Functions
;-----------------------------------------------------------------------------
Func ClickMainButton()
$WinTitle = WinGetTitle($WinHandle)
$Pid = WinGetProcess($WinHandle)
$ProcessName = _ProcessGetName($Pid)
If IsVisible($SettingGUI) Then
CloseNotNeeded()
_GUICtrlButton_SetText($MainButton, "[Active]")
GUISetState(@SW_HIDE, $SettingGUI)
WinSetTrans($MainGUI, "", $WinTransPassive)
WinActivate($WinHandle)
Else
_GUICtrlButton_SetText($MainButton, $WinTitle & " [" & $WinHandle & "]")
CheckWindowStates()
GUISetState(@SW_SHOW, $SettingGUI)
WinSetTrans($MainGUI, "", $WinTransActive)
EndIf
EndFunc
Func ClickChangeWindowButton()
CloseNotNeeded()
If $WindowGUI <> "" And IsVisible($WindowGUI) Then
_GUICtrlButton_SetText($MainButton, "[Active]")
GUISetState(@SW_HIDE, $SettingGUI)
WinSetTrans($MainGUI, "", $WinTransPassive)
;~ WinActivate($WinHandle)
GUIDelete($WindowGUI)
Else
$Windows = WinList()
For $i = $Windows[0][0] To 1 Step -1
If $Windows[$i][0] = "" Or WinGetState($Windows[$i][0]) < 5 Or Not IsVisible($Windows[$i][1]) Then
_ArrayDelete($Windows, $i)
Else
ConsoleWrite($Windows[$i][0] & @TAB & WinGetState($Windows[$i][0]) & @CRLF)
EndIf
Next
$Windows[0][0] = UBound($Windows) - 1
$WindowGUI = GUICreate($Title & " Windows", $WinWidth, 20 * $Windows[0][0], @DesktopWidth / 2 + $WinWidth + 7, 0, BitOR($WS_BORDER,$WS_POPUP,$WS_VISIBLE,$DS_SETFOREGROUND,$WS_SYSMENU), BitOR($WS_EX_OVERLAPPEDWINDOW,$WS_EX_TOPMOST,$WS_EX_TOOLWINDOW), $MainGui)
GUISetOnEvent($GUI_EVENT_CLOSE, "WindowESC", $WindowGUI)
WinSetOnTop($WindowGUI, "", 1)
WinSetTrans($WindowGUI, "", $WinTransActive)
WinSetTrans($MainGUI, "", $WinTransActive)
GUISetFont(7, 350, Default, "Comic Sans MS", $WindowGUI)
For $i = 1 To $Windows[0][0]
GUICtrlCreateButton($Windows[$i][0], 0, 20 * ($i - 1), $WinWidth, 17)
GUICtrlSetOnEvent(-1, "ChangeFocusWindows")
Next
GUISetState(@SW_SHOW, $WindowGUI)
EndIf
EndFunc
Func ClickRename()
If $RenameGUI <> "" And IsVisible($RenameGUI) Then
RenameESC()
Else
CloseNotNeeded()
$RenameGUI = GUICreate($Title & " Rename", $WinWidth, 17, @DesktopWidth / 2 + $WinWidth +7 , 25, BitOR($WS_BORDER,$WS_POPUP,$WS_VISIBLE,$DS_SETFOREGROUND,$WS_SYSMENU), BitOR($WS_EX_OVERLAPPEDWINDOW,$WS_EX_TOPMOST,$WS_EX_TOOLWINDOW), $MainGui)
GUISetOnEvent($GUI_EVENT_CLOSE, "RenameESC", $RenameGUI)
WinSetOnTop($RenameGUI, "", 1)
WinSetTrans($RenameGUI, "", $WinTransActive)
GUISetFont(7, 350, Default, "Comic Sans MS", $RenameGUI)
$RenameInput = GUICtrlCreateInput($Wintitle, 0, 0, $WinWidth, 17, BitOR($ES_WANTRETURN, $ES_LEFT, $ES_AUTOHSCROLL))
GUISetState(@SW_SHOW, $RenameGUI)
WinActivate($RenameGUI)
ControlFocus($RenameGUI, "", $RenameInput)
ControlSend($RenameGUI, "", $RenameInput, "^a")
_HotKeyAssign($VK_RETURN, "RenameWin", 1, $RenameGUI)
_HotKeyEnable()
EndIf
EndFunc
Func ClickTransparence()
Opt("GUIOnEventMode", False)
CloseNotNeeded()
$TransGUI = GUICreate($Title & " Transparence", $WinWidth, 17, @DesktopWidth / 2 + $WinWidth +7 , 45, BitOR($WS_BORDER,$WS_POPUP,$WS_VISIBLE,$DS_SETFOREGROUND,$WS_SYSMENU), BitOR($WS_EX_OVERLAPPEDWINDOW,$WS_EX_TOPMOST,$WS_EX_TOOLWINDOW), $MainGui);GUICreate($Title, 300, 130, -1, -1, $WS_POPUPWINDOW, $WS_EX_TOPMOST + $WS_EX_TOOLWINDOW, $MainGUI)
$TransSlider = GUICtrlCreateSlider(0, 0, $WinWidth, 17)
GUICtrlSetLimit(-1,100,0)
_API_GetLayeredWindowAttributes($WinHandle, $i_transcolor, $Transparency)
If $Transparency = -1 Then
$GetTrans = 0
Else
$GetTrans = Round((255 - $Transparency) * 100 / 255, 0)
EndIf
GUICtrlSetData(-1, $GetTrans)
;~ $TransInput = GUICtrlCreateInput($GetTrans & "%", 100, 105, 100, 20, $ES_READONLY+$ES_CENTER)
DllCall($hUser32_DLL, "int", "AnimateWindow", "hwnd", $TransGUI, "int", 250, "long", 0x00080000);fade-in
GUISetState(@SW_SHOW, $TransGUI)
GUISetState(@SW_DISABLE, $SettingGUI)
GUISetState(@SW_DISABLE, $MainGUI)
Local $old_readdings
If $GetTrans = 0 Then WinSetTrans($WinHandle, "", 254)
WinActivate($WinHandle)
Sleep(50)
WinActivate($TransGUI)
;~ ControlFocus($TransSlider, "", $TransSlider)
While 1
Local $new_readdings = GUICtrlRead($TransSlider)
if $old_readdings <> $new_readdings then
Local $racunanje = Round((100 - $new_readdings) * 255 / 100, 0)
If $new_readdings <> 0 then
WinSetTrans($WinHandle, "", $racunanje)
Else
WinSetTrans($WinHandle, "", 254)
EndIf
GUICtrlSetData($TransButton, "Transparence [" & $new_readdings & "%]")
$old_readdings = $new_readdings
EndIf
If WinActive($MainGUI) Then WinActivate($TransGUI)
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Opt("GUIOnEventMode", True)
If $GetTrans = 0 Then
WinSetTrans($WinHandle, "", 255)
Else
WinSetTrans($WinHandle, "", Round((100 - $GetTrans) * 255 / 100, 0))
EndIf
GUICtrlSetData($TransButton, "Transparence [" & $GetTrans & "%]")
GUIDelete($TransGUI)
WinActivate($SettingGUI)
ExitLoop
Case $GUI_EVENT_PRIMARYDOWN
dllcall($hUser32_DLL,"int","SendMessage","hWnd", $TransGUI,"int",0xA1,"int", 2,"int", 0)
EndSwitch
If _IsPressed("0D") Then
Opt("GUIOnEventMode", True)
if $new_readdings = 0 then WinSetTrans($WinHandle, "", 255)
GUIDelete($TransGUI)
WinActivate($SettingGUI)
ExitLoop
EndIf
Sleep(10)
WEnd
GUISetState(@SW_ENABLE, $SettingGUI)
GUISetState(@SW_ENABLE, $MainGUI)
EndFunc
Func _TransPlus()
_API_GetLayeredWindowAttributes($WinHandle, $i_transcolor, $Transparency)
If $Transparency = -1 Then
$GetTrans = 0
Else
$GetTrans = Round((255 - $Transparency) * 100 / 255, 0)
EndIf
If $GetTrans <= 10 Then
WinSetTrans($WinHandle, '', 255)
Else
WinSetTrans($WinHandle, '', (100 - $GetTrans) * 255 / 100 + 25.5)
EndIf
EndFunc
Func _TransMinus()
_API_GetLayeredWindowAttributes($WinHandle, $i_transcolor, $Transparency)
If $Transparency = -1 Then
$GetTrans = 0
Else
$GetTrans = Round((255 - $Transparency) * 100 / 255, 0)
EndIf
If $GetTrans >= 90 Then
WinSetTrans($WinHandle, '', 0)
Else
WinSetTrans($WinHandle, '', (100 - $GetTrans) * 255 / 100 - 25.5)
EndIf
EndFunc
Func ClickOnTop()
If _WinIsOnTop($WinHandle) Then
WinSetOnTop($WinHandle, "", 0)
Else
WinSetOnTop($WinHandle, "", 1)
EndIf
WinSetOnTop($MainGUI, "", 1)
WinSetOnTop($SettingGUI, "", 1)
CheckWindowStates()
EndFunc
Func ClickVisible()
If IsVisible($WinHandle) Then
WinSetState($WinHandle, "", @SW_HIDE)
Else
WinSetState($WinHandle, "", @SW_SHOW)
EndIf
CheckWindowStates()
EndFunc
Func ClickRessistent()
If _WindowIsResist($WinHandle) Then
_Win_SetClickThrough($WinHandle, "", False)
WinSetOnTop($WinHandle, "", 0)
WinSetTrans($WinHandle, "", 255)
Else
_Win_SetClickThrough($WinHandle, "", True)
WinSetOnTop($WinHandle, "", 1)
WinSetTrans($WinHandle, "", 127.5)
EndIf
CheckWindowStates()
EndFunc
Func ClickWindowTitle()
$SearchHwnd = _ArraySearch($WindowArray, $WinHandle)
If $SearchHwnd = -1 Then
_Array2DAdd($WindowArray, $WinTitle & "|" & $WinHandle)
ConsoleWrite(@CRLF & "Window : " & $WinHandle & @CRLF)
Else
_Array2DDelete($WindowArray, $SearchHwnd)
EndIf
$WindowArray[0][0] = UBound($WindowArray) - 1
CheckWindowStates()
EndFunc
Func ClickCloseWindowMenu()
If $CloseGUI <> "" And IsVisible($CloseGUI) Then
CloseESC()
Else
CloseNotNeeded()
$CloseGUI = GUICreate($Title & " Close Window", $WinWidth, 51, @DesktopWidth / 2 + $WinWidth +7 , 133, BitOR($WS_BORDER,$WS_POPUP,$WS_VISIBLE,$DS_SETFOREGROUND,$WS_SYSMENU), BitOR($WS_EX_OVERLAPPEDWINDOW,$WS_EX_TOPMOST,$WS_EX_TOOLWINDOW), $MainGui)
GUISetOnEvent($GUI_EVENT_CLOSE, "CloseESC", $CloseGUI)
WinSetOnTop($CloseGUI, "", 1)
WinSetTrans($CloseGUI, "", $WinTransActive)
GUISetFont(7, 350, Default, "Comic Sans MS", $CloseGUI)
GUICtrlCreateButton("Close Window", 0, 0, $WinWidth, 17)
GUICtrlSetOnEvent(-1, "ClickCloseWindow")
GUICtrlCreateButton("Kill Window", 0, 17, $WinWidth, 17)
GUICtrlSetOnEvent(-1, "ClickKillWindow")
GUICtrlCreateButton("Kill Process", 0, 34, $WinWidth, 17)
GUICtrlSetOnEvent(-1, "ClickKillProcess")
GUISetState(@SW_SHOW, $CloseGUI)
EndIf
EndFunc
Func ClickMoveResizeMenu()
If $MoveGUI <> "" And IsVisible($MoveGUI) Then
MoveESC()
Else
CloseNotNeeded()
$MoveGUI = GUICreate($Title & " Close Window", $WinWidth, 102, @DesktopWidth / 2 + $WinWidth +7 , 150, BitOR($WS_BORDER,$WS_POPUP,$WS_VISIBLE,$DS_SETFOREGROUND,$WS_SYSMENU), BitOR($WS_EX_OVERLAPPEDWINDOW,$WS_EX_TOPMOST,$WS_EX_TOOLWINDOW), $MainGui)
GUISetOnEvent($GUI_EVENT_CLOSE, "MoveESC", $MoveGUI)
WinSetOnTop($MoveGUI, "", 1)
WinSetTrans($MoveGUI, "", $WinTransActive)
GUISetFont(7, 350, Default, "Comic Sans MS", $MoveGUI)
GUICtrlCreateButton("top", 0, 0, $WinWidth, 17)
GUICtrlSetOnEvent(-1, "ClickMove2Top")
GUICtrlCreateButton("left", 0, 17, $WinWidth, 17)
GUICtrlSetOnEvent(-1, "ClickMove2Left")
GUICtrlCreateButton("bottom", 0, 34, $WinWidth, 17)
GUICtrlSetOnEvent(-1, "ClickMove2Bottom")
GUICtrlCreateButton("right", 0, 51, $WinWidth, 17)
GUICtrlSetOnEvent(-1, "ClickMove2Right")
GUICtrlCreateButton("tray", 0, 85, $WinWidth, 17)
GUICtrlSetOnEvent(-1, "ClickMove2Tray")
GUISetState(@SW_SHOW, $MoveGUI)
EndIf
EndFunc
Func ClickInformation()
If $InfoGUI <> "" And IsVisible($InfoGUI) Then
InfoESC()
Else
CloseNotNeeded()
$InfoGUI = GUICreate($Title & " Information Window", $WinWidth+$WinWidth/2, $WinWidth+$WinWidth/2, @DesktopWidth / 2 + $WinWidth +7 , 185, BitOR($WS_BORDER,$WS_POPUP,$WS_VISIBLE,$DS_SETFOREGROUND,$WS_SYSMENU), BitOR($WS_EX_OVERLAPPEDWINDOW,$WS_EX_TOPMOST,$WS_EX_TOOLWINDOW), $MainGui)
GUISetOnEvent($GUI_EVENT_CLOSE, "InfoESC", $InfoGUI)
WinSetOnTop($InfoGUI, "", 1)
WinSetTrans($InfoGUI, "", $WinTransActive)
GUISetFont(7, 350, Default, "Comic Sans MS", $InfoGUI)
GUICtrlCreateEdit("", 0, 0, $WinWidth+$WinWidth/2, $WinWidth+$WinWidth/2, BitOR($ES_WANTRETURN, $WS_VSCROLL, $WS_HSCROLL, $ES_AUTOVSCROLL, $ES_AUTOHSCROLL, $ES_READONLY))
$WinPosition = WinGetPos($WinHandle)
If Not @error Then
$x = $WinPosition[0]
$y = $WinPosition[1]
$width = $WinPosition[2]
$height = $WinPosition[3]
Else
$x = -1
$y = -1
$width = -1
$height = -1
EndIf
$Path = _PathSplitExt(_WinGetPath($Pid))
$MemStats = ProcessGetStats($ProcessName)
$ProcessPrio = _ProcessGetPriority($Pid)
Select
Case $ProcessPrio = 0
$ProcessPrio = "Idle"
Case $ProcessPrio = 1
$ProcessPrio = "Below"
Case $ProcessPrio = 2
$ProcessPrio = "Normal"
Case $ProcessPrio = 3
$ProcessPrio = "Above"
Case $ProcessPrio = 4
$ProcessPrio = "High"
Case $ProcessPrio = 5
$ProcessPrio = "Realtime"
Case Else
$ProcessPrio = "Normal"
EndSelect
GUICtrlSetData(-1, "Window: " & @TAB & $WinTitle & @CRLF & _
@CRLF & @TAB & "Handle: " & @TAB & $WinHandle & @CRLF & _
@TAB & "Position: " & @CRLF & _
@TAB & @TAB & "x: " & @TAB & $x & @CRLF & _
@TAB & @TAB & "y: " & @TAB & $y & @CRLF & _
@TAB & @TAB & "width: " & @TAB & $width & @CRLF & _
@TAB & @TAB & "height: " & @TAB & $height & @CRLF & _
@CRLF & "Process: " & @TAB & $ProcessName & @CRLF & _
@CRLF & @TAB & "PID: " & @TAB & $Pid & @CRLF & _
@TAB & "Priority: " & @TAB & $ProcessPrio & @CRLF & _
@TAB & "Folder: " & @TAB & $Path[2] & @CRLF & _
@TAB & "Memory: " & @CRLF & _
@TAB & @TAB & "working size: " & @TAB & $MemStats[0] & @CRLF & _
@TAB & @TAB & "peak working size: " & @TAB & $MemStats[1] & @CRLF & _
@CRLF & @CRLF & "Window Class-List: " & @CRLF & @CRLF & StringReplace(WinGetClassList($WinHandle), @LF, @CRLF) & @CRLF)
GUISetState(@SW_SHOW, $InfoGUI)
EndIf
EndFunc
Func ChangeFocusWindows()
$WinTitle = _GUICtrlButton_GetText(@GUI_CtrlHandle)
$SearchHwnd = _ArraySearch($Windows, $WinTitle)
$WinHandle = $Windows[$SearchHwnd][1]
GUICtrlSetData($MainButton, $WinTitle & " [" & $WinHandle & "]" )
GUIDelete($WindowGUI)
WinActivate($WinHandle)
CheckWindowStates()
GUISetState(@SW_SHOW, $SettingGUI)
EndFunc
Func RenameWin()
_WinAPI_SetWindowText($WinHandle, GUICtrlRead($RenameInput));WinSetTitle($WinHandle, "", $Rename)
RenameESC()
If Not IsVisible($SettingGUI) Then WinActivate($WinHandle)
EndFunc
Func ClickCloseWindow()
WinClose($WinHandle)
CloseESC()
EndFunc
Func ClickKillWindow()
WinKill($WinHandle)
CloseESC()
EndFunc
Func ClickKillProcess()
ProcessClose($Pid)
CloseESC()
EndFunc
Func ClickMove2Top()
Local $aSize[3][5] ; [0]=Handle, [1]=Breite, [2]=Höhe, [3]=x, [4]=y
$aSize[1][1] = @DesktopWidth
$aSize[2][1] = @DesktopWidth
$aSize[1][2] = @DesktopHeight / 2
$aSize[2][2] = @DesktopHeight / 2
$aSize[1][3] = 0
$aSize[2][3] = 0
$aSize[1][4] = 0
$aSize[2][4] = @DesktopHeight / 2
If BitAND(WinGetState($WinHandle), 32) = 32 Then WinSetState($WinHandle, '', @SW_RESTORE)
WinMove($WinHandle, '', $aSize[1][3], $aSize[1][4], $aSize[1][1], $aSize[1][2])
MoveESC()
EndFunc
Func ClickMove2Left()
Local $aSize[3][5] ; [0]=Handle, [1]=Breite, [2]=Höhe, [3]=x, [4]=y
$aSize[1][1] = @DesktopWidth / 2
$aSize[2][1] = @DesktopWidth / 2
$aSize[1][2] = @DesktopHeight
$aSize[2][2] = @DesktopHeight
$aSize[1][3] = 0
$aSize[2][3] = @DesktopWidth / 2
$aSize[1][4] = 0
$aSize[2][4] = 0
If BitAND(WinGetState($WinHandle), 32) = 32 Then WinSetState($WinHandle, '', @SW_RESTORE)
WinMove($WinHandle, '', $aSize[1][3], $aSize[1][4], $aSize[1][1], $aSize[1][2] - 25)
MoveESC()
EndFunc
Func ClickMove2Bottom()
Local $aSize[3][5] ; [0]=Handle, [1]=Breite, [2]=Höhe, [3]=x, [4]=y
$aSize[1][1] = @DesktopWidth
$aSize[2][1] = @DesktopWidth
$aSize[1][2] = @DesktopHeight / 2
$aSize[2][2] = @DesktopHeight / 2
$aSize[1][3] = 0
$aSize[2][3] = 0
$aSize[1][4] = $aSize[1][2]
$aSize[2][4] = @DesktopHeight / 2
If BitAND(WinGetState($WinHandle), 32) = 32 Then WinSetState($WinHandle, '', @SW_RESTORE)
WinMove($WinHandle, '', $aSize[1][3], $aSize[1][4], $aSize[1][1], $aSize[1][2] - 25)
MoveESC()
EndFunc
Func ClickMove2Right()
Local $aSize[3][5] ; [0]=Handle, [1]=Breite, [2]=Höhe, [3]=x, [4]=y
$aSize[1][1] = @DesktopWidth / 2
$aSize[2][1] = @DesktopWidth / 2
$aSize[1][2] = @DesktopHeight
$aSize[2][2] = @DesktopHeight
$aSize[1][3] = $aSize[1][1]
$aSize[2][3] = @DesktopWidth / 2
$aSize[1][4] = 0
$aSize[2][4] = 0
If BitAND(WinGetState($WinHandle), 32) = 32 Then WinSetState($WinHandle, '', @SW_RESTORE)
WinMove($WinHandle, '', $aSize[1][3], $aSize[1][4], $aSize[1][1], $aSize[1][2] - 25)
MoveESC()
EndFunc
Func ClickMove2Tray()
Win2Tray($WinTitle, $WinHandle)
ShowWindow($WinHandle, @SW_HIDE)
ConsoleWrite(@CRLF & "Tray added: " & $WinHandle & @CRLF)
MoveESC()
EndFunc
Func ClickProcessPriorityMenu()
If $PrioGUI <> "" And IsVisible($PrioGUI) Then
PrioESC()
Else
CloseNotNeeded()
$PrioGUI = GUICreate($Title & " Priority Window", $WinWidth, 102, @DesktopWidth / 2 + $WinWidth +7 , 167, BitOR($WS_BORDER,$WS_POPUP,$WS_VISIBLE,$DS_SETFOREGROUND,$WS_SYSMENU), BitOR($WS_EX_OVERLAPPEDWINDOW,$WS_EX_TOPMOST,$WS_EX_TOOLWINDOW), $MainGui)
GUISetOnEvent($GUI_EVENT_CLOSE, "PrioESC", $PrioGUI)
WinSetOnTop($PrioGUI, "", 1)
WinSetTrans($PrioGUI, "", $WinTransActive)
GUISetFont(7, 350, Default, "Comic Sans MS", $PrioGUI)
GUICtrlSetDefColor(0x787878, $PrioGUI)
$B1 = GUICtrlCreateButton("Idle", 0, 0, $WinWidth, 17)
GUICtrlSetOnEvent(-1, "ClickPrioIdle")
$B2 = GUICtrlCreateButton("Below", 0, 17, $WinWidth, 17)
GUICtrlSetOnEvent(-1, "ClickPrioBelow")
$B3 = GUICtrlCreateButton("Normal", 0, 34, $WinWidth, 17)
GUICtrlSetOnEvent(-1, "ClickPrioNormal")
$B4 = GUICtrlCreateButton("Above", 0, 51, $WinWidth, 17)
GUICtrlSetOnEvent(-1, "ClickPrioAbove")
$B5 = GUICtrlCreateButton("High", 0, 68, $WinWidth, 17)
GUICtrlSetOnEvent(-1, "ClickPrioHigh")
$B6 = GUICtrlCreateButton("Realtime", 0, 85, $WinWidth, 17)
GUICtrlSetOnEvent(-1, "ClickPrioRealtime")
$ProcessPrio = _ProcessGetPriority($Pid)
Select
Case $ProcessPrio = 0
GUICtrlSetColor($B1, 0x000000)
Case $ProcessPrio = 1
GUICtrlSetColor($B2, 0x000000)
Case $ProcessPrio = 2
GUICtrlSetColor($B3, 0x000000)
Case $ProcessPrio = 3
GUICtrlSetColor($B4, 0x000000)
Case $ProcessPrio = 4
GUICtrlSetColor($B5, 0x000000)
Case $ProcessPrio = 5
GUICtrlSetColor($B6, 0x000000)
Case Else
GUICtrlSetColor($B3, 0x000000)
EndSelect
GUISetState(@SW_SHOW, $PrioGUI)
EndIf
EndFunc
Func ClickPrioIdle()
ProcessSetPriority($Pid, 0)
GUICtrlSetColor($B1, 0x000000)
PrioESC()
EndFunc
Func ClickPrioBelow()
ProcessSetPriority($Pid, 1)
GUICtrlSetColor($B2, 0x000000)
PrioESC()
EndFunc
Func ClickPrioNormal()
ProcessSetPriority($Pid, 2)
GUICtrlSetColor($B3, 0x000000)
PrioESC()
EndFunc
Func ClickPrioAbove()
ProcessSetPriority($Pid, 3)
GUICtrlSetColor($B4, 0x000000)
PrioESC()
EndFunc
Func ClickPrioHigh()
ProcessSetPriority($Pid, 4)
GUICtrlSetColor($B5, 0x000000)
PrioESC()
EndFunc
Func ClickPrioRealtime()
ProcessSetPriority($Pid, 5)
GUICtrlSetColor($B6, 0x000000)
PrioESC()
EndFunc
;-----------------------------------------------------------------------------
; HotKey Functions
;-----------------------------------------------------------------------------
Func ToogleHotKeys()
If $HotKeySet = "1" Then
HotKeySet("{F7}", "HotKeyFunc");"Rename")
;~ HotKeySet("{F8}", "HotKeyFunc"); "Transparence")
HotKeySet("{F8}", "HotKeyFunc"); "Top")
HotKeySet("{F9}", "HotKeyFunc"); "Visible")
HotKeySet("{F10}", "HotKeyFunc"); "Resisstent")
HotKeySet("{F11}", "HotKeyFunc"); "Tray")
HotKeySet("!{PGUP}", "HotKeyFunc"); "TransPlus")
HotKeySet("!{PGDN}", "HotKeyFunc"); "TransMinus")
HotKeySet("!{Up}", "HotKeyFunc"); "Top")
HotKeySet("!{Right}", "HotKeyFunc"); "Right")
HotKeySet("!{Down}", "HotKeyFunc"); "Down)
HotKeySet("!{Left}", "HotKeyFunc"); "Left")
$HotKeySet = "0"
Else
HotKeySet("{F7}")
HotKeySet("{F8}")
HotKeySet("{F9}")
HotKeySet("{F10}")
HotKeySet("{F11}")
;~ HotKeySet("{F12}")
HotKeySet("!{PGUP}")
HotKeySet("!{PGDN}")
HotKeySet("!{Up}")
HotKeySet("!{Right}")
HotKeySet("!{Down}")
HotKeySet("!{Left}")
$HotKeySet = "1"
EndIf
EndFunc
Func HotKeyFunc()
$WinHandle = WinGetHandle("[active]")
If Not $WinHandle = WinGetHandle($MainGUI) And Not $WinHandle = WinGetHandle($SettingGUI) Then
$WinTitle = WinGetTitle($WinHandle)
$Pid = WinGetProcess($WinHandle)
$ProcessName = _ProcessGetName($Pid)
Select
Case @HotKeyPressed = "{F7}"
ClickRename()
;~ Case @HotKeyPressed = "{F8}"
;~ ClickTransparence()
Case @HotKeyPressed = "{F8}"
ClickOnTop()
Case @HotKeyPressed = "{F9}"
ClickVisible()
Case @HotKeyPressed = "{F10}"
ClickRessistent()
Case @HotKeyPressed = "{F11}"
ClickMove2Tray()
Case @HotKeyPressed = "!{PGUP}"
_TransPlus()
Case @HotKeyPressed = "!{PGDN}"
_TransMinus()
Case @HotKeyPressed = "!{Up}"
ClickMove2Top()
Case @HotKeyPressed = "!{Right}"
ClickMove2Right()
Case @HotKeyPressed = "!{Down}"
ClickMove2Bottom()
Case @HotKeyPressed = "!{Left}"
ClickMove2Left()
EndSelect
EndIf
EndFunc
;-----------------------------------------------------------------------------
; ESC Functions
;-----------------------------------------------------------------------------
Func _Exit()
For $i = 1 To $arTrayWin[0][0]
If $arTrayWin[$i][0] <> 0 Then
ShowWindow($arTrayWin[$i][2], @SW_RESTORE)
SetForegroundWindow($arTrayWin[$i][2])
_TrayIconDelete($arTrayWin[$i][0])
EndIf
Next
Exit
EndFunc
Func CloseNotNeeded()
$GUIHandle = WinGetHandle("[Active]")
Dim $GUIArray[6] = [WinGetHandle($RenameGUI), WinGetHandle($TransGUI), WinGetHandle($CloseGUI), WinGetHandle($MoveGUI), WinGetHandle($PrioGUI), WinGetHandle($InfoGUI)]
;~ _ArrayDisplay($GUIArray)
For $i = 0 To UBound($GUIArray) - 1
If $GUIArray[$i] <> "" And $GUIArray[$i] <> $GUIHandle Then GUIDelete($GUIArray[$i])
Next
EndFunc
Func RenameESC()
WinActivate($SettingGUI)
GUIDelete($RenameGUI)
_HotKeyDisable()
EndFunc
Func CloseESC()
GUIDelete($CloseGUI)
WinActivate($SettingGUI)
EndFunc
Func InfoESC()
GUIDelete($InfoGUI)
WinActivate($SettingGUI)
EndFunc
Func WindowESC()
ClickChangeWindowButton()
EndFunc
Func PrioESC()
GUIDelete($PrioGUI)
EndFunc
Func MoveESC()
GUIDelete($MoveGUI)
WinActivate($SettingGUI)
EndFunc
Func SettingESC()
_GUICtrlButton_SetText($MainButton, "[Active]")
GUISetState(@SW_HIDE, $SettingGUI)
EndFunc
;-----------------------------------------------------------------------------
; Other Functions
;-----------------------------------------------------------------------------
Func CheckWindowStates()
ConsoleWrite(@CRLF & "Visible: " & IsVisible($WinHandle) & @crlf)
If Not IsVisible($WinHandle) Then
GUICtrlSetColor($VisibleButton, 0x787878)
Else
GUICtrlSetColor($VisibleButton, 0x000000)
EndIf
ConsoleWrite("On Top: " & _WinIsOnTop($WinHandle) & @crlf)
If Not _WinIsOnTop($WinHandle) Then
GUICtrlSetColor($OnTopButton, 0x787878)
Else
GUICtrlSetColor($OnTopButton, 0x000000)
EndIf
ConsoleWrite("Resist: " & _WindowIsResist($WinHandle) & @CRLF)
If Not _WindowIsResist($WinHandle) Then
GUICtrlSetColor($RessistentButton, 0x787878)
Else
GUICtrlSetColor($RessistentButton, 0x000000)
EndIf
$SearchHwnd = _ArraySearch($WindowArray, $WinHandle)
ConsoleWrite("No variable Title: " & $SearchHwnd & @crlf & @CRLF)
If $SearchHwnd <> -1 Then
GUICtrlSetColor($VariableButton, 0x787878)
Else
GUICtrlSetColor($VariableButton, 0x000000)
EndIf
_API_GetLayeredWindowAttributes($WinHandle, $i_transcolor, $Transparency)
If $Transparency = -1 Then
$GetTrans = 0
Else
$GetTrans = Round((255 - $Transparency) * 100 / 255, 0)
EndIf
GUICtrlSetData($TransButton, "Transparence [" & $GetTrans & "%]")
EndFunc
Func IsVisible($handle)
If BitAnd( WinGetState($handle), 2 ) Then
Return 1
Else
Return 0
EndIf
EndFunc
Func _WinIsOnTop($hwnd)
Local $long = _WinAPI_GetWindowLong(WinGetHandle($hwnd),$GWL_EXSTYLE)
Return BitAND($long,8)=8 ; $WS_EX_TOPMOST = 8
EndFunc ; Author(s): Prog@ndy
Func _WindowIsResist($hwnd)
$Style = _WinAPI_GetWindowLong($hwnd,$GWL_EXSTYLE)
If BitAND($Style,$WS_EX_TRANSPARENT) = $WS_EX_TRANSPARENT And BitAND($Style,$WS_EX_LAYERED) = $WS_EX_LAYERED Then
Return 1
Else
Return 0
EndIf
EndFunc ; Author: Prog@ndy
Func _Win_SetClickThrough($title,$text = "",$noclic = True)
Local $hWnd = WinGetHandle($title,$text)
If @error Then Return SetError(1,0,0)
If $noclic Then
_WinAPI_SetWindowLong($hWnd,$GWL_EXSTYLE,BitOR(_WinAPI_GetWindowLong($hWnd,$GWL_EXSTYLE),$WS_EX_TRANSPARENT))
If @error Then Return SetError(2,0,0)
Else
_WinAPI_SetWindowLong($hWnd,$GWL_EXSTYLE,BitAND(_WinAPI_GetWindowLong($hWnd,$GWL_EXSTYLE),BitNOT($WS_EX_TRANSPARENT)))
If @error Then Return SetError(2,0,0)
EndIf
Return 1
EndFunc ; Author(s): Prog@ndy
Func _API_GetLayeredWindowAttributes($hwnd, ByRef $i_transcolor, ByRef $Transparency)
$i_transcolor = -1
$Transparency = -1
Local Const $AC_SRC_ALPHA = 1
Local Const $ULW_ALPHA = 2
Local Const $LWA_ALPHA = 0x2
Local Const $LWA_COLORKEY = 0x1
Local $Ret = DllCall("user32.dll", "int", "GetLayeredWindowAttributes", "hwnd", $hwnd, "long*", $i_transcolor, "byte*", $Transparency, "long*",0)
Select
Case @error
Return SetError(@error,0,0)
Case $ret[0] = 0
Return SetError(4,0,0)
Case Else
$i_transcolor = $ret[2]
$Transparency = $ret[3]
Return $ret[4]
EndSelect
EndFunc ; Author(s): Prog@ndy
Func _WinGetPath($proc_pid="", $sInResString="", $iWholeWord=1)
Local $hKernel32_Dll = DllOpen('Kernel32.dll'), $hPsapi_Dll = DllOpen('Psapi.dll')
Local $aOpenProc, $aProcPath, $sFileVersion
If $hKernel32_Dll = -1 Then Return SetError(1, 0, '')
If $hPsapi_Dll = -1 Then $hPsapi_Dll = DllOpen(@SystemDir & '\Psapi.dll')
If $hPsapi_Dll = -1 Then $hPsapi_Dll = DllOpen(@WindowsDir & '\Psapi.dll')
If $hPsapi_Dll = -1 Then Return SetError(2, 0, '')
Local $vStruct = DllStructCreate('int[1024]')
Local $pStructPtr = DllStructGetPtr($vStruct)
Local $iStructSize = DllStructGetSize($vStruct)
$aOpenProc = DllCall($hKernel32_Dll, 'hwnd', 'OpenProcess', _
'int', BitOR(0x0400, 0x0010), 'int', 0, 'int', $proc_pid)
DllCall($hPsapi_Dll, 'int', 'EnumProcessModules', _
'hwnd', $aOpenProc[0], _
'ptr', $pStructPtr, _
'int', $iStructSize, _
'int_ptr', 0)
$aProcPath = DllCall($hPsapi_Dll, 'int', 'GetModuleFileNameEx', _
'hwnd', $aOpenProc[0], _
'int', DllStructGetData($vStruct, 1), _
'str', '', _
'int', 2048)
Local $return = $aProcPath[3]
DllClose($hKernel32_Dll)
DllClose($hPsapi_Dll)
Return $return
EndFunc ; Author: Salin
Func _ProcessUpTime($exe)
If not ProcessExists($exe) Then Return 0
Local $process = '"' & $exe & '"'
Local $objWMIService = ObjGet("winmgmts:\\localhost\root\CIMV2")
Local $colItems = $objWMIService.ExecQuery ("SELECT * FROM Win32_Process Where NAME = " & $process & "", "WQL", 0x10 + 0x20)
If Not IsObj($colItems) Then Return -1
[/autoit] [autoit][/autoit] [autoit]Local $return[1][2], $counter = 0
For $objItem In $colItems
If $counter > 0 Then ReDim $return[$counter + 1][2]
$iDateCalc = _DateDiff('s', StringLeft($objItem.CreationDate, 4) & "/" & StringMid($objItem.CreationDate, 5, 2) & "/" & StringMid($objItem.CreationDate, 7, 2) _
& " " & StringMid($objItem.CreationDate, 9, 2) & ":" & StringMid($objItem.CreationDate, 11, 2) & ":" & StringMid($objItem.CreationDate, 13, 2), _
@YEAR & '/' & @MON & '/' & @MDAY & ' ' & @HOUR & ':' & @MIN & ':' & @SEC)
$return[$counter][0] = $iDateCalc
$return[$counter][1] = $objItem.ProcessId
$counter += 1
Next
Return $return
EndFunc ; Author(s): Xenobiologist
;-----------------------------------------------------------------------------
; Systray Functions
;-----------------------------------------------------------------------------
Func TrayCallBack($nID, $nMsg)
Local $i
If $nMsg = $WM_LBUTTONUP Then
For $i = 1 To $arTrayWin[0][0]
If $arTrayWin[$i][0] > 0 And $arTrayWin[$i][0] = $nID Then
ShowWindow($arTrayWin[$i][2], @SW_RESTORE)
WinActivate($arTrayWin[$i][2])
_TrayIconDelete($arTrayWin[$i][0])
$arTrayWin[$i][0] = 0
$arTrayWin[$i][1] = 0
$arTrayWin[$i][2] = 0
ExitLoop
EndIf
Next
EndIf
EndFunc
Func Win2Tray($sTitle, $hWnd)
Local $i, $nFound = 0, $nID, $nResult
For $i = 1 To $arTrayWin[0][0]
If $arTrayWin[$i][0] = 0 Then
$nFound = $i
ExitLoop
EndIf
Next
Local $sFile = ""
Local $hIcon = DllCall("user32.dll", "hwnd", "SendMessage", _
"hwnd", $hWnd, _
"int", $WM_GETICON, _
"long", 2, _
"long", 0)
$hIcon = $hIcon[0]
If $hIcon = 0 Then
$hIcon = DllCall("user32.dll", "hwnd", "SendMessage", _
"hwnd", $hWnd, _
"int", $WM_GETICON, _
"long", 0, _
"long", 0)
$hIcon = $hIcon[0]
EndIf
If $hIcon = 0 Then GetClassLong($hWnd, $GCL_HICONSM)
If $hIcon = 0 Then GetClassLong($hWnd, $GCL_HICON)
If $hIcon = 0 Then $sFile = @AutoItExe
If $hIcon = 0 Then
Local $nPID = WinGetProcess($hWnd)
If $nPID <> -1 Then
Local $hProc = OpenProcess(BitOR($PROCESS_QUERY_INFORMATION, $PROCESS_VM_READ), 0, $nPID)
If $hProc <> 0 Then
Local $stMod = DllStructCreate("int[1024]")
Local $stSize = DllStructCreate("dword")
$nResult = EnumProcessModules($hProc, _
DllStructGetPtr($stMod), _
DllStructGetSize($stMod), _
DllStructGetPtr($stSize))
If $nResult <> 0 Then
Local $stPath = DllStructCreate("char[260]")
If GetModuleFileNameExA($hProc, _
DllStructGetData($stMod, 1), _
DllStructGetPtr($stPath), _
DllStructGetSize($stPath)) <> 0 Then $sFile = DllStructGetData($stPath, 1)
EndIf
EndIf
EndIf
EndIf
$nID = _TrayIconCreate($sTitle, $sFile, 0, "TrayCallBack", 0, $hIcon)
_TrayIconSetState()
If $nFound = 0 Then
$arTrayWin[0][0] += 1
$nFound = $arTrayWin[0][0]
EndIf
$arTrayWin[$nFound][0] = $nID
$arTrayWin[$nFound][1] = $sTitle
$arTrayWin[$nFound][2] = $hWnd
EndFunc
Func GetClassLong($hWnd, $nIdx)
Local $hResult = DllCall("user32.dll", "hwnd", "GetClassLong", _
"hwnd", $hWnd, _
"int", $nIdx)
Return $hResult[0]
EndFunc
Func OpenProcess($nAccess, $nHandle, $nPID)
Local $hResult = DllCall("kernel32.dll", "hwnd", "OpenProcess", _
"dword", $nAccess, _
"int", $nHandle, _
"dword", $nPID)
Return $hResult[0]
EndFunc
Func EnumProcessModules($hProc, $pModule, $nSize, $pReqSize)
Local $nResult = DllCall("psapi.dll", "dword", "EnumProcessModules", _
"hwnd", $hProc, _
"ptr", $pModule, _
"dword", $nSize, _
"ptr", $pReqSize)
Return $nResult[0]
EndFunc
Func GetModuleFileNameExA($hProc, $hModule, $pFileName, $nSize)
Local $nResult = DllCall("psapi.dll", "dword", "GetModuleFileNameExA", _
"hwnd", $hProc, _
"hwnd", $hModule, _
"ptr", $pFileName, _
"dword", $nSize)
Return $nResult[0]
EndFunc