Jump to content
Sign in to follow this  
abishek22

A bit of help to edit my script~

Recommended Posts

abishek22

i am trying to ping a server 192.168.1.198

if its not online i want to display

MsgBox(4096, "Error", " PACS server not detected, -please check LAN/Network connectivity: Exiting,,", 10)

can this message be added in to the subsequent GUI box code given below within the second autoit script box.

$text = " " & @CRLF & @CRLF & "Amount of disk space free is " & $Cspace & " GB" & @CRLF & "Minimum 8GB disk space required " & @CRLF

$text &= @CRLF & "Current IP address is " & @IPAddress1

$text &= @CRLF & " Legal disclaimer optionally " & @CRLF & " " & @CRLF

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_icon=Data\COMPLUSg.ico
#AutoIt3Wrapper_outfile=manager.exe
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include
#include
#include
#include
#include
#include
#include
#Include
#Include
#include
#include

Global Const $GWL_EXSTYLE = -20
Global $Progname = "Window manager v0.1"
Global $font = "Bank Gothic Medium BT"
Global $fade_effect = 150
Global $aUtil_MinMax[4]

Global Const $SC_MOVE = 0xF010
Global Const $SC_SIZE = 0xF000
Global Const $SC_CLOSE = 0xF060

;ShellHook notification codes:
Global Const $HSHELL_WINDOWCREATED = 1;
Global Const $HSHELL_WINDOWDESTROYED = 2;
;~ Global Const $HSHELL_ACTIVATESHELLWINDOW = 3;
;~ Global Const $HSHELL_WINDOWACTIVATED = 4;
;~ Global Const $HSHELL_GETMINRECT = 5;
Global Const $HSHELL_REDRAW = 6;
;~ Global Const $HSHELL_TASKMAN = 7;
;~ Global Const $HSHELL_LANGUAGE = 8;
;~ Global Const $HSHELL_SYSMENU = 9;
;~ Global Const $HSHELL_ENDTASK = 10;
;~ Global Const $HSHELL_ACCESSIBILITYSTATE = 11;
;~ Global Const $HSHELL_APPCOMMAND = 12;
;~ Global Const $HSHELL_WINDOWREPLACED = 13;
;~ Global Const $HSHELL_WINDOWREPLACING = 14;
;~ Global Const $HSHELL_RUDEAPPACTIVATED = 32772;
;~ Global Const $HSHELL_FLASH = 32774;

Global $bHook = 1
Global $allow_renaming_global = true
Global $start_up_windows; = true
Global $ballon_popup; = true
Global $X_kill; = true;false
Global $realtime_refresh; = true
Global $remove_hidden; = False
Global $sound1 = true
Global $refresh_rate_interval; = 1000
Global $ini_save_file = @ScriptDir & "\data\data.dat"
Global $do_not_remove_list[1]

if FileExists($ini_save_file) = 0 then
FileWrite($ini_save_file, "")
;~ IniWrite($ini_save_file, "Options", "allow_renaming_global", "true")
IniWrite($ini_save_file, "Options", "start_up_windows", "false")
IniWrite($ini_save_file, "Options", "ballon_popup", "true")
IniWrite($ini_save_file, "Options", "X_kill", "false")
IniWrite($ini_save_file, "Options", "remove_hidden", "false")
IniWrite($ini_save_file, "Options", "realtime_refresh", "true")
IniWrite($ini_save_file, "Options", "refresh_rate_interval", "1000")
EndIf

;~ if IniRead($ini_save_file, "Options", "allow_renaming_global", "true") = "true" Then
;~ $allow_renaming_global = True
;~ Else
;~ $allow_renaming_global = False
;~ EndIf
if IniRead($ini_save_file, "Options", "start_up_windows", "true") = "true" Then
$start_up_windows = True
Else
$start_up_windows = False
EndIf
if IniRead($ini_save_file, "Options", "ballon_popup", "true") = "true" Then
$ballon_popup = True
Else
$ballon_popup = False
EndIf
if IniRead($ini_save_file, "Options", "X_kill", "true") = "true" Then
$X_kill = True
Else
$X_kill = False
EndIf
if IniRead($ini_save_file, "Options", "realtime_refresh", "true") = "true" Then
$realtime_refresh = True
Else
$realtime_refresh = False
EndIf
if IniRead($ini_save_file, "Options", "remove_hidden", "true") = "true" Then
$remove_hidden = True
Else
$remove_hidden = False
EndIf
$refresh_rate_interval = IniRead($ini_save_file, "Options", "refresh_rate_interval", "1000")

InstallFont(@ScriptDir & "\data\Font.ttf")

Func InstallFont($sSourceFile, $sFontDescript="", $sFontsPath="")
Local Const $HWND_BROADCAST = 0xFFFF
Local Const $WM_FONTCHANGE = 0x1D

If $sFontsPath = "" Then $sFontsPath = @WindowsDir & "\fonts"

Local $sFontName = StringRegExpReplace($sSourceFile, "^.*\\", "")
If Not FileCopy($sSourceFile, $sFontsPath & "\" & $sFontName, 1) Then Return SetError(1, 0, 0)

Local $hSearch = FileFindFirstFile($sSourceFile)
Local $iFontIsWildcard = StringRegExp($sFontName, "\*|\?")
Local $aRet, $hGdi32_DllOpen = DllOpen("gdi32.dll")

If $hSearch = -1 Then Return SetError(2, 0, 0)
If $hGdi32_DllOpen = -1 Then Return SetError(3, 0, 0)

While 1
$sFontName = FileFindNextFile($hSearch)
If @error Then ExitLoop

If $iFontIsWildcard Then $sFontDescript = StringRegExpReplace($sFontName, "\.[^\.]*$", "")

$aRet = DllCall($hGdi32_DllOpen, "Int", "AddFontResource", "str", $sFontsPath & "\" & $sFontName)
If IsArray($aRet) And $aRet[0] > 0 Then
RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts", _
$sFontDescript, "REG_SZ", $sFontsPath & "\" & $sFontName)
EndIf
WEnd

DllClose($hGdi32_DllOpen)
DllCall("user32.dll", "Int", "SendMessage", "hwnd", $HWND_BROADCAST, "int", $WM_FONTCHANGE, "int", 0, "int", 0)
Return 1
EndFunc

Global $windows_visibility_list = false
Global $real_time_refresh = true

Opt("GUIOnEventMode", True)
Opt("WinTitleMatchMode", 3)

;~ MsgBox(262144, "ok", $CmdLineRaw)

$dll = DllOpen("user32.dll")

#Region GUI
;~ $Form1 = GUICreate("")
$Form2 = GUICreate($Progname, 725, 250, -1, -1, $WS_POPUP+$WS_SIZEBOX, $WS_EX_TOPMOST); , $Form1)
GUISetIcon("shell32.dll", 282, $Form2)
GUISetBkColor("0x99ccff")
$contextmenu = GUICtrlCreateContextMenu()
$icon_win = GUICtrlCreateIcon("shell32.dll", 282, 5, 3, 16, 16)
GUICtrlSetResizing(-1, $GUI_DOCKSIZE+$GUI_DOCKTOP+$GUI_DOCKLEFT)
$headlines = GUICtrlCreateLabel($Progname, 25, 3, 219)
GUICtrlSetResizing(-1, $GUI_DOCKSIZE+$GUI_DOCKTOP+$GUI_DOCKLEFT)
GUICtrlSetColor(-1, "0x003366")
GUICtrlSetFont(-1, 14, 400, 2, $font)
$BY_label = GUICtrlCreateLabel("... by Abishek", 250, 8, 60, 15)
GUICtrlSetResizing(-1, $GUI_DOCKSIZE+$GUI_DOCKTOP+$GUI_DOCKLEFT)
GUICtrlSetColor(-1, "0x003366")
GUICtrlSetFont(-1, 8, 800, 0, "arial")
$icon1 = GUICtrlCreateIcon("shell32.dll", 240, 630+75, 3, 16, 16)
GUICtrlSetResizing(-1, $GUI_DOCKSIZE+$GUI_DOCKTOP+$GUI_DOCKRIGHT)
$icon2 = GUICtrlCreateIcon("shell32.dll", 24, 608+75, 3, 16, 16)
GUICtrlSetResizing(-1, $GUI_DOCKSIZE+$GUI_DOCKTOP+$GUI_DOCKRIGHT)

$exStyles = BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES)
$listt = GUICtrlCreateListView("", 90, 25, 550+75, 220, BitOR($LVS_SHOWSELALWAYS, $LVS_REPORT))
GUICtrlSetResizing(-1, $GUI_DOCKBORDERS)
_GUICtrlListView_SetExtendedListViewStyle($listt, $exStyles)
GUICtrlSetBkColor(-1, "0xDFF3FE")

$ListDummy = GUICtrlCreateDummy()
$list_context = GUICtrlCreateContextMenu($ListDummy)
$Rename_Window = GUICtrlCreateMenuItem("Rename window", $ListDummy)
$Set_on_top_Window = GUICtrlCreateMenuItem("Trigger on-top", $ListDummy)
$Set_transparency = GUICtrlCreateMenuItem("Set transparency", $ListDummy)
$Set_visibility = GUICtrlCreateMenuItem("Trigger visibility", $ListDummy)
$Set_self_rename = GUICtrlCreateMenuItem("Allow Self-Renaming", $ListDummy)
GUICtrlCreateMenuItem("", $ListDummy)
$go_to_folder = GUICtrlCreateMenuItem("Go to process's folder", $ListDummy)
GUICtrlCreateMenuItem("", $ListDummy)
$view_visible = GUICtrlCreateMenuItem("List only visible windows", $ListDummy)
GUICtrlSetState(-1, $GUI_CHECKED)
$Refresh_List = GUICtrlCreateMenuItem("Refresh list", $ListDummy)
GUICtrlCreateMenuItem("", $ListDummy)
$Kill_window = GUICtrlCreateMenuItem("Close this window", $ListDummy)
$Kill_processs = GUICtrlCreateMenuItem("Kill window's process", $ListDummy)


$hImage = _GUIImageList_Create(16, 16, 5, 3)
_GUICtrlListView_AddColumn($listt, "Window(s)", 120)
_GUICtrlListView_AddColumn($listt, "On-Top", 50)
_GUICtrlListView_AddColumn($listt, "Transparent", 75)
_GUICtrlListView_AddColumn($listt, "Visible", 50)
_GUICtrlListView_AddColumn($listt, "Self-Rename", 75)
_GUICtrlListView_AddColumn($listt, "Window's executable (.exe)", 250)
_GUICtrlListView_AddColumn($listt, "Window's handle", 100)

GUISetOnEvent ($GUI_EVENT_PRIMARYDOWN, "Drag" )
GUICtrlSetOnEvent ($headlines, "Drag" )
GUICtrlSetOnEvent ($icon1, "_Minimize_manager")
GUICtrlSetOnEvent ($icon2, "_help_pop_up")
GUICtrlSetOnEvent ($listt, "_Sort_items")

GUICtrlSetOnEvent ($Rename_Window, "_Rename_Window")
GUICtrlSetOnEvent ($Set_on_top_Window, "_Set_on_top_Window")
GUICtrlSetOnEvent ($Set_transparency, "_Set_Transparency")
GUICtrlSetOnEvent ($Set_visibility, "_Set_visibility")
GUICtrlSetOnEvent ($Set_self_rename, "_Set_self_rename")

GUICtrlSetOnEvent ($go_to_folder, "_go_to_process_folder")

GUICtrlSetOnEvent ($view_visible, "_Set_to_view_only_visible")
GUICtrlSetOnEvent ($Refresh_List, "_List_refreshing")

GUICtrlSetOnEvent ($Kill_window, "_Close_selected_window")
GUICtrlSetOnEvent ($Kill_processs, "_Close_selected_window_process")

;~ DllCall($dll, "int", "AnimateWindow", "hwnd", $form2, "int", $fade_effect, "long", 0x00080000);fade-in
WinSetTrans($form2, "", 254)
;~ GUISetState(@SW_SHOW, $form2)

GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")
GUIRegisterMsg(RegisterWindowMessage("SHELLHOOK"), "HShellWndProc")
ShellHookWindow($form2, $bHook)
initMinMax(370,150,@DesktopWidth-30,@DesktopHeight-30)

If _MutexExists($progname) Then
MsgBox(262144, $progname, "Program is allready running")
Exit
EndIf

if $CmdLineRaw = "/background" Then
GUISetState(@SW_HIDE)
$1st_time = true
Else
GUISetState(@SW_SHOW)
$1st_time = false
EndIf
#EndRegion

#Region tray menu
SetBlueTrayColors()

$nTrayIcon1 = _TrayIconCreate($Progname, "shell32.dll", 282)
_TrayIconSetClick(-1, 9)

$nTrayMenu1 = _TrayCreateContextMenu()

$TrayRestore = _TrayCreateItem("Restore")
GUICtrlSetState(-1, $GUI_DEFBUTTON)
_TrayCreateItem("")
_TrayItemSetIcon(-1, "", 0)
$MenuOptions = _TrayCreateItem("Options")
_TrayCreateItem("")
_TrayItemSetIcon(-1, "", 0)
$TrayExit = _TrayCreateItem("Exit")

_TrayItemSetIcon($TrayRestore, "shell32.dll", -147)
_TrayItemSetIcon($MenuOptions, "shell32.dll", -166)
_TrayItemSetIcon($TrayExit, "shell32.dll", -28)

GUICtrlSetOnEvent ($TrayExit, "_exit1")
GUICtrlSetOnEvent ($MenuOptions, "_Option_Window")
GUICtrlSetOnEvent ($TrayRestore, "_restore_manager")

_TrayIconSetState()
#EndRegion

if $CmdLineRaw <> "/background" Then
_DisplaySelection()
Sleep(100)
_GUICtrlListView_RegisterSortCallBack($listt)
endif

