Jump to content
Sign in to follow this  
skafreak_510

Checkbox error

Recommended Posts

skafreak_510

It Errors out on $BS_AUTOCHECKBOX

Why?

#include <GUIConstants.au3>
#include <string.au3>

dim $save
dim $user
dim $password
dim $ufill = IniRead("C:\Documents and Settings\BDelanghe\Desktop\09tk79.ini", "section1", "key", "")
$ufill = _StringEncrypt ( 0, $ufill, "redtail" , 1 )
dim $pfill = IniRead("C:\Documents and Settings\BDelanghe\Desktop\09tk79.ini", "section1", "key2", "")
$pfill = _StringEncrypt ( 0, $pfill, "redtail" , 1 )

$msg = GUICreate("Login to SAI", 270, 120)
GUICtrlCreateLabel("Username:", 30, 10,90,-1)
GUICtrlCreateInput ( $ufill, 100, 10,150) 
GUICtrlCreateLabel("Password:", 30, 40)
GUICtrlCreateInput ( $pfill, 100, 40,150,-1,$ES_PASSWORD) 
$login = GUICtrlCreateButton("Log In", 100, 90, 80,-1,$BS_DEFPUSHBUTTON )
GUICtrlCreateCheckbox ( "Save my username/password.",30,62,-1,-1,$BS_AUTOCHECKBOX);;<--It wont let me use;;$BS_AUTOCHECKBOX
If $ufill = "" Then
        GUICtrlSetState ( 8, $GUI_UNCHECKED )
Else
    GUICtrlSetState ( 8, $GUI_CHECKED )
endif
GuiSetState()

While 1
  $msg = GUIGetMsg()

  Select

    Case $msg = $GUI_EVENT_CLOSE
    GUIDelete ()
    Exit
    Exitloop

    Case $msg = $login
    $user = GUICtrlRead ( 4 )
    $password = GUICtrlRead ( 6 )
    If $user = "" OR $password = "" Then
     MsgBox (262160,"Error","No Username/Password.")
    ContinueLoop
    Else    
    $save = GUICtrlRead (8)
    Call ("save")
    GUIDelete ()
    EndIf
    ExitLoop
  EndSelect
WEnd 

func save()
  If $save = "1" Then
    $euser = _StringEncrypt ( 1, $user, "redtail" , 1 )
    IniWrite("C:\Documents and Settings\BDelanghe\Desktop\09tk79.ini", "section1", "key", $euser)
    $epassword = _StringEncrypt ( 1, $password, "redtail" , 1 )
    IniWrite("C:\Documents and Settings\BDelanghe\Desktop\09tk79.ini", "section1", "key2", $epassword)
    Else
    IniDelete("C:\Documents and Settings\BDelanghe\Desktop\09tk79.ini", "section1", "key")
    IniDelete("C:\Documents and Settings\BDelanghe\Desktop\09tk79.ini", "section1", "key2")
    
  EndIf
Endfunc
Edited by skafreak_510

Share this post


Link to post
Share on other sites
Josbe

That works fine for me.

Please, specify your problem with the Checkbox.

BTW, if you have any problem with the variable, add this line to "GUIConstants.au3" file.

Global Const $BS_AUTOCHECKBOX = 0x3

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.