Jump to content

Search the Community

Showing results for tags 'fullscreen'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Location


WWW


Interests

Found 8 results

  1. Hello i am new here and this is my first thread in this script i used some code snippets from forum. I do not remember who these belonged to. Disabled ALT+F4 ALT+TAB TASK MANAGER LOCKING WINDOWS deleted items from ctrl+alt+delete screen (Lock Computer,Switch User,Sign Out,Chance a password,Task Manager) CTRL+ALT+DELETE (how ?) firstly we are disabled locking computer RegWrite('HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System', 'DisableLockWorkstation',"REG_DWORD",0x00000001) and then ctrl+alt+delete pressed IsDesktopLocked() triggered. we are calling Run("rundll32.exe user32.dll,LockWorkStation") command with checking if $blockctrlaltdel = 1 statements. then it return us to kiosk screen, because we are disabled locking computer. Func IsDesktopLocked() Local $hDesktop Local $iRet Local $iRC Local $sMsg Local Const $DESKTOP_SWITCHDESKTOP = 0x100 $hDesktop = DllCall("User32.dll", "int", "OpenDesktop", "str", "Default", "int", 0, "int", 0, "int", $DESKTOP_SWITCHDESKTOP) $iRet = DllCall("User32.dll", "int", "SwitchDesktop", "int", $hDesktop[0]) If IsArray($iRet) Then If $iRet[0] = 0 Then if $blockctrlaltdel = 1 Then Run("rundll32.exe user32.dll,LockWorkStation") EndIf $iRC = 1 ElseIf $iRet[0] = 1 Then $iRC = 0 EndIf Else EndIf DllCall("User32.dll", "int", "CloseDesktop", "int", $hDesktop[0]);<-- handle returned by "OpenDesktop" ;$iRet = DllCall("User32.dll", "int", "CloseDesktop", "int", $iRet[0]) Return ($iRC) EndFunc ;==>IsDesktopLocked maybe this blocked to lock computer when rdp session closed. i havent tried and This script needed to Google chrome and "WinLockDll.dll" to work. FULL SCRIPT #include <WinAPI.au3> #include <FontConstants.au3> #include <GUIConstants.au3> Opt('GUIOnEventMode', 1) Opt("TrayAutoPause", 0) HotKeySet("{ESCAPE}","_EXIT") ;~ $sFilePath = "D:\kiosk\" local $Form1,$blockctrlaltdel Global Const $VK_F4 = 0x73 Global $winlockdll = DllOpen(@ScriptDir&"\WinLockDll.dll") kullanimkapat() #region ; WinEventHook Global Const $EVENT_OPEN_DESKTOP_CHANGED = 0x0020 $h_DLL_User32 = DllOpen("User32.dll") $h_WinEventHook_Proc = DllCallbackRegister("_WinEventHook_Proc", "none", "hwnd;int;hwnd;long;long;int;int") If @error Then ConsoleWrite("Error DllCallbackRegister(_WinEventHook_Proc) did not succeed. FFH will exit now.") Exit EndIf $h_Hook = _WinEventHook_Set(0x0020, 0x0020, $h_DLL_User32) If @error Then ConsoleWrite("Error _WinEventHook_Set() did not succeed. FFH will exit now.") Exit EndIf OnAutoItExitRegister("_WinEventHook_UnSet") #endregion ; WinEventHook Global $winlockdll = DllOpen(@ScriptDir&"\WinLockDll.dll") Func kullanimkapat() $blockctrlaltdel = 1 Global $hHookProc = DllCallbackRegister("_KeyboardProc", "long", "int;wparam;lparam") Global $hHookKeyboard = _WinAPI_SetWindowsHookEx($WH_KEYBOARD_LL, DllCallbackGetPtr($hHookProc), _WinAPI_GetModuleHandle(0), 0) Global $hSysTray_Handle = DllCall("user32.dll", "HWND", "FindWindow", "str", "Shell_TrayWnd", "str", "") _WinAPI_ShellChangeNotify($SHCNE_ASSOCCHANGED, 0, 0, 0) _SendMessage($hSysTray_Handle[0], 0x5B4, 0, 0) DllCall($winlockdll, "Int", "Keys_Enable_Disable ", "Int", "1") DllCall($winlockdll, "Int", "TaskManager_Enable_Disable", "Int", "0") DllCall($winlockdll, "Int", "TaskSwitching_Enable_Disable", "Int", "0") DllCall($winlockdll, "Int", "Keys_Enable_Disable", "Int", "1") RegWrite('HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System', 'DisableChangePassword',"REG_DWORD",0x00000001) RegWrite('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System', 'HideFastUserSwitching', "REG_DWORD",0x00000001) RegWrite('HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer', 'NoLogoff',"REG_DWORD",0x00000001) RegWrite('HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer', 'NoClose',"REG_DWORD",0x00000001) RegWrite('HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System', 'DisableTaskMgr',"REG_DWORD",0x00000001) RegWrite('HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System', 'DisableLockWorkstation',"REG_DWORD",0x00000001) FileDelete ( @LocalAppDataDir&"\Google\Chrome\User Data\Default\Preferences" ) ;~ Local $hFileOpen = FileOpen($sFilePath,BitOR(8,2)) ;~ FileWrite($hFileOpen,'<!DOCTYPE html><meta http-equiv="refresh" content="30"><html><head><script type="text/javascript">function disableselect(e){return!1}function reEnable(){return!0}document.onselectstart=new Function("return false"),document.oncontextmenu=new Function("return false"),window.sidebar&&(document.onmousedown=disableselect,document.onclick=reEnable);</script><style>#masano{top:50%;left:50%;width:250px;height:250px;margin-top:-125px;margin-left:-125px;border:1px solid red;background-color:red;position:fixed;font:normal 200px Calibri;line-height:250px;text-align:center;color:white}</style><title>*</title></head><body><div id="masano">'&@ComputerName&'</div></body></html>"') ;~ FileClose($hFileOpen);kiosk html writed Run("taskkill /im chrome.exe /f /t") Sleep(3000) ;~ Run(@HomeDrive&"\Program Files (x86)\Google\Chrome\Application\chrome.exe --kiosk "&$sFilePath) Run(@HomeDrive&"\Program Files (x86)\Google\Chrome\Application\chrome.exe --kiosk https://www.autoitscript.com/autoit3/files/graphics/autoit_10_wall_1920x1200.jpg") WinMinimizeAll() Global $hSplash = GuiCreate("", @DesktopWidth+5, @DesktopHeight+5, -5, -5,$WS_POPUP,$WS_THICKFRAME) ;invinsible fullscreen gui on top google chrome. GUISetBkColor (0xf0f8ff) WinSetTrans($hSplash, "", 5) GUISetState() WinSetOnTop($hSplash, "", 1) EndFunc Func kullanimAc() FileDelete ( @LocalAppDataDir&"\Google\Chrome\User Data\Default\Preferences" ) $blockctrlaltdel = 0 DllCallbackFree($hHookProc) If Not IsHWnd($hSysTray_Handle[0]) Then ShellExecute(@WindowsDir & "\Explorer.exe") DllCall($winlockdll, "Int", "Keys_Enable_Disable ", "Int", "0") DllCall($winlockdll, "Int", "TaskManager_Enable_Disable", "Int", "1") DllCall($winlockdll, "Int", "TaskSwitching_Enable_Disable", "Int", "1") DllCall($winlockdll, "Int", "Keys_Enable_Disable ", "Int", "0") RegDelete('HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System','DisableChangePassword') RegDelete('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System', 'HideFastUserSwitching') RegDelete('HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer', 'NoLogoff') RegDelete('HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer', 'NoClose') RegDelete('HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System', 'DisableTaskMgr') RegDelete('HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System', 'DisableLockWorkstation') Run("taskkill /im chrome.exe /f /t") Sleep(500) GUIDelete($hSplash) Sleep(500) EndFunc Func _KeyboardProc($nCode, $wParam, $lParam) If $nCode < 0 Then Return _WinAPI_CallNextHookEx($hHookKeyboard, $nCode, $wParam, $lParam) Switch $wParam Case $WM_KEYDOWN, $WM_SYSKEYDOWN, $WM_KEYUP, $WM_SYSKEYUP Local $tKEYHOOKS = DllStructCreate($tagKBDLLHOOKSTRUCT, $lParam) Local $vKode = DllStructGetData($tKEYHOOKS, "vkCode") Local $iFlags = DllStructGetData($tKEYHOOKS, "flags") Switch $vKode Case $VK_F4 If BitAND($iFlags, $LLKHF_ALTDOWN) Then Return -1 Else Return _WinAPI_CallNextHookEx($hHookKeyboard, $nCode, $wParam, $lParam) EndIf EndSwitch EndSwitch Return _WinAPI_CallNextHookEx($hHookKeyboard, $nCode, $wParam, $lParam) EndFunc #region ; WinEventHook Functions Func _WinEventHook_Proc($h_Hook, $iEvent, $hWnd, $idObject, $idChild, $iEventThread, $iEventTime) ;ConsoleWrite($hWnd & @TAB & $idObject & @CRLF) ConsoleWrite(TimerInit() & @tab & hex($iEvent,4) & @tab & "IsDesktopLocked()" & @tab & IsDesktopLocked() & @crlf) EndFunc ;==>_WinEventHook_Proc Func _WinEventHook_Set($iEventMin, $iEventMax, $hDLLUser32) Local $aRet Local Const $WINEVENT_OUTOFCONTEXT = 0x0 Local Const $WINEVENT_SKIPOWNPROCESS = 0x2 If Not $hDLLUser32 Or $hDLLUser32 = -1 Then $hDLLUser32 = "User32.dll" $aRet = DllCall($hDLLUser32, "hwnd", "SetWinEventHook", _ "uint", $iEventMin, _ "uint", $iEventMax, _ "hwnd", 0, _ "ptr", DllCallbackGetPtr($h_WinEventHook_Proc), _ "int", 0, _ "int", 0, _ "uint", $WINEVENT_OUTOFCONTEXT) ; BitOR($WINEVENT_OUTOFCONTEXT, $WINEVENT_SKIPOWNPROCESS) If @error Then Return SetError(@error, 0, 0) Return $aRet[0] EndFunc ;==>_WinEventHook_Set Func _WinEventHook_UnSet() If $h_WinEventHook_Proc Then DllCallbackFree($h_WinEventHook_Proc) EndIf If $h_Hook Then DllCall($h_DLL_User32, "int", "UnhookWinEvent", "hwnd", $h_Hook) If $h_DLL_User32 Then DllClose($h_DLL_User32) EndFunc ;==>_WinEventHook_UnSet #endregion ; WinEventHook Functions Func IsDesktopLocked() Local $hDesktop Local $iRet Local $iRC Local $sMsg Local Const $DESKTOP_SWITCHDESKTOP = 0x100 $hDesktop = DllCall("User32.dll", "int", "OpenDesktop", "str", "Default", "int", 0, "int", 0, "int", $DESKTOP_SWITCHDESKTOP) $iRet = DllCall("User32.dll", "int", "SwitchDesktop", "int", $hDesktop[0]) If IsArray($iRet) Then If $iRet[0] = 0 Then if $blockctrlaltdel = 1 Then Run("rundll32.exe user32.dll,LockWorkStation") EndIf $iRC = 1 ElseIf $iRet[0] = 1 Then $iRC = 0 EndIf Else EndIf DllCall("User32.dll", "int", "CloseDesktop", "int", $hDesktop[0]);<-- handle returned by "OpenDesktop" ;$iRet = DllCall("User32.dll", "int", "CloseDesktop", "int", $iRet[0]) Return ($iRC) EndFunc ;==>IsDesktopLocked Func _EXIT() kullanimAc() HotKeySet("{ESCAPE}") Exit EndFunc While 1 Sleep(100) WEnd WinLockDll.dll pc-kilitle.au3
  2. Hay there i try to create a gui and delete them on my secound monitore when i was in a fullscreen application but i noticed that i got tabed out of the application every time i created a new gui how to fix that i get tabed out i already tryed with winsetontop("application", "", 1) thx --> @SW_SHOWNOACTIVATE sry im stupid
  3. Hi, I've searched but can only find posts from people with the opposite problem (asking how to get their GUI to display on top of a full-screen app, usually a game. I've created a toolbar which I use in a work environment, creating the GUI with the following styles; $hwnd = GUICreate($title, $toolbarWidth, $height, $left, $top, $WS_POPUPWINDOW, BitOR($WS_EX_TOOLWINDOW, $WS_EX_TOPMOST)) I want it to have a TOPMOST style as it's supposed to behave like the Windows taskbar (which it does in all but one scenario). If I start a full-screen RDP session, I can still see my toolbar and have to close it. Is there a way I can make it appear on top of all windows *except* full-screen apps (in the same way the taskbar allows full-screen apps on top of it)? Thanks in advance. Val.
  4. I am seeing a buttons position change when the following happens. 1. GUI created at 800 x 600 2. GUI info is stored using WinGetPos 3. GUI changed to full-screen using WinMove 4. Button info is stored using ControlGetPos 5. Button is deleted 6. Button is re-created using the stored data from item 4. 7. GUI is restored to the info gathered in item 2. The button starts with this info: Button Left: 408 Button Top: 84 Button Width: 80 Button Height: 24 and after the events above the button has this info: Button Left: 409 Button Top: 83 Button Width: 80 Button Height: 24 Here is some code that can reproduce the issue: (press space, f, space, f, then look in the console) #Region Includes #include <WindowsConstants.au3> #include <StaticConstants.au3> #include <GUIConstantsEx.au3> #include <Array.au3> #EndRegion Includes Const $HT_KEY_FULLSCREEN = "f" Const $HT_KEY_SPACE = "{SPACE}" Global $btnAddRebuy[21] Global $btnRemovePlayer[21] Global $fFullscreen = False Global $aGuiInfo Global $aGuiInfo2 Global $guiWidth = 800 Global $guiHeight = 600 #Region Dimensions for Settings Screen ; Player Global $lblPlayerTop = 60 Global $playerLabelSpace = 24 ; Add Rebuy Button Global $btnRebuyLeft = 320 Global $btnRebuyWidth = 80 Global $btnRebuyHeight = 24 ; Remove Player Global $btnRemoveLeft = 408 Global $btnRemoveWidth = 80 Global $btnRemoveHeight = 24 #EndRegion Dimensions for Settings Screen $hMain = GUICreate("Timer", $guiWidth, $guiHeight, -1, -1, BitOR($WS_MAXIMIZEBOX,$WS_MINIMIZEBOX,$WS_SIZEBOX,$WS_THICKFRAME,$WS_SYSMENU,$WS_CAPTION,$WS_OVERLAPPEDWINDOW,$WS_TILEDWINDOW,$WS_POPUP,$WS_POPUPWINDOW,$WS_GROUP,$WS_TABSTOP,$WS_BORDER,$WS_CLIPSIBLINGS)) For $i = 1 To 5 Step 1 $btnAddRebuy[$i] = GUICtrlCreateButton("Button", $btnRebuyLeft, $lblPlayerTop + ($playerLabelSpace * $i), $btnRebuyWidth, $btnRebuyHeight) GUICtrlSetResizing($btnAddRebuy[$i], $GUI_DOCKAUTO) GuiCtrlSetState($btnAddRebuy[$i], $GUI_DISABLE) $btnRemovePlayer[$i] = GUICtrlCreateButton("Button", $btnRemoveLeft, $lblPlayerTop + ($playerLabelSpace * $i), $btnRemoveWidth, $btnRemoveHeight) ;GUICtrlSetResizing($btnRemovePlayer[$i], $GUI_DOCKAUTO) Next GUISetState(@SW_SHOW) HotKeySet($HT_KEY_FULLSCREEN, "Fullscreen") HotKeySet($HT_KEY_SPACE, "Redraw") While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop EndIf WEnd Func Fullscreen() If WinActive($hMain) Then If $fFullscreen Then ;GUISetStyle(BitOR($WS_MAXIMIZEBOX,$WS_MINIMIZEBOX,$WS_SIZEBOX,$WS_THICKFRAME,$WS_SYSMENU,$WS_CAPTION,$WS_OVERLAPPEDWINDOW,$WS_TILEDWINDOW,$WS_POPUP,$WS_POPUPWINDOW,$WS_GROUP,$WS_TABSTOP,$WS_BORDER,$WS_CLIPSIBLINGS), Default, $hMain) $aGuiInfo2 = WinGetPos($hMain) ConsoleWrite("******* Fullscreen *******" & @LF) ConsoleWrite("Win Left: " & $aGuiInfo2[0] & @LF) ConsoleWrite("Win Top: " & $aGuiInfo2[1] & @LF) ConsoleWrite("Win Width: " & $aGuiInfo2[2] & @LF) ConsoleWrite("Win Height: " & $aGuiInfo2[3] & @LF & @LF) ;WinMove($hMain, Default, $aGuiInfo[0], $aGuiInfo[1], $aGuiInfo[2], $aGuiInfo[3]) WinMove($hMain, Default, 238, 179, 816, 638) $fFullscreen = False $aCtrlInfo = ControlGetPos($hMain, "", $btnRemovePlayer[1]) ConsoleWrite("******* Button Info after Restored *******" & @LF) ConsoleWrite("Button Left: " & $aCtrlInfo[0] & @LF) ConsoleWrite("Button Top: " & $aCtrlInfo[1] & @LF) ConsoleWrite("Button Width: " & $aCtrlInfo[2] & @LF) ConsoleWrite("Button Height: " & $aCtrlInfo[3] & @LF & @LF) Else ;GUISetStyle($WS_POPUP, Default, $hMain) $aGuiInfo = WinGetPos($hMain) ConsoleWrite("******* Start Size *******" & @LF) ConsoleWrite("Win Left: " & $aGuiInfo[0] & @LF) ConsoleWrite("Win Top: " & $aGuiInfo[1] & @LF) ConsoleWrite("Win Width: " & $aGuiInfo[2] & @LF) ConsoleWrite("Win Height: " & $aGuiInfo[3] & @LF & @LF) WinMove($hMain, Default, 0, 0, @DesktopWidth, @DesktopHeight) $fFullscreen = True $aCtrlInfo = ControlGetPos($hMain, "", $btnRemovePlayer[1]) ConsoleWrite("******* Button Info after Fullscreened *******" & @LF) ConsoleWrite("Button Left: " & $aCtrlInfo[0] & @LF) ConsoleWrite("Button Top: " & $aCtrlInfo[1] & @LF) ConsoleWrite("Button Width: " & $aCtrlInfo[2] & @LF) ConsoleWrite("Button Height: " & $aCtrlInfo[3] & @LF & @LF) EndIf Else HotKeySet($HT_KEY_FULLSCREEN) Send($HT_KEY_FULLSCREEN) HotKeySet($HT_KEY_FULLSCREEN, "Fullscreen") EndIf EndFunc Func Redraw() Local $aCtrlInfo $aCtrlInfo = ControlGetPos($hMain, "", $btnRemovePlayer[1]) ConsoleWrite("******* Button Info before Redraw *******" & @LF) ConsoleWrite("Button Left: " & $aCtrlInfo[0] & @LF) ConsoleWrite("Button Top: " & $aCtrlInfo[1] & @LF) ConsoleWrite("Button Width: " & $aCtrlInfo[2] & @LF) ConsoleWrite("Button Height: " & $aCtrlInfo[3] & @LF & @LF) GuiCtrlDelete($btnRemovePlayer[1]) $btnRemovePlayer[1] = GUICtrlCreateButton("Button", $aCtrlInfo[0], $aCtrlInfo[1], $aCtrlInfo[2], $aCtrlInfo[3]) ;GUICtrlSetResizing(-1, $GUI_DOCKAUTO) $aCtrlInfo = ControlGetPos($hMain, "", $btnRemovePlayer[1]) ConsoleWrite("******* Button Info after Redraw *******" & @LF) ConsoleWrite("Button Left: " & $aCtrlInfo[0] & @LF) ConsoleWrite("Button Top: " & $aCtrlInfo[1] & @LF) ConsoleWrite("Button Width: " & $aCtrlInfo[2] & @LF) ConsoleWrite("Button Height: " & $aCtrlInfo[3] & @LF & @LF) EndFunc Is there a way to fix this, or is the issue built in to how windows get resized?
  5. I have had trouble with a gui I need to be full screen I have seen a lot of topics but they dont work for me. my GUI is a very simple window you can I now use @SW_MAXIMIZE but it covers up the taskbar. (not good) please help Thanks in advance
  6. I am Pretty Happy for my script so far It works as Intended. HotKeySet("f", "Poof") ;Triggers xxx HotKeySet("d", "Poof2") ;Triggers xxx MsgBox(0, "Running", "Running") ;MessageBox Informing that the Script is Running While 1 Sleep(100) WEnd Func Poof2() ;When User Presses D Do: Send("q") MouseClick("left") Send("{tab}") Sleep(10) EndFunc Func Poof() ;When User Presses F Do: Send("w") MouseClick("left") Send("{tab}") Sleep(10) Send("w") MouseClick("left") Send("{tab}") Sleep(10) Send("w") MouseClick("left") Send("{tab}") Sleep(10) Send("w") MouseClick("left") Send("{tab}") Sleep(10) Send("w") MouseClick("left") Send("{tab}") Sleep(10) Send("1") EndFunc But Not in FullScreen ! It Simply Does Not Work in the Application it is supposed to Run in, when i Run the Application in Fullscreen ! Why? I don't get it at all! Ive Beed Adviced to use ControlSend()So i did ! And.. Nothing! ControlSend("Application", "", "", "{tab}") Works like Send (In Windowed, But not FullScreen) Send("w") MouseClick("left")I Got Mouseclick to work 50% ControlClick("Application", "", "" "right", 1)But To Work 100% The Mouseclick has to Occur at the Current Location of the Arrow, Not in the Center of the window. But It appears that ControlClick only is Capable of "Clicking" in a Set X, Y Position. So that can't be the right Command.. Perhaps Some form of Advanced ControlSend String? BUT AGAIN ! WORKS ONLY IN WINDOWED MODE ! The Last one is Simple.. ControlSend("Application", "", "", "d") "d" Is not the Correct Syntax.. Again.. I Would think this can be done by a Advanced ControlSend string. But Then Again.. Why Is Send AND ControlSend Not Working for me in FullScreen? Bonus Info: I Used AutoIt Window Info While the "Application" was in Windowed Mode, So i am fairly shure that i got the Name Right (It Works in Windowed Mode - Why Should the Name be Diffrent in FullScreen?) OK ! Here Is How i got it to work I Compiled it and !!! Run As Administrator ! Sorry Guys ! Beginner Fail (My Third Day with Programming) It's Somewhat Tagged, So hope this will at least help other Newbies
  7. CrossHairs (Full-Screen) This UDF utilizes GUI manipulation to simulate full-screen crosshairs. Example code is included. An additional UDF is bundled in the package: _MouseCursorFuncs (not a full-featured UDF, just one with functions I use now and then). Note that this would be better controlled using a Mouse Event Handler. *edits 3/26/2010: Added a new function to alter the properties of the Crosshairs (_XHairSetDisplayProps) - better than destroying/recreating the Crosshairs!Updated the example to show how the new function can be used. It also shows a way to deal with Screen-resolution changes.Example code: #include <_CrossHairs.au3> #include <_MouseCursorFuncs.au3> ; =============================================================================================================================== ; <TestCrossHairs.au3> ; ; Simple test of _Crosshairs UDF. Employs the _MouseCursorFuncs UDF as well ; ; Author: Ascend4nt ; =============================================================================================================================== ;#NoTrayIcon AutoItSetOption("TrayAutoPause",0) ; =============================================================================================================================== ; GLOBAL VARIABLES ; =============================================================================================================================== Global $bHKPressed=False,$bPropertyHKPressed=False,$iResolutionchangeMsg=0 ; =============================================================================================================================== ; HOTKEY FUNCTIONS ; =============================================================================================================================== ; ESC Key Pressed: Func _HotKeyPressed() $bHKPressed=True EndFunc ; ALT-P Pressed: Func _ChangeXHairProperties() ; 'Grow' the crosshairs and set them to Red, or alternately shrink them and set them to whitish If Not $bPropertyHKPressed Then _XHairSetDisplayProps(25,25,0xFF0000) Else _XHairSetDisplayProps(8,8,0xF0F0F0) EndIf $bPropertyHKPressed=Not $bPropertyHKPressed EndFunc ; =============================================================================================================================== ; WINDOWS MESSAGE HANDLER FUNCTIONS ; =============================================================================================================================== ; =============================================================================================================================== ; Func _Resolutionchanged($hWnd,$iMsg,$wParam,$lParam) ; ; Note this registers multiple-monitor settings changes too, but will only report on the primary monitor's resolution ; This is why we would need to call _WinAPI_GetSystemMetrics() to get the Virtual width/height ; =============================================================================================================================== Func _Resolutionchanged($hWnd,$iMsg,$wParam,$lParam) $iResolutionchangeMsg+=1 Return 'GUI_RUNDEFMSG' ; From <GUIConstantsEx.au3> Global Const $GUI_RUNDEFMSG = 'GUI_RUNDEFMSG' EndFunc ; =================================================================================================================== ; START MAIN CODE ; =================================================================================================================== Dim $aNewMousePos ; Create the crosshairs (but don't make them visible yet) _XHairInit(11,11) HotKeySet("{ESC}","_HotKeyPressed") ; Alt-p switches between two alternate CrossHair properties HotKeySet("!p","_ChangeXHairProperties") ; ----------------------------------------------------------------------------------------------------| ; Register Display-Mode changes to our function. ; NOTE that a GUI (*any* GUI) MUST be created or else the WM_DISPLAYCHANGE message won't be received ; Luckily, we've just created four GUI's using _XHairInit() and don't need to create any further ; ALSO note that this is called for *every* GUI that is created (for *just* X-Hairs, thats 4 calls) ; ----------------------------------------------------------------------------------------------------| GUIRegisterMsg(0x007E,"_Resolutionchanged") ; WM_DISPLAYCHANGE 0x007E _MouseHideAllCursors() ;~ _MouseReplaceAllCursors() ; Alternatively replace all cursors with custom crosshair While Not $bHKPressed ; 4 Messages are sent, 1 for each GUI created If $iResolutionchangeMsg>=4 Then ; Call with no arguments so that it will retain old properties but adjust to new resolution _XHairSetDisplayProps() $iResolutionchangeMsg=0 EndIf $aNewMousePos=MouseGetPos() _XHairShow($aNewMousePos[0],$aNewMousePos[1]) Sleep(5) WEnd ; Unregister Display Mode change function GUIRegisterMsg(0x007E,"") ; WM_DISPLAYCHANGE 0x007E ; Destroy Crosshairs _XHairUnInit() ; And restore all system cursors back to normal _MouseRestoreAllCursors()Download the ZIP from my site Ascend4nt's AutoIT Code License agreement: While I provide this source code freely, if you do use the code in your projects, all I ask is that: If you provide source, keep the header as I have put it, OR, if you expand it, then at least acknowledge me as the original author, and any other authors I creditIf the program is released, acknowledge me in your credits (it doesn't have to state which functions came from me, though again if the source is provided - see #1)The source on it's own (as opposed to part of a project) can not be posted unless a link to the page(s) where the code were retrieved from is provided and a message stating that the latest updates will be available on the page(s) linked to.Pieces of the code can however be discussed on the threads where Ascend4nt has posted the code without worrying about further linking.
  8. Full-Screen Crash Recovery 1.0 Crashed programs or games with screens that won't go away? Ctrl-Alt-Del, Alt-F4, Alt-Tab, and the Windows Key not working for ya? Do you find that you can 'almost' just get out of a game screen, but see constant flicker and only parts of the Windows desktop or mouse pointer? Want a fix for all that crap? Here it is. This bad boy will drop that program and kick it to the curb. public/style_emoticons/autoit/laugh.gif =P So what's it all about? This program uses Yashied's 'HotKey.au3' UDF to track keypresses and looks for this combo: Shift-Alt-Del (easy enough to remember eh?) Once you press that combo, my program will kick in and start analyzing the Windows on the screen - finding at most two windows that have full-screen or maximized status (there is a difference in Window's world). If the *active* window is the one that matches those criteria, it is chosen as the 'target' (otherwise, the first found non-Explorer window will be the target). Now, I'm all about safety (preventing accidents) - but I'm also all about killing something if it's really crashed. So what my program does on each hotkey press is this: On the 1st Shift-Alt-Del press, the program determines if the 'target' Window it finds is Hung/Crashed using a quick method. If Window reports that it is - it's killed on the spot, and the cycle resets. If not, it will save the 'target' info for the proceeding hotkey presses.On the 2nd Shit-Alt-Del press, the program will look again through the Window list. If it finds the same 'target', it will again check if the program is Hung/Crashed or Suspended (if so, kill & reset). This process can take up to 5 seconds, especially for a suspended app. Now, since the app was found twice, and is responding to messages, my program will attempt to alter a window's 'Always-on-Top' status and Minimize it. Sometimes (!!) this may solve the case (other times, not-so-much). On the 3rd Shift-Alt-Del press, the program will search again as above, compare the window to the last one, and if it's the same, and still in full-screen/maximized state, it will finally say 'screw it', and just terminate the application.At each step, you'll get a speaker Beep confirmation (if you don't have an internal PC speaker, you can alter the Beeps to 'SoundPlay()' or somesuch). In any case, the Beeps are like this. (thanks montymintypie for suggesting this): low beep = no window found in maximized/full-screen statushigh beep = window found, but Windows isn't reporting it is hungdual-tone beeps (mid-then-high) = Window terminated.In addition, if the hotkey to close the app down is pressed, you'll get a reverse dual-tone-beep (high-low) meaning its shut down. By the way, that hotkey is: Shift-ALT-Q (terminate my program) The reason for this 'third-times-a-charm' thinking is that: You want to be sure that you really wanted to close that app (if for some reason Windows reports the app as crashed though, there's no 2nd or 3rd time),Sometimes minimizing actually does work, andIf you were able to close/minimize the application, and switched to another and maximized/full-screened it, the code will recognize that the screen is no longer in that maximized/full-screen state, and simply reset its internal variables (and the HotKey-press count will reset to 0)NOTES: Any window owned by Explorer.exe process will be IGNORED, with the exception that if explorer.exe itself has crashed (and pulled other windows into its vortex), it will allow it to be terminated (and then restarted). But under typical circumstances, it will differentiate the Explorer Windows from regular Application/Game windows, and by doing so, prevent accidental closure of the main Windows interface!As stated above, any time the same app is not found to be minimized, it will reset the internal count and variables, so the HotKey-press count will reset to 0.Get it now at http://sites.google.com/site/ascend4ntscode/fullscreencrashrecovery A list of the major enhancements/changes since I started (prior to v. 1.0!): Added two methods for detecting if an application is hung/crashed/suspendedRewrote a LOT of the code based on my own experiences with crashes (both in XP and Vista, applications and games)Separated functions to make it easier to understand and centralized Debug messages in case you'd like to output them to a log.Rewrote the main function AGAIN, due to certain Win..() functions in AutoIT failing to work on crashed applications (I've remarked about these functions and my experiences with them in the source code right under the header) Added better 'beep-notifications' (thanks to montymintypie for getting me to do that)Ascend4nt's Program License agreement: While I provide this program freely, if you do distribute the program, the only requirements I have are: I (Ascend4nt) must be Acknowledged as the authorThe License agreement document (in the ZIP file) must be kept bundled together with the code.A link must be provided to the page containing the program (linked above)Do *not* under any circumstances 'reverse-engineer' the code - in other words, do not pull out the source code. I may distribute the source code in the future - but if you have or find an old copy of my code, do not distribute it without my consent, which must be obtained through the 'ContactMe' page on this site.
×
×
  • Create New...