Func _MutexExists($sOccurenceName)
Local $ERROR_ALREADY_EXISTS = 183, $handle, $lastError

$sOccurenceName = StringReplace($sOccurenceName, "\", ""); to avoid error
$handle = DllCall("kernel32.dll", "int", "CreateMutex", "int", 0, "long", 1, "str", $sOccurenceName)

$lastError = DllCall("kernel32.dll", "int", "GetLastError")
Return $lastError[0] = $ERROR_ALREADY_EXISTS

EndFunc ;==>_MutexExists

Func HShellWndProc($hWnd, $Msg, $wParam, $lParam)
Switch $wParam
;~ Case $HSHELL_WINDOWCREATED
;~ _add_window($lParam, WinGetTitle($lParam))
;~ Case $HSHELL_WINDOWDESTROYED
;~ _delete_window($lParam, WinGetTitle($lParam))
Case $HSHELL_REDRAW
_change_title_window($lParam, WinGetTitle($lParam))
EndSwitch
EndFunc

func _Option_Window()
_toggle_hooker()
_call_option_window($Progname & " Options")
_toggle_hooker()
EndFunc

func _call_option_window($win_name1)
opt("GUIOnEventMode", False)
Local $readings
Local $mouse_position = MouseGetPos()
Local $form2_position = WinGetPos($Form2)

Local $form4 = GUICreate($win_name1, 200, 280, $form2_position[0]+$form2_position[2]/2-70, $form2_position[1]+$form2_position[3]/2-63, $WS_POPUP, $WS_EX_TOPMOST)
GUISetIcon("shell32.dll", -166)

GUISetBkColor("0x99ccff")
GUICtrlCreateIcon("shell32.dll", -166, 6, 7, 16, 16)
Local $size2 = WinGetClientSize($form4)
$ex_icon = GUICtrlCreateIcon("shell32.dll", -132, $size2[0]-22, 7, 16, 16)
GUICtrlCreateLabel($win_name1, 25, 4, $size2[0]-50, 60, $ES_CENTER)
GUICtrlSetColor(-1, "0x003366")
GUICtrlSetFont(-1, 14, 400, 0, "Bank Gothic Medium BT")

GUICtrlCreateGraphic(0, 0, $size2[0], $size2[1], $SS_BLACKFRAME)
GUICtrlSetColor(-1, 0)
GUICtrlCreateGraphic(3, 3, $size2[0]-6, $size2[1]-6, $SS_BLACKFRAME)
GUICtrlSetColor(-1, 0)

GUICtrlCreateGroup("Basic Options", 10, 65, $size2[0]-20, 100)
$start_up_checkbox = GUICtrlCreateCheckbox("Start Up with Windows", 15, 80, 130, 17)
if $start_up_windows = true Then
GUICtrlSetState($start_up_checkbox, $GUI_CHECKED)
endif
$allow_balloon_popups = GUICtrlCreateCheckbox("Allow Balloon Pop-Ups", 15, 100, 130, 17)
if $ballon_popup = true Then
GUICtrlSetState($allow_balloon_popups, $GUI_CHECKED)
endif
$x_kill_mark = GUICtrlCreateCheckbox("X-mark Kills Manager", 15, 120, 130, 17)
if $X_kill = true Then
GUICtrlSetState($x_kill_mark, $GUI_CHECKED)
endif
$remove_hidden_opt = GUICtrlCreateCheckbox("Remove Hidden from List", 15, 140, 150, 17)
if $remove_hidden = true Then
GUICtrlSetState($remove_hidden_opt, $GUI_CHECKED)
endif
GUICtrlCreateGroup("", -99, -99, 1, 1) ;close group

GUICtrlCreateGroup("Real-Time Refresh", 10, 170, $size2[0]-20, 70)
$reeal_time_refresh_list_checkbox = GUICtrlCreateCheckbox("Allow Real-Time List Refresh", 15, 190, 160, 17)
$interval_input_label = GUICtrlCreateLabel("Refresh Rate Interval (sec.)", 15, 210, 130, 17)
;~ GUICtrlSetState(-1, $GUI_DISABLE)
$interval_input = GUICtrlCreateInput($refresh_rate_interval/1000, 147, 208, 40, 20, $ES_NUMBER+$ES_CENTER+$ES_AUTOHSCROLL)
GUICtrlSetBkColor(-1, "0xDFF3FE")
GUICtrlSetColor(-1, "0x003366")
GUICtrlSetLimit(-1, 2, 0)
;~ GUICtrlSetState(-1, $GUI_DISABLE)
$interval_input_updown = GUICtrlCreateUpdown(-1)
GUICtrlSetLimit(-1, 99, 0)
;~ GUICtrlSetState(-1, $GUI_DISABLE)
GUICtrlCreateGroup("", -99, -99, 1, 1) ;close group

if $realtime_refresh = true Then
GUICtrlSetState($reeal_time_refresh_list_checkbox, $GUI_CHECKED)
Else
GUICtrlSetState($interval_input_updown, $GUI_DISABLE)
GUICtrlSetState($interval_input, $GUI_DISABLE)
GUICtrlSetState($interval_input_label, $GUI_DISABLE)
EndIf

Local $i_button_ok_form4 = GUICtrlCreateButton("Ok", 110, 250, 80, 20)
;~ initMinMax($size2[0]+6,$size2[1]+6,$size2[0]+6,$size2[1]+6)
GUISetState(@SW_SHOW, $form4)

While 1
if WinActive($form2) then
;~ Sleep(250)
WinActivate($form4)
SoundPlay(@WindowsDir & "\media\ding.wav", 0)
endif
$nMsg = GUIGetMsg()
Switch $nMsg
case $i_button_ok_form4
if GUICtrlRead($start_up_checkbox) = $GUI_CHECKED Then
IniWrite($ini_save_file, "Options", "start_up_windows", "true")
RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run", $Progname, "REG_SZ", @ScriptFullPath & " /background")
Else
IniWrite($ini_save_file, "Options", "start_up_windows", "false")
RegDelete("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run", $Progname)
EndIf
if GUICtrlRead($allow_balloon_popups) = $GUI_CHECKED Then
$ballon_popup = true
IniWrite($ini_save_file, "Options", "ballon_popup", "true")
Else
$ballon_popup = false
IniWrite($ini_save_file, "Options", "ballon_popup", "false")
EndIf
if GUICtrlRead($remove_hidden_opt) = $GUI_CHECKED Then
$remove_hidden = true
IniWrite($ini_save_file, "Options", "remove_hidden", "true")
ReDim $do_not_remove_list[1]
;~ _TrayTip(-1, "ok", "true", 10)
Else
$remove_hidden = false
IniWrite($ini_save_file, "Options", "remove_hidden", "false")
;~ _TrayTip(-1, "ok", "false", 10)
EndIf
if GUICtrlRead($x_kill_mark) = $GUI_CHECKED Then
$X_kill = true
IniWrite($ini_save_file, "Options", "X_kill", "true")
Else
$X_kill = false
IniWrite($ini_save_file, "Options", "X_kill", "false")
EndIf
if GUICtrlRead($reeal_time_refresh_list_checkbox) = $GUI_CHECKED Then
$realtime_refresh = true
IniWrite($ini_save_file, "Options", "realtime_refresh", "true")
Else
$realtime_refresh = false
IniWrite($ini_save_file, "Options", "realtime_refresh", "false")
EndIf
$refresh_rate_interval = GUICtrlRead($interval_input)*1000
IniWrite($ini_save_file, "Options", "refresh_rate_interval", $refresh_rate_interval)
opt("GUIOnEventMode", True)
DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $form4, "int", $fade_effect, "long", 0x00090000)
GUIDelete($form4)
Return 1
case $ex_icon
opt("GUIOnEventMode", True)
DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $form4, "int", $fade_effect, "long", 0x00090000)
GUIDelete($form4)
Return 0
case $GUI_EVENT_PRIMARYDOWN
dllcall("user32.dll","int","SendMessage","hWnd", $form4,"int",0xA1,"int", 2,"int", 0)
case $reeal_time_refresh_list_checkbox
if GUICtrlRead($reeal_time_refresh_list_checkbox) = $GUI_CHECKED Then
;~ $remove_hidden = true
GUICtrlSetState($interval_input, $GUI_ENABLE)
GUICtrlSetState($interval_input_updown, $GUI_ENABLE)
GUICtrlSetState($interval_input_label, $GUI_ENABLE)
Else
;~ $remove_hidden = false
GUICtrlSetState($interval_input, $GUI_DISABLE)
GUICtrlSetState($interval_input_updown, $GUI_DISABLE)
GUICtrlSetState($interval_input_label, $GUI_DISABLE)
EndIf
EndSwitch
Sleep(10)
WEnd
EndFunc

func _restore_manager()
GUISetState(@SW_SHOW, $form2)
if $1st_time = true Then
_DisplaySelection()
Sleep(100)
_GUICtrlListView_RegisterSortCallBack($listt)
$1st_time = false
EndIf
;~ DllCall($dll, "int", "AnimateWindow", "hwnd", $form2, "int", $fade_effect, "long", 0x00080000);fade-in
;~ _List_refreshing()
;~ _set_icons()
EndFunc

func _Minimize_manager()
if $X_kill = true then
_exit1()
Else
if $ballon_popup = True then _TrayTip(-1, $Progname, "...to restore " & $Progname & @CRLF & "click here, then click Restore.", 10);, $nInfoFlags = 0)
GUISetState(@SW_HIDE, $form2)
EndIf
;~ DllCall($dll, "int", "AnimateWindow", "hwnd", $form2, "int", 200, "long", 0x00090000);fade-out
EndFunc

Func ShellHookWindow($hWnd, $bFlag)
Local $sFunc = 'DeregisterShellHookWindow'
If $bFlag Then $sFunc = 'RegisterShellHookWindow'
Local $aRet = DllCall('user32.dll', 'int', $sFunc, 'hwnd', $hWnd)
Return $aRet[0]
EndFunc

Func RegisterWindowMessage($sText)
Local $aRet = DllCall('user32.dll', 'int', 'RegisterWindowMessage', 'str', $sText)
Return $aRet[0]
EndFunc

Func On_WM_SYSCOMMAND($hWnd, $Msg, $wParam, $lParam)
Switch BitAND($wParam, 0xFFF0)
Case $SC_MOVE, $SC_SIZE
Case $SC_CLOSE
ShellHookWindow($form2, 0)
Return $GUI_RUNDEFMSG
EndSwitch
EndFunc

Func initMinMax($x0,$y0,$x1,$y1)
Local Const $WM_GETMINMAXINFO = 0x24
$aUtil_MinMax[0]=$x0
$aUtil_MinMax[1]=$y0
$aUtil_MinMax[2]=$x1
$aUtil_MinMax[3]=$y1
GUIRegisterMsg($WM_GETMINMAXINFO,'MY_WM_GETMINMAXINFO')
EndFunc

Func MY_WM_GETMINMAXINFO($hWnd, $Msg, $wParam, $lParam)
Local $minmaxinfo = DllStructCreate('int;int;int;int;int;int;int;int;int;int',$lParam)
DllStructSetData($minmaxinfo,7,$aUtil_MinMax[0]); min X
DllStructSetData($minmaxinfo,8,$aUtil_MinMax[1]); min Y
DllStructSetData($minmaxinfo,9,$aUtil_MinMax[2]); max X
DllStructSetData($minmaxinfo,10,$aUtil_MinMax[3]); max Y
Return $GUI_RUNDEFMSG
EndFunc

func _help_pop_up()
_toggle_hooker()
_msgBox_helper($Progname & " Help")
_toggle_hooker()
EndFunc

func _msgBox_helper($win_name1)

Local $bassdll = DllOpen(@ScriptDir & "\data\BASSMOD.dll")
Local $sFirstTime2 = 1

$play = 0
;~ $path = ""
$spath = @ScriptDir & "\data\music.xm"
$play = _load_song($sPath, $bassdll)

