Jump to content
Sign in to follow this  

WinAPI question

Recommended Posts

Hi guys

I want to add this command to my GUI : 


this should tell windows that it is a password protected screensaver and that the default ways to close the app aren't available.

the problem is that when i execute the function i get a message saying that SPI_SCREENSAVERRUNNING, void and old isn't a function

also tried the _WinAPI_SystemParametersInfo (SPI_SCREENSAVERRUNNING,True,(void*)&old,0) but this also throws errors

anyone who knows how to change this code into a usable version for my script?

I found that code here : 

and some info here : http://msdn.microsoft.com/en-us/library/ms724947%28VS.85%29.aspx

FYI, i'm creating an app in a kiosk-like mode but the user shouldn't be able to close it, they can only see my autoit app and that app will provide them with a browser that will close after an hour until the next person "logs in" on the autoit app. (wouldn't want you guys to think i'm creating a scam-app or something)

Hope someone can help


An example (I've tried it like this but this doesn't work)

; Includes
#include <IE.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>
; Vars
$AppTitle       =   "DTP Kiosk"
$AppDefaultURL  =   "http://www.google.com"
$AppExitPwd     =   "test"
$AppExitMsg     =   "Provide the password to close " & @CRLF & $AppTitle
; Disable Hotkeys
HotKeySet       ("{ESC}", "_DoNothing")
; Show InputBox with password question to exit the app
HotKeySet       ("!{F4}", "_Exit")
HotKeySet       ("^{F8}", "_Exit")
$FS_Window      =   GUICreate ($AppTitle, @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP)

GUISetState (@SW_SHOW, $FS_Window)

; Need this to work to disable default hotkeys like ctrl+alt+del, crtl+esc, alt+tab, ...
_WinAPI_SystemParametersInfo (97,True,0,0)

Sleep (1000)
$FS_IE_Window   =   _IECreate ($AppDefaultURL)
_IEPropertySet ($FS_IE_Window, "theatermode", True)

; Keep the GUI open
While 1
    Sleep (1000)
; Functions
Func _Exit ()
    $ExitPhrase =   InputBox ($AppTitle, $AppExitMsg, "", "*", -1, -1, Default, Default, 30, $FS_Window)
    If $ExitPhrase = $AppExitPwd Then
        ProcessClose ("iexplore.exe")
        _WinAPI_SystemParametersInfo (97,False,0,0)
Func _DoNothing ()

Hope this helps...

Like this you can only close the app when you press ctrl+F8 and provide the password from the $AppExitPwd var

Edited by colombeen

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  

  • Create New...