Jump to content
Sign in to follow this  
Generator

Script doesn't seem to be getting the WinTitle

Recommended Posts

Generator

I made GUI and it hides stuff as you set it to(Using WinSetState).

I don't understand why won't it work.

Myself cannot see any errors(Though my coding skill is crappy).

I think something wrong with getting the WinTitle, but I can't seem to find the bug.

Well you can look up func as you run and and checking it. I think the part is HideIt()

Anyways here is the code:

#region Includes
#include<GUIConstants.au3>
#include<GUIList.au3>
#NoTrayIcon
#endregion Includes
#region Declares
Opt("GUIOnEventMode",1)
Opt("WinTitleMatchMode",2)
Global $RealTitle=""
Global $RealText=""
Global $FakeTitle=""
Global $FakeText=""
Global $Mode="None"
Global $HiderPro="Hider Pro"
$HideIt=False
$HotKeyToggleHide=False
$OnTopValue=False
$EnableHotkey=False
$Hide=False
#endregion Decalres
#region General Checks
If WinExists($HiderPro)=1 Then
    Exit
EndIf
AutoitWinSetTitle($HiderPro)
#endregion General Checks
#region HotKeys
HotKeySet("!^+R","SetRealWin")
HotkeySet("^!+F","SetFakeWin")
#endregion Hotkeys
#region GUICreation
$mainfrm=GUICreate("Hider Pro","200","345",-1,-1)
$menufile=GUICtrlCreateMenu("File")
$menufileitem=GUICtrlCreateMenuitem("Exit",$menufile)
$menutrans=GUICtrlCreateMenu("Trans")
$menutransitem1=GUICtrlCreateMenuItem("75% Transparent",$menutrans)
$menutransitem2=GUICtrlCreateMenuItem("50% Transparent",$menutrans)
$menutransitem3=GUICtrlCreateMenuItem("25% Transparent",$menutrans)
$menutransitem5=GUICtrlCreateMenuItem("10% Transparent",$menutrans)
$menutransitem4=GUICtrlCreateMenuItem("Restore Transparent",$menutrans)
$menuopt=GUICtrlCreateMenu("Options")
$menuoptitem=GUICtrlCreateMenuitem("Toggle Hide",$menuopt)
$menuoptitem1=GUICtrlCreateMenuItem("Help",$menuopt)
$aboutmenu=GUICtrlCreateMenu("About")
$aboutmenuitem1=GUICtrlCreateMenuItem("Version",$aboutmenu)
$Credit=GUICtrlCreateMenuItem("Credit",$aboutmenu)
$labelprocess=GUICtrlCreateLabel("Process Name",5,2,80,20,$SS_CENTER)
$labelstate=GUICtrlCreateLabel("State",110,2,70,20,$SS_CENTER)
$listpro=GUICtrlCreateList("",2,22,90,130,$LBS_SORT+$WS_VSCROLL+$WS_BORDER )
$vislabel=GUICtrlCreateLabel("Unknown State",100,25,90,60,$SS_CENTER)
$killbutton=GUICtrlCreateButton("Kill Process",100,80,95,30,$BS_CENTER+$BS_VCENTER)
$refreshbutton=GUICtrLCreateButton("Refresh List",100,115,95,30,$BS_CENTER+$BS_VCENTER)
$setrealbutton=GUICtrlCreateButton("Check Real Win",100,150,95,30,$BS_CENTER+$BS_VCENTER)
$setfakebutton=GUICtrlCreateButton("Check Fake Win",100,185,95,30,$BS_CENTER+$BS_VCENTER)
$singlemode=GUICtrlCreateButton("Single Mode",2,150,90,30,$BS_CENTER+$BS_VCENTER)
$doublemode=GUICtrlCreateButton("Double Mode",2,185,90,30,$BS_CENTER+$BS_VCENTER)
$HotkeyEnDis=GUICtrlCreateButton("Enable Hide Hotkey",2,220,196,30,$BS_CENTER+$BS_VCENTER)
$Restoreall=GUICtrlCreateButton("Restore All Hideen Windows",2,255,196,30,$BS_CENTER+$BS_VCENTER)
$SetOnTop=GUICtrlCreateButton("Set On Top",2,290,95,30,$BS_CENTER+$BS_VCENTER)
$ExitButton=GUICtrlCreateButton("Exit",105,290,93,30,$BS_CENTER+$BS_VCENTER)
GUISetState(@SW_SHOW)
#endregion GUICreation
#region GUIEvents
GUISetOnEvent($GUI_EVENT_CLOSE,"QuitRestore")
GUICtrlSetOnEvent($refreshbutton,"Refresh")
GUICtrlSetOnEvent($menufileitem,"QuitRestore")
GUICtrlSetOnEvent($menutransitem1,"Trans1")
GUICtrlSetOnEvent($menutransitem2,"Trans2")
GUICtrlSetOnEvent($menutransitem3,"Trans3")
GUICtrlSetOnEvent($menutransitem4,"Trans4")
GUICtrlSetOnEvent($menutransitem5,"Trans5")
GUICtrlSetOnEvent($menuoptitem,"ToggleHide")
GUICtrlSetOnEvent($setrealbutton,"ChkRealWin")
GUICtrlSetOnEvent($setfakebutton,"ChkFakeWin")
GUICtrlSetOnEvent($SetOnTop,"SetTop")
GUICtrlSetOnEvent($killbutton,"KillProcess")
GUICtrlSetOnEvent($HotkeyEnDis,"HotKeyEnDis")
GUICtrlSetOnEvent($ExitButton,"QuitRestore")
GUICtrlSetOnEvent($menufileitem,"QuitRestore")
GUICtrlSetOnEvent($Restoreall,"Restoreall")
GUICtrlSetOnEvent($menuoptitem1,"Help")
GUICtrlSetOnEvent($aboutmenuitem1,"About")
GUICtrlSetOnEvent($Credit,"Credit")
GUICtrlSetOnEvent($singlemode,"Single")
GUICtrlSetOnEvent($doublemode,"Double")
GUICtrlSetFont($labelprocess,12,400,0,"Tahoma")
GUICtrlSetFont($labelstate,12,400,0,"Tahoma")
GUICtrlSetFont($vislabel,11,400,0,"Tahoma")
#Endregion GUIEvents
While 1
    Sleep(1000)