;~ Local $sound1 = true
Local $Help_text = "Thank you for using " & $Progname & @CRLF & _
@crlf & _
@crlf & _
"This application will help you to get more controls over any window running on your desktop. It has ability of detecting if a window is having on-top attribude, or detecting window's transparency. It can also change this values, so you can set any window to be on-top, or change it's transparency, or even hide it, disable it's ability to self-rename, etc..." & @crlf & _
@crlf & _
"Once you run the program, you'll notice a list with all windows curently running in the list. By double left click on an item from the list you'll set selected window as curently active one. By right clicking, you'll get a list of this application features:" & @crlf & _
@crlf & _
"Rename window - will allow you to set window's title to what ever you want." & @crlf & _
@crlf & _
"Trigger on-top - will set On/off top attribute to selected window" & @crlf & _
@crlf & _
"Set Transparency - will allow you to set your window's transparency from full solid (100%) to barely visible (10%)" & @crlf & _
@crlf & _
"Trigger visibility - will hide your window from desktop, and from task manager (Applications section) or show it on desktop again if it's hidden" & @crlf & _
@crlf & _
"Allow Self-Renaming - will disable window's ability to self-rename (like Firefox does when u switch between tabs)" & @crlf & _
@crlf & _
"Go to process's folder - will open Windows Explorer with location of the application of the window (will set application's exe as curent)" & @crlf & _
@crlf & _
"List Only Visible Windows - will trigger on/off display of all windows, or only visible ones (there are many windows on your desktop running which you are not aware of)" & @crlf & _
@crlf & _
"Refresh List - will refresh entire list" & @crlf & _
@crlf & _
"Close this window - will close selected window, or multiple windows" & @crlf & _
@crlf & _
"Kill window's process - will kill the process (or processes) which is linked to the selected window (windows)" & @crlf & _
@crlf & _
@crlf & _
"When you run this application, you'll notice new icon in the tray menu (tray menu is usualy in the right bottom part of your screen, next to the clock), icon of this program. By clicking on it, you'll get 3 following options:" & @crlf & _
@crlf & _
"Restore - when you click on X-mark in manager, it won't close, it'll disapear, though, by clicking on this option ""Restore"" you'll restore your manager back to visible state." & @crlf & _
@crlf & _
"Options - will display options window" & @crlf & _
@crlf & _
"Quit - will close $progname" & @crlf & _
@crlf & _
@crlf & _
"As for options window:" & @crlf & _
@crlf & _
"Start Up With Windows - will set the $progname to start together with your Windows" & @crlf & _
@crlf & _
"Allow Balloon Pop-Ups - will allow/disallow tray balloon notification pop-ups" & @crlf & _
@crlf & _
"X-Mark Kills Manager - if checked ""X"" on your manager will close manager, if it's unchecked, ""X"" will hide your manager to tray icon" & @crlf & _
@crlf & _
"Remove Hidden From List - If Checked, when you trigger Visibility on any of the windows in the list, the window will disapear from the list (you'll be able to restore it if you set the list to vew all, even hidden windows). if it's unchecked, and you trigger visibility of any window in the list, the window will stay in the list." & @crlf & _
@crlf & _
"Allow Real-Time list Refresh - If checked, it will act like Task Manager, it will add new window if a new window is created, or delete the old one, if the window closes. If checked it will take more ressources, but you can reduce refresh rate interval, by increasing input bellow."
Local $credits_text = "Main coder:" & @crlf & _
@crlf & _
"sandin" & @crlf & _
@crlf & _
@crlf & _
@crlf & _
"Many thanks to all contributors of this application:" & @crlf & _
@crlf & _
"MrCreator" & @crlf & _
"(Font Install)" & @crlf & _
@crlf & _
"PsaltyDS" & @crlf & _
"(ProcessList)" & @crlf & _
@crlf & _
"rasim" & @crlf & _
"(mod music)" & @crlf & _
@crlf & _
"GaryFrost" & @crlf & _
"(ListView event)" & @crlf & _
@crlf & _
"Xandl" & @crlf & _
"(MinMax Win Size)" & @crlf & _
@crlf & _
"Holger" & @crlf & _
"(Modern Tray)" & @crlf & _
@crlf & _
"Siao" & @crlf & _
"(Hook Windows)" & @crlf & _
@crlf & _
"LarryDalooza" & @crlf & _
"(Hook Windows)" & @crlf & _
@crlf & _
@crlf & _
"...and everyone from general help section of AutoIt forum which helped indirectly." & @crlf & _
@crlf & _
@crlf & _
@crlf & _
"special thanks to tester:" & @crlf & _
@crlf & _
"Gogili"
$fade_effect = 150
opt("GUIOnEventMode", False)
Local $readings
Local $mouse_position = MouseGetPos()
Local $form2_position = WinGetPos($Form2)
Local $form4 = GUICreate($win_name1, 400, 280, $form2_position[0]+$form2_position[2]/2-130, $form2_position[1]+$form2_position[3]/2-63, $WS_POPUP, $WS_EX_TOPMOST)
GUISetIcon("shell32.dll", 24)
GUISetBkColor("0x99ccff")
GUICtrlCreateIcon("shell32.dll", 24, 6, 7, 16, 16)
Local $size2 = WinGetClientSize($form4)
$ex_icon = GUICtrlCreateIcon("shell32.dll", -132, $size2[0]-22, 7, 16, 16)
GUICtrlCreateLabel($win_name1, 25, 4, $size2[0]-50, 20, $ES_CENTER)
GUICtrlSetColor(-1, "0x003366")
GUICtrlSetFont(-1, 14, 400, 0, "Bank Gothic Medium BT")

GUICtrlCreateGraphic(0, 0, $size2[0], $size2[1], $SS_BLACKFRAME)
GUICtrlSetColor(-1, 0)
GUICtrlCreateGraphic(3, 3, $size2[0]-6, $size2[1]-6, $SS_BLACKFRAME)
GUICtrlSetColor(-1, 0)

GUICtrlCreateGroup("Manual", 10, 30, 190, 240)
$help_edit = GUICtrlCreateEdit($Help_text, 20, 50, 170, 210, $ES_READONLY+$WS_VSCROLL)
;~ _GUICtrlEdit_Create($form4, $Help_text, 20, 50, 170, 210, $ES_READONLY)
GUICtrlSetBkColor(-1, 0xDFF3FE)
GUICtrlSetColor(-1, 0x003366)
GUICtrlCreateGroup("", -99, -99, 1, 1) ;close group

GUICtrlCreateGroup("Credits:", 205, 30, 185, 210)
GUICtrlCreateGraphic(215, 50, 165, 180)
GUICtrlSetColor(-1, 0x003366)
;~ GUICtrlSetBkColor(-1, 0xDFF3FE)
;~ GUICtrlSetState(-1, $GUI_DISABLE)

Local $i_button_ok_form4 = GUICtrlCreateButton("Close", $size2[0]-90, 250, 80, 20)
Local $i_button_sound_form4 = GUICtrlCreateButton("Music", $size2[0]-175, 250, 80, 20)
Local $icon_sound = GUICtrlCreateIcon("shell32.dll", -169, $size2[0]-193, 253, 16, 16)
if $sound1 = true Then
GUICtrlSetImage($icon_sound, "shell32.dll", -169)
Else
GUICtrlSetImage($icon_sound, "shell32.dll", -110)
EndIf

GUICtrlSetColor(-1, "0x003366")
GUICtrlSetFont(-1, 10, 400, 0, "Bank Gothic Medium BT")
GUICtrlCreateGroup("", -99, -99, 1, 1) ;close group

Local $form45 = GUICreate("",163, 177, 213, 22 ,BitOR($WS_POPUP,$WS_CHILD),$WS_EX_MDICHILD,$form4)
GUISetBkColor(0xDFF3FE, $form45)
$credits_label = GUICtrlCreateLabel($credits_text, 5, 177, 153, 1050, $ES_CENTER)
GUICtrlSetColor(-1, "0x003366")
;~ GUICtrlSetBkColor(-1, 0x000000)
GUICtrlSetFont(-1, 14, 400, 0, "Tahoma")
;~ WinSetTrans($form45,"",254)
GUISetState()

$sTransHeight = 4
For $x = 0 to 15
Local $stemp1 = GUICreate("",163, $sTransHeight, 213, ($sTransHeight * $x)+22 ,BitOR($WS_POPUP,$WS_CHILD),$WS_EX_MDICHILD,$form4)
GUISetBkColor(0xDFF3FE)
GUISetState()
WinSetTrans($stemp1,"",(255/15)*(-1*($x-15)))
Next

For $x = 0 to 15
Local $stemp2 = GUICreate("",163, $sTransHeight, 213, 196 - ($sTransHeight * $x) ,BitOR($WS_POPUP,$WS_CHILD),$WS_EX_MDICHILD,$form4)
GUISetBkColor(0xDFF3FE)
GUISetState()
WinSetTrans($stemp2,"",(255/15)*(-1*($x-15)))
Next

GUISetState(@SW_SHOW, $form4)

if $sound1 = true then DllCall($bassdll, "int:cdecl", "BASSMOD_MusicPlay", "int", $play)

Local $sTime = TimerInit()
Local $sScroll = 5
Local $sFirstTime = 1

While 1
If ($sFirstTime AND TimerDiff($sTime) > 10) OR (Not $sFirstTime AND TimerDiff($sTime) > 30) Then
$sFirstTime = 0
$sTime = TimerInit()
Local $credits_location = ControlGetPos($form45, "", $credits_label)
if $credits_location[1] < -1050 Then
ControlMove($form45,"",$credits_label,5,177)
$sScroll = 0
Else
ControlMove($form45,"",$credits_label,5,177-$sScroll) ;reset ovoga
$sScroll += 1
EndIf
EndIf
if WinActive($form2) then
WinActivate($form4)
SoundPlay(@WindowsDir & "\media\ding.wav",0)
endif
$nMsg = GUIGetMsg()
Switch $nMsg
case $i_button_ok_form4
DllCall($bassdll, "int:cdecl", "BASSMOD_MusicStop", "int", $play)
opt("GUIOnEventMode", True)
GUIDelete($stemp1)
GUIDelete($stemp2)
GUIDelete($form45)
DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $form4, "int", $fade_effect, "long", 0x00090000)
GUIDelete($form4)
DllCall($bassdll, "int:cdecl", "BASSMOD_MusicFree", "int", $play)
DllClose($bassdll)
Return 1
case $ex_icon
DllCall($bassdll, "int:cdecl", "BASSMOD_MusicStop", "int", $play)
opt("GUIOnEventMode", True)
GUIDelete($stemp1)
GUIDelete($stemp2)
GUIDelete($form45)
DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $form4, "int", $fade_effect, "long", 0x00090000)
GUIDelete($form4)
DllCall($bassdll, "int:cdecl", "BASSMOD_MusicFree", "int", $play)
DllClose($bassdll)
Return 0
case $GUI_EVENT_PRIMARYDOWN
WinSetTrans($form45,"",254)
do
dllcall("user32.dll","int","SendMessage","hWnd", $form4,"int",0xA1,"int", 2,"int", 0)
Local $msgg2 = GUIGetMsg()
Until $msgg2 <> -7
WinSetTrans($form45,"",255)
case $i_button_sound_form4
if $sound1 = true Then
GUICtrlSetImage($icon_sound, "shell32.dll", -110)
$sound1 = false
DllCall($bassdll, "int:cdecl", "BASSMOD_MusicFree", "int", $play)
Sleep(100)
$play = _load_song($sPath, $bassdll)
Else
GUICtrlSetImage($icon_sound, "shell32.dll", -169)
$sound1 = true
DllCall($bassdll, "int:cdecl", "BASSMOD_MusicPlay", "int", $play)
EndIf
EndSwitch
Sleep(10)
WEnd
EndFunc

func _load_song($path, $bassdll)
Local $style = 1028;BitOR(1024, 4)
Local $Init = DllCall($bassdll, "int", "BASSMOD_Init", "int", -1, "int", 44100, "int", 0)
Local $Name_H = DllStructCreate("char[255]")
DllStructSetData($Name_H, 1, $path)
$Lod = DllCall($bassdll, "int", "BASSMOD_MusicLoad", "int", 0, _
"ptr", DllStructGetPtr($Name_H), _
"int", 0, _
"int", 0, _
"int", $style)
Return $Init[0]
EndFunc

func _toggle_hooker()
$bHook = BitXOR($bHook, 1)
ShellHookWindow($form2, $bHook)
EndFunc

func _go_to_process_folder()
Local $get_state = _get_item_substring()
Local $hwnd2 = $get_state[0]
Local $process_Pid = WinGetProcess($hwnd2)
if $get_state[5] <> "0" Then
Run(@ComSpec & " /c " & "explorer /e,/select," & $get_state[5], "", @SW_HIDE)
Else
MsgBox(262144, "Error", "location of this window could not be retrieved", 10)
EndIf
EndFunc

func _Close_selected_window_process()
Local $question2
Local $get_state = _get_item_substring()
if $get_state[6] <> "" AND $get_state[6] <> $Form2 Then
Local $hwnd2 = HWnd($get_state[6])
Local $process_Pid = WinGetProcess($hwnd2)
Local $process_name = _get_process_name($process_Pid)
_toggle_hooker()
Local $show_selection = _show_curent_selections()
if $show_selection[1] < 2 Then
$question2 = _msgBox_Close_Process($get_state[0], $process_name, $process_Pid)
if $question2 = 1 then ; treba da napravis da se uniste vise procesa odjednom ako je vise itema selektovano na listi
ProcessClose($process_name)
_GUICtrlListView_DeleteItem(GUICtrlGetHandle($listt), $get_state[4])
EndIf
Else
Local $imena[1][2]
Local $string_split = StringSplit($show_selection[0], "|")
ReDim $imena[$string_split[0]+1][2]
for $j = 1 to $string_split[0]
$imena[$j][0] = _GUICtrlListView_GetItemText($listt, Number($string_split[$j]), 0)
$imena[$j][1] = _GUICtrlListView_GetItemText($listt, Number($string_split[$j]), 6)
Next
for $i = 1 to $string_split[0]
Local $2nd_process_name = $imena[$i][0]
Local $hwnd3 = HWnd($imena[$i][1])
$process_Pid = WinGetProcess($2nd_process_name)
$process_name = _get_process_name($process_Pid)
$question2 = _msgBox_Close_Process($2nd_process_name, $process_name, $process_Pid)
if $question2 = 1 then ; treba da napravis da se uniste vise procesa odjednom ako je vise itema selektovano na listi
ProcessClose($process_name)
_refresh_list()
EndIf
Next
EndIf
_toggle_hooker()
Else
SoundPlay(@WindowsDir & "\media\ding.wav",0)
EndIf
EndFunc

