Sign in to follow this  
Followers 0
Hello Me You

[HELP] Protect a window with password

3 posts in this topic

Help me protect the following window with pass.

Here is what I want:

1) A small window opens. Asks for password.

2) If password is correct, show the other window.

3) If password is wrong, then a MsgBox says: "Wrong Password" and with buttons (Retry & Cancel).

Here is my main window witch I want to protect:

#include <GuiConstants.au3>

GuiCreate("Enter Text To Notepad", 392, 316,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

$Label_info = GuiCtrlCreateLabel("Enter text below:", 50, 20, 280, 20)
$Input_text = GuiCtrlCreateInput("text", 50, 100, 290, 20)
$Button_ok = GuiCtrlCreateButton("Button3", 50, 210, 290, 40)
$Label_ok = GuiCtrlCreateLabel("Click ok button to send text to notepad", 70, 160, 240, 20)

GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $Button_ok
        Run("notepad.exe")
        WinWaitActive("Untitled - Notepad")
        Send(GUICtrlRead($Input_text))
EndSelect
WEnd
Exit

Random

Share this post


Link to post
Share on other sites



#include <GuiConstants.au3>

$password = "mypass";
$in = InputBox ("Password required", "Please enter the password to continue...")
if @error then exit
if $in <> $password then
msgbox(0, "", "Incorrect password.")
exit
endif


GuiCreate("Enter Text To Notepad", 392, 316,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

$Label_info = GuiCtrlCreateLabel("Enter text below:", 50, 20, 280, 20)
$Input_text = GuiCtrlCreateInput("text", 50, 100, 290, 20)
$Button_ok = GuiCtrlCreateButton("Button3", 50, 210, 290, 40)
$Label_ok = GuiCtrlCreateLabel("Click ok button to send text to notepad", 70, 160, 240, 20)

GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $Button_ok
        Run("notepad.exe")
        WinWaitActive("Untitled - Notepad")
        Send(GUICtrlRead($Input_text))
EndSelect
WEnd
Exit

basically what you want without the abort retry message box.

Share this post


Link to post
Share on other sites

#include <GuiConstants.au3>

$password = "mypass";
$in = InputBox ("Password required", "Please enter the password to continue...")
if @error then exit
if $in <> $password then
msgbox(0, "", "Incorrect password.")
exit
endif
GuiCreate("Enter Text To Notepad", 392, 316,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

$Label_info = GuiCtrlCreateLabel("Enter text below:", 50, 20, 280, 20)
$Input_text = GuiCtrlCreateInput("text", 50, 100, 290, 20)
$Button_ok = GuiCtrlCreateButton("Button3", 50, 210, 290, 40)
$Label_ok = GuiCtrlCreateLabel("Click ok button to send text to notepad", 70, 160, 240, 20)

GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $Button_ok
        Run("notepad.exe")
        WinWaitActive("Untitled - Notepad")
        Send(GUICtrlRead($Input_text))
EndSelect
WEnd
Exit

basically what you want without the abort retry message box.

thanks a lot man, my problem solved

Random

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  
Followers 0