WEnd
#region Functions
Func Refresh()
    $list=ProcessList()
    For $i = 1 to $list[0][0]
        GUICtrlSetData($listpro,$list[$i][0])
    Next
EndFunc
Func Trans1()
    WinSetTrans("Hider Pro","",192)
EndFunc
Func Trans2()
    WinSetTrans("Hider Pro","",128)
EndFunc
Func Trans3()
    WinSetTrans("Hider Pro","",64)
EndFunc
Func Trans4()
    WinSetTrans("Hider Pro","",255)
EndFunc
Func Trans5()
    WinSetTrans("Hider Pro","",40)
EndFunc
Func ToggleHide()
    $HotKeyToggleHide=NOT $HotKeyToggleHide
    If $HotKeyToggleHide=True Then
        HotKeySet("{F9}","HideIt")
    Else
        HotKeySet("{F9}")
    EndIf
EndFunc
Func HideIt()
    $HideIt=NOT $HideIt
    If $HideIt=True Then
        WinSetState("Hider Pro","",@SW_HIDE)
    Else
        WinSetState("Hider Pro","",@SW_SHOW)
    EndIf
EndFunc
Func SetTop()
    $OnTopValue=Not $OnTopValue
    If $OnTopValue=True Then
        GUICtrlSetData($SetOnTop,"Cancel On Top")
        WinSetOnTop("Hider Pro","",1)
    Else
        GUICtrlSetData($SetOnTop,"Set On Top")
        WinSetOnTop("Hider Pro","",0)
    EndIf