func _msgBox_Close_Process($window_name2, $process_name2, $process_pid2)
opt("GUIOnEventMode", False)
Local $readings
Local $mouse_position = MouseGetPos()
Local $form2_position = WinGetPos($Form2)
Local $form4 = GUICreate("Kill Process", 300, 140, $form2_position[0]+$form2_position[2]/2-150, $form2_position[1]+$form2_position[3]/2-70, $WS_POPUP, $WS_EX_TOPMOST)
GUISetIcon("shell32.dll", 28)
Local $i_label_form4 = GUICtrlCreateLabel("Window name:" & @CRLF & "Process name:" & @CRLF & "Process ID (PID):", 10, 55, 110, 51)
GUICtrlSetColor(-1, "0x003366")
GUICtrlSetFont(-1, 10, 400, 0, "Arial")
Local $i_label_form4_win_name = GUICtrlCreateLabel($window_name2, 125, 55, 165, 17)
GUICtrlSetColor(-1, "0x003366")
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
Local $i_label_form4_win_proc = GUICtrlCreateLabel($process_name2, 125, 72, 165, 17)
GUICtrlSetColor(-1, "0x003366")
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
Local $i_label_form4_win_pid = GUICtrlCreateLabel($process_pid2, 125, 89, 165, 17)
GUICtrlSetColor(-1, "0x003366")
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
GUISetBkColor("0x99ccff")
GUICtrlCreateGraphic(0, 0, 300, 140, $SS_BLACKFRAME)
GUICtrlSetColor(-1, 0)
GUICtrlCreateGraphic(3, 3, 294, 134, $SS_BLACKFRAME)
GUICtrlSetColor(-1, 0)
GUICtrlCreateIcon("shell32.dll", 28, 6, 7, 16, 16)
GUICtrlCreateLabel("Kill Process", 90, 4, 160, 20)
GUICtrlSetColor(-1, "0x003366")
GUICtrlSetFont(-1, 14, 400, 0, $font)
GUICtrlCreateLabel("Would you like to kill selected process?", 33-10, 30, 250+20, 20, $ES_CENTER)
GUICtrlSetColor(-1, "0x003366")
GUICtrlSetFont(-1, 10, 400, 0, "Arial")
Local $i_button_ok_form4 = GUICtrlCreateButton("Accept", 60, 110, 80, 20)
Local $i_button_cancel_form4 = GUICtrlCreateButton("&Cancel", 165, 110, 80, 20)
;~ DllCall($dll, "int", "AnimateWindow", "hwnd", $form4, "int", 200, "long", 0x00080000);fade-in
GUISetState(@SW_SHOW, $form4)
While 1
if WinActive($form2) then
WinActivate($form4)
SoundPlay(@WindowsDir & "\media\ding.wav",0)
endif
$nMsg = GUIGetMsg()
Switch $nMsg
case $i_button_ok_form4
opt("GUIOnEventMode", True)
DllCall($dll, "int", "AnimateWindow", "hwnd", $form4, "int", 200, "long", 0x00090000);fade-out
GUIDelete($form4)
Return 1
case $i_button_cancel_form4
opt("GUIOnEventMode", True)
DllCall($dll, "int", "AnimateWindow", "hwnd", $form4, "int", 200, "long", 0x00090000);fade-out
GUIDelete($form4)
Return 0
case $GUI_EVENT_PRIMARYDOWN
dllcall($dll,"int","SendMessage","hWnd", $form4,"int",0xA1,"int", 2,"int", 0)
EndSwitch
Sleep(10)
WEnd
EndFunc

func _get_process_name($i_pid)
Local $processes = ProcessList ()
for $k = 1 to $processes[0][0]
if $processes[$k][1] = $i_pid then ExitLoop
Next
Return $processes[$k][0]
EndFunc

func _Close_selected_window()
Local $question
Local $get_state = _get_item_substring()
if $get_state[6] <> "" AND $get_state[6] <> $form2 Then
Local $hwnd2 = HWnd($get_state[6])
_toggle_hooker()
Local $show_selection = _show_curent_selections()
if $show_selection[1] < 2 Then
$question = _msgBox_Close_Window($get_state[0])
if $question = 1 then
WinClose($hwnd2)
_GUICtrlListView_DeleteItem(GUICtrlGetHandle($listt), $get_state[4])
EndIf
Else
Local $imena[1][2]
Local $string_split = StringSplit($show_selection[0], "|")
ReDim $imena[$string_split[0]+1][2]
for $j = 1 to $string_split[0]
$imena[$j][0] = _GUICtrlListView_GetItemText($listt, Number($string_split[$j]), 0)
$imena[$j][1] = _GUICtrlListView_GetItemText($listt, Number($string_split[$j]), 6)
Next
for $i = 1 to $string_split[0]
Local $2nd_window_name = $imena[$i][0]
$question = _msgBox_Close_Window($2nd_window_name)
if $question = 1 then
WinClose(HWnd($imena[$i][1]))
_refresh_list()
EndIf
Next
EndIf
_toggle_hooker()
Else
SoundPlay(@WindowsDir & "\media\ding.wav",0)
EndIf
EndFunc

func _msgBox_Close_Window($win_name1)
opt("GUIOnEventMode", False)
Local $readings
Local $mouse_position = MouseGetPos()
Local $form2_position = WinGetPos($Form2)
Local $form4 = GUICreate("Close Window", 300, 123, $form2_position[0]+$form2_position[2]/2-150, $form2_position[1]+$form2_position[3]/2-61, $WS_POPUP, $WS_EX_TOPMOST)
GUISetIcon("shell32.dll", 26)
Local $i_label_form4 = GUICtrlCreateLabel($win_name1, 10, 55, 280, 34, $ES_CENTER)
GUICtrlSetColor(-1, "0x003366")
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
GUISetBkColor("0x99ccff")
GUICtrlCreateGraphic(0, 0, 300, 123, $SS_BLACKFRAME)
GUICtrlSetColor(-1, 0)
GUICtrlCreateGraphic(3, 3, 294, 117, $SS_BLACKFRAME)
GUICtrlSetColor(-1, 0)
GUICtrlCreateIcon("shell32.dll", 26, 6, 7, 16, 16)
GUICtrlCreateLabel("Close Window", 90, 4, 160, 20)
GUICtrlSetColor(-1, "0x003366")
GUICtrlSetFont(-1, 14, 400, 0, $font)
GUICtrlCreateLabel("Would you like to close selected window?", 33-10, 30, 250+10, 20, $ES_CENTER)
GUICtrlSetColor(-1, "0x003366")
GUICtrlSetFont(-1, 10, 400, 0, "Arial")
Local $i_button_ok_form4 = GUICtrlCreateButton("Accept", 60, 93, 80, 20)
Local $i_button_cancel_form4 = GUICtrlCreateButton("&Cancel", 165, 93, 80, 20)
;~ DllCall($dll, "int", "AnimateWindow", "hwnd", $form4, "int", 200, "long", 0x00080000);fade-in
GUISetState(@SW_SHOW, $form4)
While 1
if WinActive($form2) then
WinActivate($form4)
SoundPlay(@WindowsDir & "\media\ding.wav",0)
endif
$nMsg = GUIGetMsg()
Switch $nMsg
case $i_button_ok_form4
opt("GUIOnEventMode", True)
DllCall($dll, "int", "AnimateWindow", "hwnd", $form4, "int", 200, "long", 0x00090000);fade-out
GUIDelete($form4)
Return 1
case $i_button_cancel_form4
opt("GUIOnEventMode", True)
DllCall($dll, "int", "AnimateWindow", "hwnd", $form4, "int", 200, "long", 0x00090000);fade-out
GUIDelete($form4)
Return 0
case $GUI_EVENT_PRIMARYDOWN
dllcall($dll,"int","SendMessage","hWnd", $form4,"int",0xA1,"int", 2,"int", 0)
EndSwitch
Sleep(10)
WEnd
EndFunc

Func _Set_to_view_only_visible()
if $windows_visibility_list = False Then
$windows_visibility_list = True
GUICtrlSetState($view_visible, $GUI_UNCHECKED)
Else
$windows_visibility_list = False
GUICtrlSetState($view_visible, $GUI_CHECKED)
EndIf
_List_refreshing()
EndFunc

func _List_refreshing()
TrayTip("", "", 10)
_GUICtrlListView_DeleteAllItems(GUICtrlGetHandle($listt))
_DisplaySelection()
EndFunc

func _Sort_items()
_GUICtrlListView_SortItems($listt, GUICtrlGetState($listt))
EndFunc

func _Set_Transparency()
Local $get_state = _get_item_substring()
Local $hwnd2 = $get_state[6]
_toggle_hooker()
Local $percentage = _Window_Transparency($get_state[2], $hwnd2)
_toggle_hooker()
_GUICtrlListView_SetItem($listt, $percentage, $get_state[4], 2, 1)
EndFunc

func _Window_Transparency($Default, $hwnd)
Local $hwnd2 = HWnd($hwnd)
opt("GUIOnEventMode", False)
Local $readings
Local $mouse_position = MouseGetPos()
Local $form2_position = WinGetPos($Form2)
Local $form4 = GUICreate("Window Transparency", 260, 127, $form2_position[0]+$form2_position[2]/2-130, $form2_position[1]+$form2_position[3]/2-63, $WS_POPUP, $WS_EX_TOPMOST)
GUISetIcon("shell32.dll", 281)
GUISetBkColor("0x99ccff")
GUICtrlCreateGraphic(0, 0, 260, 127, $SS_BLACKFRAME)
GUICtrlSetColor(-1, 0)
GUICtrlCreateGraphic(3, 3, 254, 121, $SS_BLACKFRAME)
GUICtrlSetColor(-1, 0)
GUICtrlCreateIcon("shell32.dll", 281, 6, 7, 16, 16)
GUICtrlCreateLabel("Window Transparency", 25, 4, 223, 20)
GUICtrlSetColor(-1, "0x003366")
GUICtrlSetFont(-1, 14, 400, 0, $font)
GUICtrlCreateLabel("Select transparency percentage please:", 15, 30, 230, 17)
GUICtrlSetColor(-1, "0x003366")
GUICtrlSetFont(-1, 10, 400, 0, "Arial")
Local $i_button_ok_form4 = GUICtrlCreateButton("&Accept", 22, 90, 80, 20)
Local $i_button_cancel_form4 = GUICtrlCreateButton("&Cancel", 160, 90, 80, 20)
Local $i_Slider_form4 = GUICtrlCreateSlider(15, 50, 230, 40)
GUICtrlSetLimit(-1,100,10)
GUICtrlSetBkColor(-1, "0xDFF3FE")
GUICtrlSetBkColor(-1, "0x99ccff")
GUICtrlSetData(-1, StringTrimRight($Default, 1))
Local $i_input_form41 = GUICtrlCreateInput(GUICtrlRead($i_Slider_form4) & "%", 110, 90, 43, 20, $ES_READONLY+$ES_CENTER)
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
GUICtrlSetBkColor(-1, "0xDFF3FE")
GUICtrlSetColor(-1, "0x003366")
DllCall($dll, "int", "AnimateWindow", "hwnd", $form4, "int", 200, "long", 0x00080000);fade-in
GUISetState(@SW_SHOW)
ControlFocus($form4, "", $i_button_ok_form4)
Local $old_readdings
WinSetTrans($hwnd2, "", 254)
While 1
Local $new_readdings = GUICtrlRead($i_Slider_form4)
if $old_readdings <> $new_readdings then
Local $racunanje = $new_readdings*255/100
if $new_readdings <> 100 then
WinSetTrans($hwnd2, "", $racunanje)
Else
WinSetTrans($hwnd2, "", 254)
EndIf
GUICtrlSetData($i_input_form41, $new_readdings & "%")
$old_readdings = $new_readdings
EndIf
if WinActive($form2) then
WinActivate($form4)
SoundPlay(@WindowsDir & "\media\ding.wav",0)
endif
$nMsg = GUIGetMsg()
Switch $nMsg
case $i_button_ok_form4
opt("GUIOnEventMode", True)
if $new_readdings = 100 then WinSetTrans($hwnd2, "", 255)
DllCall($dll, "int", "AnimateWindow", "hwnd", $form4, "int", 200, "long", 0x00090000);fade-out
GUIDelete($form4)
Return $new_readdings & "%"
case $i_button_cancel_form4
opt("GUIOnEventMode", True)
WinSetTrans($hwnd2, "", StringTrimRight($Default, 1)*255/100)
DllCall($dll, "int", "AnimateWindow", "hwnd", $form4, "int", 200, "long", 0x00090000);fade-out
GUIDelete($form4)
Return $Default
case $GUI_EVENT_PRIMARYDOWN
dllcall($dll,"int","SendMessage","hWnd", $form4,"int",0xA1,"int", 2,"int", 0)
EndSwitch
Sleep(10)
WEnd
EndFunc

func _Set_self_rename()
Local $get_state = _get_item_substring()
;~ TrayTip("ok", $get_state[7], 10)
if $get_state[6] <> "" AND $get_state[6] <> $form2 Then
Local $auto_rename = True
;~ TrayTip("ok", $get_state[7], 10)
if $get_state[7] = "Disallow" then $auto_rename = False
Local $hwnd2 = HWnd($get_state[6]);WinGetHandle($get_state[0])
if $auto_rename = True Then
_GUICtrlListView_SetItem($listt, "Disallow", $get_state[4], 4, 2)
Else
_GUICtrlListView_SetItem($listt, "Allow", $get_state[4], 4, 0)
EndIf
Else
SoundPlay(@WindowsDir & "\media\ding.wav",0)
EndIf
EndFunc

func _Set_visibility()
Local $get_state = _get_item_substring()
Local $visibility = True
if $get_state[6] <> "" AND $get_state[6] <> $form2 Then
if $get_state[3] = "No" then $visibility = False
Local $hwnd2 = HWnd($get_state[6])
_toggle_hooker()
if $visibility = True Then
_GUICtrlListView_SetItem($listt, "No", $get_state[4], 3, 2)
if $remove_hidden = False then _ArrayAdd($do_not_remove_list, $hwnd2)
WinSetState($hwnd2, "", @SW_HIDE)
Else
Local $index = _ArraySearch($do_not_remove_list, $hwnd2)
if Not @error Then _ArrayDelete($do_not_remove_list, $index)
_GUICtrlListView_SetItem($listt, "Yes", $get_state[4], 3, 0)
WinSetState($hwnd2, "", @SW_SHOW)
EndIf
_toggle_hooker()
_set_above_win()
Else
SoundPlay(@WindowsDir & "\media\ding.wav",0)
EndIf
EndFunc

func _set_above_win()
Local $get_state = _get_item_substring()
for $i = 0 to _GUICtrlListView_GetItemCount($listt)
if _GUICtrlListView_GetItemText($listt, $i, 6) = $form2 Then ExitLoop
Next
if _GUICtrlListView_GetItemText($listt, $i, 1) = "Yes" Then WinSetOnTop($Form2, "", 1)
EndFunc

