Jump to content

GUICtrlCreateInput


Nova
 Share

Recommended Posts

Heres a simple gui password prompt script,with 1 problem I dont want the gui which has the inputbox in it to have a tiltle or caption or border !

#include <GUIConstants.au3>

;Creates Gui
$Gui = GUICreate("Gui", @DesktopWidth, @DesktopHeight, -1, -1, $WS_POPUP)
GUISetBkColor(000000)

;Setting background image
$Background = GUICtrlCreatePic("C:\Images\Background.bmp", -1, -1, @DesktopWidth, @DesktopHeight)
GuiSetState () 

GUICreate("Log on", 320,30, @DesktopWidth/2-30, @DesktopHeight/2-50, -1,0x00000018); WS_EX_ACCEPTFILES
GUICtrlSetState(-1,$GUI_ACCEPTFILES)
$password = GUICtrlCreateInput ( "", 10,  5, 300, 20)
$btn = GUICtrlCreateButton ( 40, 75, 60, 20)

GuiSetState () 

$msg = 0
While $msg <> $GUI_EVENT_CLOSE
      $msg = GUIGetMsg()
      Select
          Case $msg = $btn
              exitloop
      EndSelect
Wend
$password=GUIRead($password)
if $password = ("correct") then
          MsgBox(4096,"", "Bingo.")
else
         MsgBox(4096,"", "Er wrong.")
endif

I have tryed many varations of the below code but with the addition of $WS_POPUP only the first GUI appears and the GUI with the inputbox just becomes invisible !

GUICreate("Log on", 320,30, @DesktopWidth/2-30, @DesktopHeight/2-50, -1,$WS_POPUP,0x00000018)

Any ideas how I can display the gui with the input and make it so it has no title,caption,border ect ! All I want is the inputbox

Link to comment
Share on other sites

Here it is:

#include <GUIConstants.au3>

;Creates Gui
$Gui = GUICreate("Gui", @DesktopWidth, @DesktopHeight, -1, -1, $WS_POPUP)
GUISetBkColor(000000)

;Setting background image
$Background = GUICtrlCreatePic("C:\Images\Background.bmp", -1, -1, @DesktopWidth, @DesktopHeight)
GuiSetState ()

$style1 = BitOR($WS_POPUP, $WS_SYSMENU)
GUICreate("Log on", 200, 30, @DesktopWidth/2-30, @DesktopHeight/2-50, $style1, $WS_EX_ACCEPTFILES)
GUICtrlSetState(-1,$GUI_ACCEPTFILES)
$password = GUICtrlCreateInput ( "", 10,  5, 300, 20)
$btn = GUICtrlCreateButton ( 40, 75, 60, 20)

GuiSetState ()

$msg = 0
While $msg <> $GUI_EVENT_CLOSE
     $msg = GUIGetMsg()
     Select
         Case $msg = $btn
             exitloop
     EndSelect
Wend
$password=GUIRead($password)
if $password = ("correct") then
         MsgBox(4096,"", "Bingo.")
else
        MsgBox(4096,"", "Er wrong.")
endif
Edited by SlimShady
Link to comment
Share on other sites

Ok 1 last problem,ive removed the enter button and instead set a hotkey to the enter button which I want to use to verify the password entered !

But even when the pass is right I get the msgbox saying "Er wrong"

#include "GUIConstants.au3"

$Gui = GUICreate("Gui", @DesktopWidth, @DesktopHeight, -1, -1, $WS_POPUP,0x00000018)
$Background = GUICtrlCreatePic("C:\Nova-Menu\Images\Background.bmp", -1, -1, 1024, 768)

;Password prompt
$Input = GUICtrlCreateInput ( "", @DesktopWidth/2-50,  @DesktopHeight/2-45, 300, 20)
GUISetBkColor(000000)

;Positioning of pics
GuiSetState ()
GUICtrlSetState ( $Input, $GUI_FOCUS )
$password=GUIRead($Input)
HotKeySet("{ENTER}", "Enter")   

Func Enter()

 if $password = ("correct") then
          MsgBox(4096,"", "Bingo.")
 else
         MsgBox(4096,"", "Er wrong.")
 endif
 
EndFunc  

while 1
   sleep(10)
wend
Link to comment
Share on other sites

Figured it out,it was painfully obvious once I stood back and took a fresh look at my code

This line of code should have been inside the enter function !

$password=GUIRead($Input)

Duh !

Edited by nova
Link to comment
Share on other sites

To quote myself !

Ok 1 last problem

I guess not !

Ok inputbox has an option to set enter charas as what ever u want typically * can this be done with

GUICtrlCreateInput ? I dont see anything in the help file about this !

Also is there a way to set the font of the entered characters ?

it seems that no matter what size I make the input filed height teh font stays the same !

Link to comment
Share on other sites

  • Developers

To quote myself !

I guess not !

Ok inputbox has an option to set enter charas as what ever u want typically * can this be done with

GUICtrlCreateInput ? I dont see anything in the help file about this !

Also is there a way to set the font of the entered characters ?

it seems that no matter what size I make the input filed height teh font stays the same !

<{POST_SNAPBACK}>

Style: $ES_PASSWORD

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...