EndFunc
Func KillProcess()
    $Pid=GUICtrlRead($listpro)
    $Process=ProcessExists($Pid)
    If $Process=0 Then
        MsgBox(64,"Process not Exist","Please Refresh List")
        Return
    Else
        $Warnmsg= MsgBox (4 + 48, "Warning", "Are you sure you want to close this process? Doing so may cause system unstability and unwanted data loss! Continue?")
        If $Warnmsg= 6 Then
            ProcessClose($Process)
        Else
            Return
        EndIf
    EndIf
EndFunc
Func SetRealWin()
    If $Mode="None" Then
        MsgBox(64,"Mode Error","Please reset your mode")
        Return
    EndIf
    $RealTitle=WinGetTitle("","")
    $RealText=WinGetText("","")
    Return $RealTitle And $RealText     
EndFunc
Func SetFakeWin()
    If $Mode="Single" Or $Mode="None" Then
        MsgBox(64,"Mode Error","Please reset your mode")
        Return
    EndIf
    $FakeTitle=WinGetTitle("","")
    $FakeText=WinGetText("","")
    Return $FakeTitle And $FakeText     
EndFunc
Func HotKeyEnDis()
    $EnableHotkey=Not $EnableHotkey
    If $EnableHotkey=True Then
        GUICtrlSetData($HotkeyEnDis,"Disable Hide Hotkey")
        HotKeySet("{F10}","Hide")
    Else
        GUICtrlSetData($HotkeyEnDis,"Enable Hide Hotkey")
        HotKeySet("{F10}")
    EndIf
EndFunc
Func Hide()
    If $Mode="None" Then
        MsgBox(64,"Error","Please reset your mode or Windows")
    EndIf
    If $Mode="Single" Then
        $Hide=Not $Hide
        If $Hide=True Then
            WinSetState($RealTitle,$RealText,@SW_HIDE)
        Else
            WinSetState($FakeTitle,$FakeText,@SW_SHOW)
        EndIf
    EndIf
    If $Mode="Double" Then
        $Hide=Not $Hide
        If $Hide=True Then
            WinSetState($RealTitle,$RealText,@SW_HIDE)
            WinSetState($FakeTitle,$FakeText,@SW_SHOW)
        Else
            WinSetState($RealTitle,$RealText,@SW_SHOW)
            WinSetState($FakeTitle,$FakeText,@SW_HIDE)
        EndIf
    EndIf
EndFunc
Func QuitRestore()
    If $Mode="Single" Then
        WinSetState($RealTitle,$RealText,@SW_SHOW)
        Exit
    EndIf
    If $Mode="Double" Then
        WinSetState($RealTitle,$RealText,@SW_SHOW)
        WinSetState($FakeTitle,$FakeText,@SW_SHOW)
        Exit
    EndIf
    If $Mode="None" Then
        Exit
    EndIf
EndFunc
Func RestoreAll()
    If $Mode="Single" Then
        WinSetState($RealTitle,$RealText,@SW_SHOW)
        GUICtrLSetData($vislabel,"All Windows are Restored")
    EndIf
    If $Mode="Double" Then
        WinSetState($RealTitle,$RealText,@SW_SHOW)
        WinSetState($FakeTitle,$FakeText,@SW_SHOW)
        GUICtrLSetData($vislabel,"All Windows are Restored")
    EndIf
    If $Mode="None" Then
        MsgBox(64,"Error","No Windows was selected")
    EndIf
EndFunc
Func Help()
    MsgBox(64,"Instruction","Modes:"&@CRLF&"Single Mode only Hides 1 Window as RealWindow"&@CRLF&"Double Mode as in Real Window Hides Fake Window Shows""Steps:"&@CRLF&"1.Set Real Windows(Ctrl+Shift+Alt+R)"&@CRLF&"2.Set Fake Windows"&@CRLF&"3.Enable Hide Hotkey, Hotkey is F10"&@CRLF&"4.Hit F10, Real Window Hides, Fake Windows Show up.Read State"&@CRLF& _
    "Extras:"&@CRLF&"Toggle Hide to Enable Hide Hotkey for Hider Pro, Hotkey is F9"&@CRLF&"Task Manager works like normal one")