func _Set_on_top_Window()
Local $get_state = _get_item_substring()
if $get_state[6] <> "" then;AND $get_state[6] <> $form2 Then
Local $on_top = True
if $get_state[1] = "No" then $on_top = False
Local $hwnd2 = HWnd($get_state[6]);WinGetHandle($get_state[0])
if $on_top = False Then
_GUICtrlListView_SetItem($listt, "Yes", $get_state[4], 1, 0)
WinSetOnTop($hwnd2, "", 1)
Else
_GUICtrlListView_SetItem($listt, "No", $get_state[4], 1, 2)
WinSetOnTop($hwnd2, "", 0)
EndIf
_set_above_win()
Else
SoundPlay(@WindowsDir & "\media\ding.wav",0)
EndIf
EndFunc

func _get_item_substring($handle = "")
dim $display2[8]
;~ $readings = GUICtrlRead($listt, 0)
for $i = 0 to _GUICtrlListView_GetItemCount($listt)
if $handle = "" then
if _GUICtrlListView_GetItemSelected($listt, $i) = true Then
$display2[0] = _GUICtrlListView_GetItemText($listt, $i) ;total count
$display2[1] = _GUICtrlListView_GetItemText($listt, $i, 1) ;window name
$display2[2] = _GUICtrlListView_GetItemText($listt, $i, 2) ;on top
$display2[3] = _GUICtrlListView_GetItemText($listt, $i, 3) ;transparent
$display2[4] = $i ;current count
$display2[5] = _GUICtrlListView_GetItemText($listt, $i, 5) ;window's exe.
$display2[6] = _GUICtrlListView_GetItemText($listt, $i, 6) ;win's hwnd
$display2[7] = _GUICtrlListView_GetItemText($listt, $i, 4) ;allow self-renaming
ExitLoop
EndIf
Else
if _GUICtrlListView_GetItemText($listt, $i, 6) = $handle Then
$display2[0] = _GUICtrlListView_GetItemText($listt, $i) ;total count
$display2[1] = _GUICtrlListView_GetItemText($listt, $i, 1) ;window name
$display2[2] = _GUICtrlListView_GetItemText($listt, $i, 2) ;on top
$display2[3] = _GUICtrlListView_GetItemText($listt, $i, 3) ;transparent
$display2[4] = $i ;current count
$display2[5] = _GUICtrlListView_GetItemText($listt, $i, 5) ;window's exe
$display2[6] = _GUICtrlListView_GetItemText($listt, $i, 6) ;win's hwnd
$display2[7] = _GUICtrlListView_GetItemText($listt, $i, 4) ;allow self-renaming
ExitLoop
EndIf
EndIf
Next
Return $display2
EndFunc

func _Rename_Window()
Local $get_win = _get_item_substring()
if $get_win[6] <> "" AND $get_win[6] <> $form2 Then
Local $hwnd2 = HWnd($get_win[6]);WinGetHandle($get_win[0])
_toggle_hooker()
Local $new_name = _My_Input_Box($get_win[0])
_toggle_hooker()
if $new_name <> -1 then
;~ MsgBox(0, "ok", $hwnd2 & ", " & $get_win[6])
$allow_renaming_global = false
WinSetTitle($hwnd2, "", $new_name)
_GUICtrlListView_SetItem($listt, $new_name, $get_win[4])
_set_above_win()
EndIf
$allow_renaming_global = true
Else
SoundPlay(@WindowsDir & "\media\ding.wav",0)
EndIf
EndFunc

func _My_Input_Box($Default)
opt("GUIOnEventMode", False)
Local $readings
Local $mouse_position = MouseGetPos()
Local $form2_position = WinGetPos($Form2)
Local $form4 = GUICreate("", 200, 133, $form2_position[0]+$form2_position[2]/2-100, $form2_position[1]+$form2_position[3]/2-66, $WS_POPUP, $WS_EX_TOPMOST)
GUISetIcon("shell32.dll", 24)
Local $i_input_form4 = GUICtrlCreateInput($Default, 15, 70, 170, 20, $ES_CENTER+$ES_AUTOHSCROLL)
GUICtrlSetBkColor(-1, "0xDFF3FE")
GUICtrlSetColor(-1, "0x003366")
GUICtrlSetFont(-1, 10, 400, 0, "Arial")
GUISetBkColor("0x99ccff")
GUICtrlCreateGraphic(0, 0, 200, 133, $SS_BLACKFRAME)
GUICtrlSetColor(-1, 0)
GUICtrlCreateGraphic(3, 3, 194, 127, $SS_BLACKFRAME)
GUICtrlSetColor(-1, 0)
GUICtrlCreateIcon("shell32.dll", 24, 6, 7, 16, 16)
GUICtrlCreateLabel("Rename Window", 25, 4, 160, 20)
GUICtrlSetColor(-1, "0x003366")
GUICtrlSetFont(-1, 14, 400, 0, $font)
GUICtrlCreateLabel("Type new name for selected" & @CRLF &" window please:", 15, 30, 180, 37)
GUICtrlSetColor(-1, "0x003366")
GUICtrlSetFont(-1, 10, 400, 0, "Arial")
Local $i_button_ok_form4 = GUICtrlCreateButton("Accept", 15, 100, 80, 20)
Local $i_button_cancel_form4 = GUICtrlCreateButton("&Cancel", 105, 100, 80, 20)
;~ DllCall($dll, "int", "AnimateWindow", "hwnd", $form4, "int", 200, "long", 0x00080000);fade-in
GUISetState(@SW_SHOW)
While 1
if WinActive($form2) then
WinActivate($form4)
SoundPlay(@WindowsDir & "\media\ding.wav",0)
endif
if ControlGetFocus($form4) = "Edit1" AND _IsPressed("0D", $dll) then
$readings = GUICtrlRead($i_input_form4)
opt("GUIOnEventMode", True)
DllCall($dll, "int", "AnimateWindow", "hwnd", $form4, "int", 200, "long", 0x00090000);fade-out
GUIDelete($form4)
Return $readings
EndIf
$nMsg = GUIGetMsg()
Switch $nMsg
case $i_button_ok_form4
$readings = GUICtrlRead($i_input_form4)
opt("GUIOnEventMode", True)
GUIDelete($form4)
Return $readings
case $i_button_cancel_form4
;~ DllClose($dll)
opt("GUIOnEventMode", True)
DllCall($dll, "int", "AnimateWindow", "hwnd", $form4, "int", 200, "long", 0x00090000);fade-out
GUIDelete($form4)
;~ $readings = ""
Return -1;$readings
case $GUI_EVENT_PRIMARYDOWN
dllcall($dll,"int","SendMessage","hWnd", $form4,"int",0xA1,"int", 2,"int", 0)
EndSwitch
Sleep(10)
WEnd
EndFunc

Func Drag()
dllcall($dll,"int","SendMessage","hWnd", $Form2,"int",0xA1,"int", 2,"int", 0)
EndFunc

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

func _get_current_window_list()
Local $return_array_current[1]
$return_array_current[0] = 0
Local $n = 0
$var = WinList()
For $i = 1 to $var[0][0]
If $var[$i][0] <> "Program manager" then
Local $visible_window = IsVisible($var[$i][1])
if $windows_visibility_list = True then
If $var[$i][0] <> "" then
$n += 1
ReDim $return_array_current[$n+1]
$return_array_current[$n] = $var[$i][1]
EndIf
Else
If $var[$i][0] <> "" AND $visible_window Then
$n += 1
ReDim $return_array_current[$n+1]
$return_array_current[$n] = $var[$i][1]
EndIf
EndIf
EndIf
Next
$return_array_current[0] = $n
Return $return_array_current
EndFunc

func _get_old_window_list()
Local $u = 0
Local $old_count = _GUICtrlListView_GetItemCount($listt)
Local $return_array_old[$old_count+1]
$return_array_old[0] = 0
for $h = 1 to $old_count
$return_array_old[$h] = _GUICtrlListView_GetItemText($listt, $u, 6)
$u += 1
Next
$return_array_old[0] = $old_count
Return $return_array_old
EndFunc

func _add_window($handle7, $title)
Local $visible_window = IsVisible($handle7)
_AddingItems($title, _GUICtrlListView_GetItemCount($listt), $visible_window, $handle7)
;~ _GUICtrlListView_SetImageList($listt, $hImage, 1)
;~ _set_icons()
EndFunc

func _delete_window($handle, $title)
Local $something = False
Local $something2
Local $hIcons1;, $hIcons2
for $i = 0 to _GUICtrlListView_GetItemCount($listt)
if _GUICtrlListView_GetItemText($listt, $i, 6) = $handle Then
$something = True
$something2 = $i
ExitLoop
EndIf
Next
if $something = True then
;~ $remove_hidden
;~ _ArraySearch($do_not_remove_list, $handle)
;~ if @error then
;~ MsgBox(262144, "pre", _GUIImageList_GetImageCount($hImage))
;~ Hex($hIcons[0])
if $remove_hidden = False Then
;~ _TrayTip(-1, "ok", "false", 10)
_ArraySearch($do_not_remove_list, $handle)
if @error Then
_GUICtrlListView_DeleteItem(GUICtrlGetHandle($listt), $something2)
;~ $hIcons1 = _GUIImageList_GetIcon($hImage, $something2+5)
;~ MsgBox(262144, "icon handle", "0x" & Hex($hIcons1))
;~ $hIcons2 = _GUIImageList_GetIcon($hImage, $something2+6)
;~ MsgBox(262144, "ok", _GUIImageList_DestroyIcon($hIcons1))
;~ _GUIImageList_DestroyIcon($hIcons2)
EndIf
Else
;~ _TrayTip(-1, "ok", "true", 10)
_GUICtrlListView_DeleteItem(GUICtrlGetHandle($listt), $something2)
;~ $hIcons1 = _GUIImageList_GetIcon($hImage, $something2+5)
;~ $hIcons2 = _GUIImageList_GetIcon($hImage, $something2+6)
;~ _GUIImageList_DestroyIcon($hIcons1)
;~ _GUIImageList_DestroyIcon($hIcons2)
EndIf
;~ _set_icons()
;~ MsgBox(262144, "posle", _GUIImageList_GetImageCount($hImage))
;~ EndIf
EndIf
EndFunc

func _change_title_window($handle, $title)
Local $item_index = 9999999
;~ Local $get_state = _get_item_substring()
for $w = 0 to _GUICtrlListView_GetItemCount($listt)-1
if _GUICtrlListView_GetItemText($listt, $w, 6) = $handle Then
$item_index = $w
ExitLoop
endif
Next
if $item_index <> 9999999 then
if _GUICtrlListView_GetItemText($listt, $item_index, 4) = "Allow" then
_GUICtrlListView_SetItemText($listt, $item_index, $title)
Else
if $allow_renaming_global = true Then
WinSetTitle($handle, "", _GUICtrlListView_GetItemText($listt, $item_index, 0))
Sleep(10)
EndIf
EndIf
EndIf
EndFunc

;~ func _set_icons()
;~ Local $get_curent_count = _get_old_window_list()
;~ _GUIImageList_Remove($hImage)
;~ _GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 146)
;~ _GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 171)
;~ _GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 131)
;~ _GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 24)
;~ _GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 165)
;~ for $p = 0 to $get_curent_count[0]-1
;~ Local $icon_exists = _GetIconCount(_GUICtrlListView_GetItemText($listt, $p, 5))
;~ if _GUICtrlListView_GetItemText($listt, $p, 5) <> @WindowsDir & "\Explorer.exe" Then
;~ if $icon_exists <> 0 then
;~ _GUIImageList_AddIcon($hImage, _GUICtrlListView_GetItemText($listt, $p, 5))
;~ Else
;~ _GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 2)
;~ EndIf
;~ Else
;~ _GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 4)
;~ EndIf
;~ Next
;~ _GUICtrlListView_SetImageList($hImage, $hImage, 1)
;~ EndFunc

func _refresh_list()
Local $new_list = _get_current_window_list()
Local $old_list = _get_old_window_list()
for $i = 1 to $new_list[0]
_ArraySearch($old_list, $new_list[$i])
if @error then
_add_window($new_list[$i], WinGetTitle($new_list[$i]))
;~ _set_icons()
EndIf
Next
for $i = 1 to $old_list[0]
_ArraySearch($new_list, $old_list[$i])
if @error Then
_delete_window($old_list[$i], WinGetTitle($old_list[$i]))
;~ _set_icons()
EndIf
Next
EndFunc

While 1
if $realtime_refresh = true then
if WinGetState($form2) <> 5 Then
if $real_time_refresh = true Then
_refresh_list()
;~ _set_icons()
Sleep($refresh_rate_interval)
EndIf
EndIf
EndIf
Sleep(10)
WEnd

func _exit1()
_GUICtrlListView_UnRegisterSortCallBack($listt)
DllClose($dll)
DllCall($dll, "int", "AnimateWindow", "hwnd", $form2, "int", $fade_effect, "long", 0x00090000);fade-out
_TrayIconDelete($nTrayIcon1)
Exit
EndFunc

Func _GetIconCount($sFilename)
Local $iCount= DllCall("Shell32", "int", "ExtractIconEx", "str", $sFilename, "int", -1, "ptr", 0, "ptr", 0, "int", 1)
If not @error Then Return $iCount[0]
Return 0
EndFunc

func _AddingItems($Name, $number, $visibility2 = 1, $handlee = 0)
if $Name <> "Program Manager" Then
$path = _WinGetPath(WinGetProcess($Name))
$icon_exists = _GetIconCount($path)
;~ MsgBox(262144, "", $icon_exists & ', ' & $path)
if $path <> @WindowsDir & "\Explorer.exe" then; AND $icon_exists <> 0 then
if $icon_exists <> 0 then
_GUIImageList_AddIcon($hImage, $path)
if @error then _GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 4)
Else
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 2)
EndIf
Else
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 4)
EndIf

