Sign in to follow this  
Followers 0
skafreak_510

How do you make pechecked boxes?

3 posts in this topic

how do you make an checkedbox in a GUI?

#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", "")
If $ufill = "" Then
    $check =;;unchecked box
    Else $check=;;checked box
endif
$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)
GUICtrlCreateCheckbox ( "Save my username/password.", 30, 62,-1,-1, $check,)
GuiSetState()

While 1
  $msg = GUIGetMsg()

  Select
    Case $msg = $login
    $user = GUICtrlRead ( 4 )
    $password = GUICtrlRead ( 6 )
    $save = GUICtrlRead (8)
    Call ("save")
      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

Share this post


Link to post
Share on other sites



sorry just found it thanks

Share this post


Link to post
Share on other sites

I modified yours a little.

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

dim $save
dim $user
dim $password
dim $ufill
dim $pfill

$ufill = IniRead("C:\Documents and Settings\BDelanghe\Desktop\09tk79.ini", "section1", "key", "")
$pfill = IniRead("C:\Documents and Settings\BDelanghe\Desktop\09tk79.ini", "section1", "key2", "")

$msg = GUICreate("Login to SAI", 270, 120)
GUICtrlCreateLabel("Username:", 30, 10,90,-1)
$username_input = GUICtrlCreateInput ( "", 100, 10,150);--- $ufill
GUICtrlCreateLabel("Password:", 30, 40)
$pass_input = GUICtrlCreateInput ( "", 100, 40,150,-1,$ES_PASSWORD);--- $pfill
$login = GUICtrlCreateButton("Log In", 100, 90, 80)
$save_info = GUICtrlCreateCheckbox("Save my username/password.", 30, 62,-1,-1)
   If $ufill <> "" Then
      $ufill = _StringEncrypt(0, $ufill, "redtail", 1)
      $pfill = _StringEncrypt(0, $pfill, "redtail", 1)
      MsgBox(64, "Test", "$pfill: " & @CRLF & $pfill)
      GUICtrlSetState($save_info, $GUI_CHECKED)
      GUICtrlSetData($username_input, $ufill)
      GUICtrlSetData($pass_input, $pfill)
   EndIf
   
GuiSetState()

While 1
  $msg = GUIGetMsg()

  Select
    Case $msg = $GUI_EVENT_CLOSE
       GUIDelete()
       EXIT
       
    Case $msg = $login
      $user = GUICtrlRead($username_input)
      $password = GUICtrlRead($pass_input)
      If GUICtrlRead($save_info) = $GUI_CHECKED Then
         Save($user, $password)
      EndIf
      ExitLoop

  EndSelect
WEnd

func Save($username, $passw)
   $euser = _StringEncrypt (1, $username, "redtail", 1)
   $epassword = _StringEncrypt(1, $passw, "redtail" , 1)
   IniWrite("C:\Documents and Settings\BDelanghe\Desktop\09tk79.ini", "section1", "section1", $euser)
   IniWrite("C:\Documents and Settings\BDelanghe\Desktop\09tk79.ini", "section1", "section1", $epassword)
Endfunc

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