EndFunc
Func About()
    MsgBox(64,"About Version","Hider Pro v.10")
EndFunc
Func Credit()
    MsgBox(64,"Credit","Credit for making goes to:"&@CRLF&"Binary: 01000111 01110010 01100101 01100101 01101110 01000010 01100101 01110010 01100101 01110100"&@CRLF& _
    "Hex: 47 72 65 65 6e 42 65 72 65 74"&@CRLF&"Thanks for using and supporting The Hider.")
EndFunc
Func Single()
    $Mode="Single"
    MsgBox(64,"Single Mode","Now Mode is set to Single")
    Return $Mode
EndFunc
Func Double()
    $Mode="Double"
    Msgbox(64,"Double Mode","Now Mode is set to Double")
    Return $Mode
EndFunc
Func ChkRealWin()
    If $Mode="None" Or $RealTitle="" And $RealText="" Then
        MsgBox(64,"Error","Please reset your Mode or Real Window")
    Else
        MsgBox(64,"Real Window","Title:"&$RealTitle&@CRLF&"Text:"&$RealText)
    EndIf
EndFunc
Func ChkFakeWin()
    If $Mode="None" Or $Mode="Single" Or $FakeTitle="" And $FakeText="" Then
        MsgBox(64,"Error","Please reset your Mode or Fake Window")
    Else
        MsgBox(64,"Fake Window","Title:"&$FakeTitle&@CRLF&"Text:"&$FakeText)
    EndIf
EndFunc
#endregion Functions

Thanks for anyone who helped. Gonna release this after it's fully functional I guess. Might be helpful in some cases.

:shocked:

Edited by Generator

Share this post


Link to post
Share on other sites
Generator

Func Hide()
    If $Mode="None" Then
        MsgBox(64,"Error","Please reset your mode or Windows")
    EndIf
    If $Mode="Single" Then
        $Hide=Not $Hide
        If $Hide=True Then
            WinSetState($RealTitle,$RealText,@SW_HIDE)
        Else
            WinSetState($FakeTitle,$FakeText,@SW_SHOW)
        EndIf
    EndIf
    If $Mode="Double" Then
        $Hide=Not $Hide
        If $Hide=True Then
            WinSetState($RealTitle,$RealText,@SW_HIDE)
            WinSetState($FakeTitle,$FakeText,@SW_SHOW)
        Else
            WinSetState($RealTitle,$RealText,@SW_SHOW)
            WinSetState($FakeTitle,$FakeText,@SW_HIDE)
        EndIf
    EndIf
EndFunc

This part doesn't seem to work..Anyone got any ideas why?

Thanks in advance.

:shocked:

Share this post


Link to post
Share on other sites
amokoura

...Func Hide()...

This part doesn't seem to work..Anyone got any ideas why?

What's the problem: what does it do or doesn't do?

Share this post


Link to post
Share on other sites
Generator

What's the problem: what does it do or doesn't do?

It's suppose to hide Window using WinSetState, but doesn't seem to work properly.

Share this post


Link to post
Share on other sites
evilertoaster

Try-

Func Hide()
    If $Mode="None" Then
        MsgBox(64,"Error","Please reset your mode or Windows")
    EndIf
    If $Mode="Single" Then
        $Hide=Not $Hide
        If $Hide=True Then
            WinSetState($RealTitle,"",@SW_HIDE)
        Else
            WinSetState($FakeTitle,"",@SW_SHOW)
        EndIf
    EndIf
    If $Mode="Double" Then
        $Hide=Not $Hide
        If $Hide=True Then
            WinSetState($RealTitle,"",@SW_HIDE)
            WinSetState($FakeTitle,"",@SW_SHOW)
        Else
            WinSetState($RealTitle,"",@SW_SHOW)
            WinSetState($FakeTitle,"",@SW_HIDE)
        EndIf
    EndIf
EndFunc

Worked for me.

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.