_GUICtrlListView_AddItem($listt, $Name, _GUIImageList_GetImageCount($hImage)-1, _GUICtrlListView_GetItemCount($listt)+999)

if _get_on_top_attribute($handlee) Then
_GUICtrlListView_AddSubItem($listt, $number, "Yes", 1, 0)
Else
_GUICtrlListView_AddSubItem($listt, $number, "No", 1, 2)
EndIf
Local $trans = _WinGetTrans($handlee)
_GUICtrlListView_AddSubItem($listt, $number, $trans & "%", 2, 1)
_GUICtrlListView_AddSubItem($listt, $number, $handlee, 6, 4)
_GUICtrlListView_AddSubItem($listt, $number, "Allow", 4, 0)
if $visibility2 = 1 then
_GUICtrlListView_AddSubItem($listt, $number, "Yes", 3, 0)
ElseIf $visibility2 = 0 then
_GUICtrlListView_AddSubItem($listt, $number, "No", 3, 2)
EndIf
if $path <> "0" then
_GUICtrlListView_AddSubItem($listt, $number, $path, 5, 3)
Else
_GUICtrlListView_AddSubItem($listt, $number, "- Error - Could not be retrieved", 5, 2)
EndIf
EndIf
EndFunc

Func _WinGetTrans($hWnd)
If Not $hWnd Then Return -1
Local $aRet = DllCall($dll, "int", "GetLayeredWindowAttributes", "hwnd", $hWnd, "ptr", 0, "int*", 0, "ptr", 0)
If @error Or Not $aRet[1] Then Return -1
If $aRet[0]<1 Then $aRet[3]=255 ; If $aRet[0] is 0 and other keys exist, the window is NOT transparent regardless of $aRet[3]'s value
Local $return = Round($aRet[3]*100/255)
Return $return
EndFunc

func _get_on_top_attribute($window_handle)
Local $value
Local $handle3 = HWnd($window_handle);WinGetHandle($window_name)
Local $get3 = _WinAPI_GetWindowLong($handle3, $GWL_EXSTYLE)
Local $last3 = StringRight(Hex($get3), 2)
if StringTrimLeft($last3, 1) = 8 Then
$value = 1
Else
$value = 0
EndIf
Return $value
EndFunc

func _DisplaySelection()
Local $b = 0
_GUIImageList_Remove($hImage)
;~ _GUICtrlListView_SetImageList($listt, $hImage, 1)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 146) ;yes icon = 0
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 171) ;trans icon = 1
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 131) ;no icon = 2
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 24) ;path icon = 3
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 165) ;hwnd icon = 4
$var = WinList()
For $i = 1 to $var[0][0]
Local $visible_window = IsVisible($var[$i][1])
if $windows_visibility_list = True then
If $var[$i][0] <> "" then; AND $visible_window Then
_AddingItems($var[$i][0], $b, $visible_window, $var[$i][1])
$b += 1
EndIf
Else
If $var[$i][0] <> "" AND $visible_window Then
_AddingItems($var[$i][0], $b, $visible_window, $var[$i][1])
$b += 1
EndIf
_ArraySearch($do_not_remove_list, $var[$i][1])
if NOT @error Then
_AddingItems($var[$i][0], $b, 0, $var[$i][1])
$b += 1
EndIf
EndIf
Next
_GUICtrlListView_SetImageList($listt, $hImage, 1)
Local $position = WinGetPos($form2)
Local $trans_text1 = _TransparentTextWindow("MyTextGUI", "List updated", $position[2]/1.16, $position[2]/8, 1, 1, $font, 400, 0x003366, 1, -1, -1, 1, False)
Local $position2 = WinGetPos($trans_text1)
WinMove($trans_text1, "", $position[0]+$position[2]/2-$position2[2]/2, $position[1]+$position[3]/2-$position2[3]/2)
;~ WinSetTrans($trans_text1, "", 180)
WinSetOnTop($trans_text1, "", 1)
Local $transss = 254
for $i = 1 to 10
$transss-=10
WinSetTrans($form2, "", $transss)
Next
DllCall($dll, "int", "AnimateWindow", "hwnd", $trans_text1, "int", 300, "long", 0x00080000);fade-in
GUISetState(@SW_SHOW, $trans_text1)
Local $timer1 = TimerInit()
do
Until TimerDiff($timer1) >= 800
DllCall($dll, "int", "AnimateWindow", "hwnd", $trans_text1, "int", 300, "long", 0x00090000);fade-out
GUIDelete($trans_text1)
for $i = 1 to 10
$transss+=10
WinSetTrans($form2, "", $transss)
Next
EndFunc

Func _TransparentTextWindow($h_WinTitle, $s_WinText, $i_WinWidth, $i_WinHeight, $i_WinXPosn = -1, $i_WinYPosn = -1, _
$s_TextFont = -1, $i_FontWeight = -1, $v_FontColor = -1, $i_FontItalics = 0, $i_FontUnderline = 0, $i_FontStrikeOut = 0, $i_Taskbar = 0, $i_WinExist = False, $i_hwnd = 0)
Local Const $DEFAULT_CHARSET = 0 ; ANSI character set
Local Const $OUT_CHARACTER_PRECIS = 2
Local Const $CLIP_DEFAULT_PRECIS = 0
Local Const $PROOF_QUALITY = 2
Local Const $FIXED_PITCH = 1
Local Const $RGN_XOR = 3
If $h_WinTitle = "" Then $h_WinTitle = "Notice"
If $s_WinText = "" Then $s_WinText = "Error"
If $i_WinWidth < 1 Or $i_WinWidth > @DesktopWidth Then SetError(1)
If $i_WinHeight < 1 Or $i_WinHeight > @DesktopHeight Then SetError(1)
If $i_WinXPosn = -1 Then $i_WinXPosn = (@DesktopWidth / 2) - ($i_WinWidth / 2)
If $i_WinYPosn = -1 Then $i_WinYPosn = (@DesktopHeight / 2) - ($i_WinHeight / 2)
If $i_WinXPosn < 1 Or $i_WinXPosn > (@DesktopWidth - $i_WinWidth) Then SetError(1)
If $i_WinYPosn < 1 Or $i_WinYPosn > (@DesktopHeight - $i_WinHeight) Then SetError(1)
If @error Then Return
If $s_TextFont = "" Or $s_TextFont = -1 Then $s_TextFont = "Microsoft Sans Serif"
If $i_FontWeight = "" Or $i_FontWeight = -1 Then $i_FontWeight = 450
If $v_FontColor = "" Or $v_FontColor = -1 Then $v_FontColor = "0xFF0000"
If $i_FontItalics <> 1 Then $i_FontItalics = 0
If $i_FontUnderline <> 1 Then $i_FontUnderline = 0
If $i_FontStrikeOut <> 1 Then $i_FontStrikeOut = 0
If $i_Taskbar <> 1 Then
if $i_WinExist = False Then
Local $h_GUI = GUICreate($h_WinTitle, $i_WinWidth, $i_WinHeight, $i_WinXPosn, _
$i_WinYPosn, $WS_POPUP, BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW))
Else
Local $h_GUI = WinGetHandle($i_hwnd)
EndIf
Else ; hide tray icon
if $i_WinExist = False Then
Local $h_GUI = GUICreate($h_WinTitle, $i_WinWidth, $i_WinHeight, $i_WinXPosn, _
$i_WinYPosn, $WS_POPUP, BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW))
Else
Local $h_GUI = WinGetHandle($i_hwnd)
EndIf
EndIf
GUISetBkColor($v_FontColor)
Local $hDC = DllCall($dll, "int", "GetDC", "hwnd", $h_GUI)
Local $hMyFont = DllCall("gdi32.dll", "hwnd", "CreateFont", "int", $i_WinHeight, _
"int", 0, "int", 0, "int", 0, "int", $i_FontWeight, "int", $i_FontItalics, _
"int", $i_FontUnderline, "int", $i_FontStrikeOut, "int", $DEFAULT_CHARSET, _
"int", $OUT_CHARACTER_PRECIS, "int", $CLIP_DEFAULT_PRECIS, _
"int", $PROOF_QUALITY, "int", $FIXED_PITCH, "str", $s_TextFont)
Local $hOldFont = DllCall("gdi32.dll", "hwnd", "SelectObject", "int", $hDC[0], _
"hwnd", $hMyFont[0])
DllCall("gdi32.dll", "int", "BeginPath", "int", $hDC[0])
DllCall("gdi32.dll", "int", "TextOut", "int", $hDC[0], "int", 0, "int", 0, _
"str", $s_WinText, "int", StringLen($s_WinText))
DllCall("gdi32.dll", "int", "EndPath", "int", $hDC[0])
Local $hRgn1 = DllCall("gdi32.dll", "hwnd", "PathToRegion", "int", $hDC[0])
Local $rc = DllStructCreate("int;int;int;int")
DllCall("gdi32.dll", "int", "GetRgnBox", "hwnd", $hRgn1[0], _
"ptr", DllStructGetPtr($rc))
Local $hRgn2 = DllCall("gdi32.dll", "hwnd", "CreateRectRgnIndirect", _
"ptr", DllStructGetPtr($rc))
DllCall("gdi32.dll", "int", "CombineRgn", "hwnd", $hRgn2[0], "hwnd", $hRgn2[0], _
"hwnd", $hRgn1[0], "int", $RGN_XOR)
DllCall("gdi32.dll", "int", "DeleteObject", "hwnd", $hRgn1[0])
DllCall($dll, "int", "ReleaseDC", "hwnd", $h_GUI, "int", $hDC[0])
DllCall($dll, "int", "SetWindowRgn", "hwnd", $h_GUI, "hwnd", $hRgn2[0], "int", 1)
DllCall("", "int", "SelectObject", "int", $hDC[0], "hwnd", $hOldFont[0])
Return $h_GUI
EndFunc

Func IsVisible($handle)
If BitAnd( WinGetState($handle), 2 ) Then
Return 1
Else
Return 0
EndIf
EndFunc

Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
#forceref $hWnd, $iMsg, $iwParam
Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView, $tInfo
;~ Local $tBuffer
$hWndListView = $listt
If Not IsHWnd($listt) Then $hWndListView = GUICtrlGetHandle($listt)

$tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
$hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
$iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
$iCode = DllStructGetData($tNMHDR, "Code")
Switch $hWndFrom
Case $hWndListView
Switch $iCode
;~ Case $LVN_COLUMNCLICK ; A column was clicked
;~ $tInfo = DllStructCreate($tagNMLISTVIEW, $ilParam)
;~ MsgBox(0, "ok", "kolona")
;~ Case $LVN_KEYDOWN ; A key has been pressed
;~ $tInfo = DllStructCreate($tagNMLVKEYDOWN, $ilParam)
;~ MsgBox(0, "ok", "key")
;~ Case $NM_CLICK ; Sent by a list-view control when the user clicks an item with the left mouse button
;~ $tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
;~ $readings = GUICtrlRead($listt, 1)
;~ for $i = 0 to _GUICtrlListView_GetItemCount($listt)
;~ if _GUICtrlListView_GetItemSelected($listt, $i) = true Then
;~ $display = _GUICtrlListView_GetItemText($listt, $i)
;~ ExitLoop
;~ EndIf
;~ Next
;~ if $display <> " " Then _display_form3($display[6]);MsgBox(0, "ok", $display)

Case $NM_DBLCLK ; Sent by a list-view control when the user double-clicks an item with the left mouse button
$tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
$tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)

_win_set_active()

;~ Local $cooool = _Left_Click_on_listItem() ;izbaci sliku
;~ if $cooool <> " " Then _display_form3($display[6]);MsgBox(0, "ok", $display)



;~ $readings = GUICtrlRead($listt, 1)
;~ for $i = 0 to _GUICtrlListView_GetItemCount($listt)
;~ if _GUICtrlListView_GetItemSelected($listt, $i) = true Then
;~ $display = _GUICtrlListView_GetItemText($listt, $i)
;~ ExitLoop
;~ EndIf
;~ Next
;~ if $display <> " " Then _display_form3($display[6])
;~ MsgBox(0, "ok", "dupli levi klik na item")
;~ Case $NM_KILLFOCUS ; The control has lost the input focus
Case $NM_RCLICK ; Sent by a list-view control when the user clicks an item with the right mouse button
$tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
ShowMenu($Form2, $listt, $list_context)
Return 0 ; allow the default processing
;~ Case $NM_RDBLCLK ; Sent by a list-view control when the user double-clicks an item with the right mouse button
;~ $tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
;~ Case $NM_RETURN ; The control has the input focus and that the user has pressed the ENTER key
;~ Case $NM_SETFOCUS ; The control has received the input focus
EndSwitch
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_NOTIFY

func _win_set_active()
Local $nestoo = _Left_Click_on_listItem()
Local $hwnd2 = HWnd($nestoo);WinGetHandle($nestoo)
if WinGetState($hwnd2) = 16 Then
WinSetState($hwnd2, "", @SW_RESTORE)
EndIf
WinActivate($hwnd2)
EndFunc

func _Left_Click_on_listItem()
Local $display = ""
$readings = GUICtrlRead($listt, 1)
for $i = 0 to _GUICtrlListView_GetItemCount($listt)
if _GUICtrlListView_GetItemSelected($listt, $i) = true Then
$display = _GUICtrlListView_GetItemText($listt, $i, 6)
ExitLoop
EndIf
Next
Return $display; <> " " Then _display_form3($display[6]);MsgBox(0, "ok", $display)
EndFunc

func _show_curent_selections()
Local $rezultati[2]
$rezultati[0] = ""
$rezultati[1] = 0
for $i = 0 to _GUICtrlListView_GetItemCount($listt)
if _GUICtrlListView_GetItemSelected($listt, $i) = true Then
if $rezultati[0] = "" Then
$rezultati[0] &= $i
$rezultati[1] += 1
Else
$rezultati[0] &= "|" & $i
$rezultati[1] += 1
EndIf
EndIf
Next
Return $rezultati
EndFunc

Func ShowMenu($hWnd, $CtrlID, $nContextID)
Local $show_selection = _show_curent_selections()
if $show_selection[1] < 2 Then
GUICtrlSetState($Refresh_List, $GUI_ENABLE)
GUICtrlSetState($view_visible, $GUI_ENABLE)
Local $get_item = _get_item_substring()
if $get_item[1] = "Yes" Then
GUICtrlSetState($Set_on_top_Window, $GUI_CHECKED)
Else
GUICtrlSetState($Set_on_top_Window, $GUI_UNCHECKED)
EndIf
if $get_item[3] = "Yes" Then
GUICtrlSetState($Set_visibility, $GUI_CHECKED)
Else
GUICtrlSetState($Set_visibility, $GUI_UNCHECKED)
EndIf
if $get_item[7] = "Allow" Then
GUICtrlSetState($Set_self_rename, $GUI_CHECKED)
Else
GUICtrlSetState($Set_self_rename, $GUI_UNCHECKED)
EndIf

if $get_item[6] = "" then
GUICtrlSetState($Rename_Window, $GUI_DISABLE)
GUICtrlSetState($Set_on_top_Window, $GUI_DISABLE)
GUICtrlSetState($Set_transparency, $GUI_DISABLE)
GUICtrlSetState($Set_visibility, $GUI_DISABLE)
GUICtrlSetState($Set_self_rename, $GUI_DISABLE)
GUICtrlSetState($go_to_folder, $GUI_DISABLE)
GUICtrlSetState($Kill_window, $GUI_DISABLE)
GUICtrlSetState($Kill_processs, $GUI_DISABLE)
Else
if $get_item[0] <> $Progname Then
GUICtrlSetState($Rename_Window, $GUI_ENABLE)
GUICtrlSetState($Set_on_top_Window, $GUI_ENABLE)
GUICtrlSetState($Set_visibility, $GUI_ENABLE)
GUICtrlSetState($Set_self_rename, $GUI_ENABLE)
GUICtrlSetState($Kill_window, $GUI_ENABLE)
GUICtrlSetState($Kill_processs, $GUI_ENABLE)
Else
GUICtrlSetState($Rename_Window, $GUI_DISABLE)
;~ GUICtrlSetState($Set_on_top_Window, $GUI_DISABLE)
GUICtrlSetState($Set_visibility, $GUI_DISABLE)
GUICtrlSetState($Set_self_rename, $GUI_DISABLE)
GUICtrlSetState($Kill_window, $GUI_DISABLE)
GUICtrlSetState($Kill_processs, $GUI_DISABLE)
EndIf
GUICtrlSetState($Set_transparency, $GUI_ENABLE)
GUICtrlSetState($go_to_folder, $GUI_ENABLE)
EndIf
Else
GUICtrlSetState($Refresh_List, $GUI_DISABLE)
GUICtrlSetState($view_visible, $GUI_DISABLE)
GUICtrlSetState($Rename_Window, $GUI_DISABLE)
GUICtrlSetState($Set_on_top_Window, $GUI_DISABLE)
GUICtrlSetState($Set_transparency, $GUI_DISABLE)
GUICtrlSetState($Set_visibility, $GUI_DISABLE)
GUICtrlSetState($Set_self_rename, $GUI_DISABLE)
GUICtrlSetState($go_to_folder, $GUI_DISABLE)
GUICtrlSetState($Kill_window, $GUI_ENABLE)
GUICtrlSetState($Kill_processs, $GUI_ENABLE)
EndIf

Local $arPos, $x, $y
Local $hMenu = GUICtrlGetHandle($nContextID)

$arPos = MouseGetPos()

$x = $arPos[0]+5
$y = $arPos[1]+5

TrackPopupMenu($hWnd, $hMenu, $x, $y)
;~ EndIf
EndFunc ;==>ShowMenu

Func TrackPopupMenu($hWnd, $hMenu, $x, $y)
DllCall($dll, "int", "TrackPopupMenuEx", "hwnd", $hMenu, "int", 0, "int", $x, "int", $y, "hwnd", $hWnd, "ptr", 0)
EndFunc ;==>TrackPopupMenu

Func SetBlueTrayColors()
_SetTrayBkColor(0xFFD8C0)
_SetTrayIconBkColor(0xEE8877)
_SetTrayIconBkGrdColor(0x703330)
_SetTraySelectBkColor(0x662222)
_SetTraySelectRectColor(0x4477AA)
_SetTraySelectTextColor(0xFFFFFF)
_SetTrayTextColor(0x000000)
EndFunc

$Total = DriveSpaceTotal( "e:\" )
$Free = DriveSpaceFree( "e:\" )
$Used = $Free
$Cspace = $Used / 1024
$Cspace = Round($Cspace,2)

Local $var = Ping("192.168.1.198", 250)
If $var Then; also possible: If @error = 0 Then ...

Else
MsgBox(4096, "Error", " PACS server not detected, -please check LAN/Network connectivity: Exiting,,", 10)
Exit

EndIf



#AutoIt3Wrapper_Res_Fileversion=1.1.0.0
://////=__=

#include

_GDIPlus_Startup()

$text = " " & @CRLF & @CRLF & "Amount of disk space free is " & $Cspace & " GB" & @CRLF & "Minimum 8GB disk space required " & @CRLF
$text &= @CRLF & "Current IP address is " & @IPAddress1
$text &= @CRLF & " Legal disclaimer optionally " & @CRLF & " " & @CRLF


$aaa = MyCustomMsgBox(" Status ", $text, 1)





Func MyCustomMsgBox($MTTL, $MTXT, $MBTS = 1, $MICO = "", $MPAR = "", $MTIM = "")
Local $SKIN = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\MBoxSkin.png")
Local $SImgA[9] = [_GDIPlus_BitmapCloneArea($SKIN, 1, 1, 20, 20, 0x0026200A), _GDIPlus_BitmapCloneArea($SKIN, 22, 1, 15, 20, 0x0026200A), _
_GDIPlus_BitmapCloneArea($SKIN, 38, 1, 20, 20, 0x0026200A), _GDIPlus_BitmapCloneArea($SKIN, 1, 22, 20, 15, 0x0026200A), _
_GDIPlus_BitmapCloneArea($SKIN, 22, 22, 15, 15, 0x0026200A), _GDIPlus_BitmapCloneArea($SKIN, 38, 22, 20, 15, 0x0026200A), _
_GDIPlus_BitmapCloneArea($SKIN, 1, 38, 20, 25, 0x0026200A), _GDIPlus_BitmapCloneArea($SKIN, 22, 38, 15, 25, 0x0026200A), _
_GDIPlus_BitmapCloneArea($SKIN, 38, 38, 20, 25, 0x0026200A)]
Local $ImgAA[12] = [_GDIPlus_BitmapCloneArea($SKIN, 59, 1, 15, 45, 0x0026200A), _GDIPlus_BitmapCloneArea($SKIN, 75, 1, 10, 45, 0x0026200A), _
_GDIPlus_BitmapCloneArea($SKIN, 86, 1, 15, 45, 0x0026200A), _GDIPlus_BitmapCloneArea($SKIN, 102, 1, 15, 38, 0x0026200A), _
_GDIPlus_BitmapCloneArea($SKIN, 118, 1, 10, 38, 0x0026200A), _GDIPlus_BitmapCloneArea($SKIN, 129, 1, 15, 38, 0x0026200A), _
_GDIPlus_BitmapCloneArea($SKIN, 145, 1, 15, 38, 0x0026200A), _GDIPlus_BitmapCloneArea($SKIN, 161, 1, 10, 38, 0x0026200A), _
_GDIPlus_BitmapCloneArea($SKIN, 172, 1, 15, 38, 0x0026200A), _GDIPlus_BitmapCloneArea($SKIN, 188, 1, 15, 38, 0x0026200A), _
_GDIPlus_BitmapCloneArea($SKIN, 204, 1, 10, 38, 0x0026200A), _GDIPlus_BitmapCloneArea($SKIN, 215, 1, 15, 38, 0x0026200A)]
_GDIPlus_ImageDispose($SKIN)
Local $TitleB = MakeTitleButton(198, $ImgAA[0], $ImgAA[1], $ImgAA[2], $MTTL)
Local $strsize = _StringSize($MTXT, 10, Default, Default, "Times New Roman")
Local $BG = DrawMainGUI($strsize[0], $strsize[1], $SImgA[0], $SImgA[1], $SImgA[2], $SImgA[3], $SImgA[4], $SImgA[5], $SImgA[6], $SImgA[7], $SImgA[8], $TitleB, $MTXT, $MICO)
For $i = 0 To 8
_GDIPlus_ImageDispose($SImgA[$i])
Next
_GDIPlus_ImageDispose($TitleB[0])
If $MPAR <> "" Then
Local $USWin = GUICreate("GUI", $BG[1], $BG[2], -1, -1, BitOR(0x80000000, 0x00020000, 0x00080000), BitOR(0x00080000, 0x00000008), $MPAR)
Else
Local $USWin = GUICreate("GUI", $BG[1], $BG[2], -1, -1, BitOR(0x80000000, 0x00020000, 0x00080000), BitOR(0x00080000, 0x00000008), 0x80)
EndIf
GUICtrlCreateLabel("", 35, 0, $BG[3], $BG[4], -1, 0x00100000)
$BUTPOS = CalcButPos($MBTS, 105, $BG[1])
Local $PosLab[$MBTS + 1][2]
$PosLab[1][0] = GUICtrlCreateLabel("", $BUTPOS[0] - 1, $BG[2] - 45 - 4, 105 - 5, 38 - 7)
$PosLab[1][1] = 0
If $MBTS = 2 Then
$PosLab[2][0] = GUICtrlCreateLabel("", $BUTPOS[1] - 1, $BG[2] - 45 - 4, 105 - 5, 38 - 7)
$PosLab[2][1] = 0
EndIf
SetBmp($USWin, $BG[0])
_GDIPlus_ImageDispose($BG[0])
If $MICO <> "" Then
Switch $MICO
Case "S"
$iIcon_Style = -4; stop
Case "Q"
$iIcon_Style = -3; query
Case "E"
$iIcon_Style = -2; exclam
Case "I"
$iIcon_Style = -5; info
EndSwitch
Local $USWinC = GUICreate("", 32, 32, 25, ($BG[2] / 2) - 16 + 10, 0x80000000, BitOR(0x00080000, 0x00000040, 0x08000000, 0x00000008), $USWin)
GUISetBkColor(0x000000, $USWinC)
GUICtrlCreateIcon("user32.dll", $iIcon_Style, 0, 0, 32, 32)
_WinAPI_SetLayeredWindowAttributes($USWinC, 0x000000, 255)
EndIf
Switch $MBTS
Case 1
$BTTxt1 = "OK"
$BTTxt2 = ""
Case 2
$BTTxt1 = "Yes"
$BTTxt2 = "No"
EndSwitch
Local $ImgSA1 = MakeButton(105, $ImgAA[3], $ImgAA[4], $ImgAA[5], $BTTxt1)
Local $ImgSA2 = MakeButton(105, $ImgAA[6], $ImgAA[7], $ImgAA[8], $BTTxt1)
Local $ImgSA3 = MakeButton(105, $ImgAA[9], $ImgAA[10], $ImgAA[11], $BTTxt1)
If $MBTS = 2 Then
Local $ImgSA4 = MakeButton(105, $ImgAA[3], $ImgAA[4], $ImgAA[5], $BTTxt2)
Local $ImgSA5 = MakeButton(105, $ImgAA[6], $ImgAA[7], $ImgAA[8], $BTTxt2)
Local $ImgSA6 = MakeButton(105, $ImgAA[9], $ImgAA[10], $ImgAA[11], $BTTxt2)
EndIf
For $i = 0 To 11
_GDIPlus_ImageDispose($ImgAA[$i])
Next
Local $TabA[$MBTS + 1][3], $Tab[$MBTS + 1]
$Tab[1] = GUICreate("", 105, 38, $BUTPOS[0], $BG[2] - 45, 0x80000000, BitOR(0x00080000, 0x00000008, 0x00000040, 0x08000000), $USWin)
DrawMBImg($TabA, 1, $ImgSA1, $ImgSA2, $ImgSA3, 105, 38)
SetBmp($Tab[1], $TabA[1][0])
If $MBTS = 2 Then
$Tab[2] = GUICreate("", 105, 38, $BUTPOS[1], $BG[2] - 45, 0x80000000, BitOR(0x00080000, 0x00000008, 0x00000040, 0x08000000), $USWin)
DrawMBImg($TabA, 2, $ImgSA4, $ImgSA5, $ImgSA6, 105, 38)
SetBmp($Tab[2], $TabA[2][0])
EndIf
_GDIPlus_ImageDispose($ImgSA1)
_GDIPlus_ImageDispose($ImgSA2)
_GDIPlus_ImageDispose($ImgSA3)
If $MBTS = 2 Then
_GDIPlus_ImageDispose($ImgSA4)
_GDIPlus_ImageDispose($ImgSA5)
_GDIPlus_ImageDispose($ImgSA6)
EndIf
GUISetState(@SW_SHOW, $USWin)
If $MICO <> "" Then GUISetState(@SW_SHOW, $USWinC)
GUISetState(@SW_SHOW, $Tab[1])
If $MBTS = 2 Then GUISetState(@SW_SHOW, $Tab[2])
Local $exi = 0, $Return = -1
While 1
$pos = GUIGetCursorInfo($USWin)
For $i = 1 To $MBTS
If $pos[4] = $PosLab[$i][0] Then
If $pos[3] = 1 Then ExitLoop
If $pos[2] = 1 Then ExitLoop
While $pos[4] = $PosLab[$i][0]
$pos = GUIGetCursorInfo($USWin)
Switch $pos[2]
Case 0; not pressed
If $PosLab[$i][1] <> 1 Then
SetBmp($Tab[$i], $TabA[$i][1])
$PosLab[$i][1] = 1
EndIf
Case 1
While $pos[2] = 1; holding pressed
$pos = GUIGetCursorInfo($USWin)
Switch $pos[4]
Case $PosLab[$i][0]; on button, pressed
If $PosLab[$i][1] <> 2 Then
SetBmp($Tab[$i], $TabA[$i][2])
$PosLab[$i][1] = 2
EndIf
Case Else; not on button, pressed
If $PosLab[$i][1] <> 3 Then
SetBmp($Tab[$i], $TabA[$i][1])
$PosLab[$i][1] = 3
EndIf
EndSwitch
Sleep(10)
WEnd
If $pos[4] = $PosLab[$i][0] Then
Switch $MBTS
Case 1
$Return = 1
Case 2
Switch $i
Case 1
$Return = 6
Case 2
$Return = 7
EndSwitch
EndSwitch
$exi = 1
EndIf
EndSwitch
If $exi = 1 Then ExitLoop
Sleep(10)
WEnd
SetBmp($Tab[$i], $TabA[$i][0])
$PosLab[$i][1] = 0
EndIf
Next
If GUIGetMsg() = -3 Or $exi = 1 Then ExitLoop
Sleep(5)
WEnd
For $i = 1 To $MBTS
_GDIPlus_ImageDispose($TabA[$i][0])
_GDIPlus_ImageDispose($TabA[$i][1])
_GDIPlus_ImageDispose($TabA[$i][2])
Next
If $MBTS = 2 Then GUIDelete($Tab[2])
GUIDelete($Tab[1])
If $MICO <> "" Then GUIDelete($USWinC)
GUIDelete($USWin)
Return $Return
EndFunc ;==>MyCustomMsgBox

Func CalcButPos($ModB, $ButSz, $WinSzX)
Switch $ModB
Case 1
$ix1 = ($WinSzX / 2) - ($ButSz / 2)
$ix2 = ""
Case 2
$ix1 = ($WinSzX / 2) - ((($ButSz * 2) + 30) / 2)
$ix2 = $ix1 + $ButSz + 30
EndSwitch
Local $Ret[2] = [$ix1, $ix2]
Return $Ret
EndFunc ;==>CalcButPos

Func DrawMBImg(ByRef $RetA, $indx, $Imgs1, $Imgs2, $Imgs3, $aw, $ah)
Local $Imgs[3] = [$Imgs1, $Imgs2, $Imgs3]
For $i = 0 To 2
Local $hGr1 = _GDIPlus_GraphicsCreateFromHWND(_WinAPI_GetDesktopWindow())
Local $hBmp = _GDIPlus_BitmapCreateFromGraphics($aw, $ah, $hGr1)
Local $hGr2 = _GDIPlus_ImageGetGraphicsContext($hBmp)
_GDIPlus_GraphicsDrawImageRect($hGr2, $Imgs[$i], 0, 0, $aw, $ah)
_GDIPlus_GraphicsDispose($hGr2)
_GDIPlus_GraphicsDispose($hGr1)
$RetA[$indx][$i] = $hBmp
Next
EndFunc ;==>DrawMBImg

Func MakeButton($hw, $VAR1, $VAR2, $VAR3, $Txt)
Local $OFF = -3
$hwT = 30
$steps = 0
Do
$hwT += 10
$steps += 1
Until $hwT >= $hw
Local $hGr1 = _GDIPlus_GraphicsCreateFromHWND(_WinAPI_GetDesktopWindow())
Local $hBmp = _GDIPlus_BitmapCreateFromGraphics($hwT, 38, $hGr1)
Local $hGr2 = _GDIPlus_ImageGetGraphicsContext($hBmp)
_GDIPlus_GraphicsDrawImageRect($hGr2, $VAR1, 0, 0, 15, 38)
For $i = 1 To $steps
_GDIPlus_GraphicsDrawImageRect($hGr2, $VAR2, 15 + (($i - 1) * 10), 0, 10, 38)
Next
_GDIPlus_GraphicsDrawImageRect($hGr2, $VAR3, $hwT - 15, 0, 15, 38)
$strsizea = _StringSize($Txt, 11, Default, Default, "Times New Roman")
_GDIPlus_GraphicsDrawString_($hGr2, $Txt, ($hwT / 2) - ($strsizea[0] / 2) + $OFF, 4, "Times New Roman", 11)
_GDIPlus_GraphicsDispose($hGr2)
_GDIPlus_GraphicsDispose($hGr1)
Return $hBmp
EndFunc ;==>MakeButton

Func DrawMainGUI($hw, $hh, $V1, $V2, $V3, $V4, $V5, $V6, $V7, $V8, $V9, $VI, $VTxt, $MIico = "")
Local $OFF = 10
If $MIico <> "" Then
$IcoOFF = 45
Else
$IcoOFF = 0
EndIf
$hw += 70 + $IcoOFF
$hh += 60 + 40
$hwT = 40
$steps = 0
Do
$hwT += 15
$steps += 1
Until $hwT >= $hw
$hhT = 45
$steps2 = 0
Do
$hhT += 15
$steps2 += 1
Until $hhT >= $hh
Local $hGr1 = _GDIPlus_GraphicsCreateFromHWND(_WinAPI_GetDesktopWindow())
Local $hBmp = _GDIPlus_BitmapCreateFromGraphics($hwT, $hhT + $OFF, $hGr1)
Local $hGr2 = _GDIPlus_ImageGetGraphicsContext($hBmp)
_GDIPlus_GraphicsDrawImageRect($hGr2, $V1, 0, 0 + $OFF, 20, 20); gornji red
_GDIPlus_GraphicsDrawImageRect($hGr2, $V7, 0, $hhT - 25 + $OFF, 20, 25); donji red
For $i = 1 To $steps
_GDIPlus_GraphicsDrawImageRect($hGr2, $V2, 20 + (($i - 1) * 15), 0 + $OFF, 15, 20)
_GDIPlus_GraphicsDrawImageRect($hGr2, $V8, 20 + (($i - 1) * 15), $hhT - 25 + $OFF, 15, 25)
Next
_GDIPlus_GraphicsDrawImageRect($hGr2, $V3, $hwT - 20, 0 + $OFF, 20, 20); gotov gornji red
_GDIPlus_GraphicsDrawImageRect($hGr2, $V9, $hwT - 20, $hhT - 25 + $OFF, 20, 25); gotov donji red
For $i = 1 To $steps2
_GDIPlus_GraphicsDrawImageRect($hGr2, $V4, 0, 20 + (($i - 1) * 15) + $OFF, 20, 15)
For $j = 1 To $steps
_GDIPlus_GraphicsDrawImageRect($hGr2, $V5, 20 + (($j - 1) * 15), 20 + (($i - 1) * 15) + $OFF, 15, 15)
Next
_GDIPlus_GraphicsDrawImageRect($hGr2, $V6, $hwT - 20, 20 + (($i - 1) * 15) + $OFF, 20, 15)
Next
_GDIPlus_GraphicsDrawImageRect($hGr2, $VI[0], 35, 0, $VI[1], $VI[2])
_GDIPlus_GraphicsDrawString_($hGr2, $VTxt, 20 + $IcoOFF, 45, "Times New Roman", 10, "FFFFFF")
_GDIPlus_GraphicsDispose($hGr2)
_GDIPlus_GraphicsDispose($hGr1)
Local $Ret[5] = [$hBmp, $hwT, $hhT, $VI[1], $VI[2]]
Return $Ret
EndFunc ;==>DrawMainGUI

Func MakeTitleButton($hw, $V1, $V2, $V3, $hTxt = "")
$hwT = 30
$steps = 0
Do
$hwT += 10
$steps += 1
Until $hwT >= $hw
Local $hGr1 = _GDIPlus_GraphicsCreateFromHWND(_WinAPI_GetDesktopWindow())
Local $hBmp = _GDIPlus_BitmapCreateFromGraphics($hwT, 45, $hGr1)
Local $hGr2 = _GDIPlus_ImageGetGraphicsContext($hBmp)
_GDIPlus_GraphicsDrawImageRect($hGr2, $V1, 0, 0, 15, 45)
For $i = 1 To $steps
_GDIPlus_GraphicsDrawImageRect($hGr2, $V2, 15 + (($i - 1) * 10), 0, 10, 45)
Next
_GDIPlus_GraphicsDrawImageRect($hGr2, $V3, $hwT - 15, 0, 15, 45)
If $hTxt <> "" Then _GDIPlus_GraphicsDrawString_($hGr2, $hTxt, 9, 6, "Times New Roman", 12)
_GDIPlus_GraphicsDispose($hGr2)
_GDIPlus_GraphicsDispose($hGr1)
Local $Ret[3] = [$hBmp, $hwT, 45]
Return $Ret
EndFunc ;==>MakeTitleButton

Func _StringSize($sText, $iSize = 8.5, $iWeight = 400, $iAttrib = 0, $sName = "", $iQuality = 2)
Local $fItalic = BitAND($iAttrib, 2)
Local $hDC = _WinAPI_GetDC(0)
Local $hFont = _WinAPI_CreateFont(-_WinAPI_GetDeviceCaps($hDC, 90) * $iSize / 72, 0, 0, 0, $iWeight, $fItalic, BitAND($iAttrib, 4), BitAND($iAttrib, 8), 0, 0, 0, $iQuality, 0, $sName)
Local $hOldFont = _WinAPI_SelectObject($hDC, $hFont)
Local $tSIZE, $iWidth = 0, $iHeight = 0
Local $aArrayOfStrings = StringSplit(StringStripCR($sText), @LF, 2)
For $sString In $aArrayOfStrings
If $fItalic Then $sString &= " "
$tSIZE = _WinAPI_GetTextExtentPoint32($hDC, $sString)
If DllStructGetData($tSIZE, "X") > $iWidth Then $iWidth = DllStructGetData($tSIZE, "X")
$iHeight += DllStructGetData($tSIZE, "Y")
Next
_WinAPI_SelectObject($hDC, $hOldFont)
_WinAPI_DeleteObject($hFont)
_WinAPI_ReleaseDC(0, $hDC)
Local $aOut[2] = [$iWidth, $iHeight]
Return $aOut
EndFunc ;==>_StringSize

Func SetBmp($hGUI, $hImage, $iOpacity = 255)
Local $hScrDC = _WinAPI_GetDC(0)
Local $hMemDC = _WinAPI_CreateCompatibleDC($hScrDC)
Local $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage)
Local $hOld = _WinAPI_SelectObject($hMemDC, $hBitmap)
$tSize = DllStructCreate("long X;long Y")
$pSize = DllStructGetPtr($tSize)
DllStructSetData($tSize, "X", _GDIPlus_ImageGetWidth($hImage))
DllStructSetData($tSize, "Y", _GDIPlus_ImageGetHeight($hImage))
$tSource = DllStructCreate("long X;long Y")
$pSource = DllStructGetPtr($tSource)
$tBlend = DllStructCreate("byte Op;byte Flags;byte Alpha;byte Format")
$pBlend = DllStructGetPtr($tBlend)
DllStructSetData($tBlend, "Alpha", $iOpacity)
DllStructSetData($tBlend, "Format", 1)
_WinAPI_UpdateLayeredWindow($hGUI, $hScrDC, 0, $pSize, $hMemDC, $pSource, 0, $pBlend, 0x02)
_WinAPI_ReleaseDC(0, $hScrDC)
_WinAPI_SelectObject($hMemDC, $hOld)
_WinAPI_DeleteObject($hBitmap)
_WinAPI_DeleteDC($hMemDC)
EndFunc ;==>SetBmp

Func _GDIPlus_GraphicsDrawString_($hGraphics, $sString, $nX, $nY, $sFont = "Times New Roman", $nSize = 10, $ncol = "000000", $iFormat = 0)
If StringLeft($ncol, 2) = "0x" Then $ncol = StringTrimLeft($ncol, 2)
Local $hBrush = _GDIPlus_BrushCreateSolid("0xFF" & $ncol)
Local $hFormat = _GDIPlus_StringFormatCreate($iFormat)
Local $hFamily = _GDIPlus_FontFamilyCreate($sFont)
Local $hFont = _GDIPlus_FontCreate($hFamily, $nSize)
Local $tLayout = _GDIPlus_RectFCreate($nX, $nY, 0, 0)
Local $aInfo = _GDIPlus_GraphicsMeasureString($hGraphics, $sString, $hFont, $tLayout, $hFormat)
Local $aResult = _GDIPlus_GraphicsDrawStringEx($hGraphics, $sString, $hFont, $aInfo[0], $hFormat, $hBrush)
Local $iError = @error
_GDIPlus_FontDispose($hFont)
_GDIPlus_FontFamilyDispose($hFamily)
_GDIPlus_StringFormatDispose($hFormat)
_GDIPlus_BrushDispose($hBrush)
Return SetError($iError, 0, $aResult)
EndFunc ;==>_GDIPlus_GraphicsDrawString_



Local $destination = "E:\ClearCanvas\Vydehi.jpg"


SplashImageOn("splash", $destination, 720, 480, -1,-1,1 )

Run("C:\Program Files\clearcanvas\clearcanvas workstationClearCanvas.Desktop.Executable.exe", "", @SW_MAXIMIZE)
Sleep(5600)
SplashOff()

i also need to change the text in the title bar for the executable

Run("C:\Program Files\clearcanvas\clearcanvas workstationClearCanvas.Desktop.Executable.exe", "", @SW_MAXIMIZE)

To something else , i have tried every thing possible with the winsettitle command but it does not work it only works using the manager script i found on the forum, i want to combine the relevant script given in the first box with my script to force the executable to change title.

script.rar

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×