anunes Posted February 16, 2009 Share Posted February 16, 2009 Hi, I'm new and I've a problem with my simple program... It open a login window and gets the login and password of the user, and should close the login window and open the program window... but, I don't know how to do this... I have the two GUIs, the login one and the program window one... what I want is: when the user type the login and passwod and clicks on OK, it's close the login form and open the program form... How do I do this? Thanks Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 16, 2009 Moderators Share Posted February 16, 2009 anunes,There are many ways you could do this, but without seeing your code it is difficult to decide which would work best.If you are using a While...WEnd loop to check for the GUIGetMsg() return value, then a GUIDelete for your LogIn GUI, followed by an ExitLoop to escape from the While...WEnd loop into the program GUI code seems a good ploy.Post your code - you are likely to get a better answer!M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
anunes Posted February 16, 2009 Author Share Posted February 16, 2009 (edited) anunes, There are many ways you could do this, but without seeing your code it is difficult to decide which would work best. If you are using a While...WEnd loop to check for the GUIGetMsg() return value, then a GUIDelete for your LogIn GUI, followed by an ExitLoop to escape from the While...WEnd loop into the program GUI code seems a good ploy. Post your code - you are likely to get a better answer! M23 Thanks man, here's my login code: expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $formLogin = GUICreate("Login", 239, 132) $bOK = GUICtrlCreateButton("&OK", 40, 88, 75, 25, 0) $bCancelar = GUICtrlCreateButton("&Cancelar", 136, 88, 75, 25, 0) $lUsuario = GUICtrlCreateLabel("Usuário", 48, 32, 40, 17) $lSenha = GUICtrlCreateLabel("Senha", 53, 56, 35, 17) $iUsuario = GUICtrlCreateInput("", 96, 30, 121, 21) $iSenha = GUICtrlCreateInput("", 96, 54, 121, 21, $ES_PASSWORD) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### Global $user Global $passwd While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $bCancelar MsgBox(0, "Obrigado", "Obrigado por testar o progama!") Exit Case $bOK $user = GUICtrlRead($iUsuario) $passwd = GUICtrlRead($iSenha) If $user = "" Or $passwd = "" Then MsgBox(16, "Erro", "Você precisa digitar usuário e senha") Else ExitLoop EndIf EndSwitch WEndoÝ÷ Ø ÝêÞßÛ-çè®jì0whÁ«¢+Ø¥¹±Õ±Ðí ÕÑѽ¹ ½¹ÍѹÑ̹ÔÌÐì(¥¹±Õ±ÐíU% ½¹ÍѹÑÍà¹ÔÌÐì(¥¹±Õ±Ðí]¥¹½ÝÍ ½¹ÍѹÑ̹ÔÌÐì((I¥½¸MQIP-½U$ÍÑ¥½¸½É´ô(ÀÌØí½ÉµAɽɵôU% ÉÑ ÅÕ½Ðí9½Ù¼AɽɵÅÕ½Ðì°ÌÐÔ°ÄàÔ°ÄäÌ°ÄÈÔ¤(ÀÌØíÉ¥ÈôU% Ñɱ ÉÑ ÕÑѽ¸ ÅÕ½ÐìµÀíÉ¥ÈÅÕ½Ðì°ÈаÄØ°ÜÔ°ÈÔ°À¤(ÀÌØí9½Ù¼ôU% Ñɱ ÉÑ ÕÑѽ¸ ÅÕ½ÐìµÀí9½Ù¼ÅÕ½Ðì°ÈÐà°ÄØ°ÜÔ°ÈÔ°À¤(ÀÌØíM±ÙÈôU% Ñɱ ÉÑ ÕÑѽ¸ ÅÕ½ÐìµÀíM±ÙÈÅÕ½Ðì°ÈаÄÈà°ÜÔ°ÈÔ°À¤(ÀÌØíM¥ÈôU% Ñɱ ÉÑ ÕÑѽ¸ ÅÕ½ÐíM¤µÀíÈÅÕ½Ðì°ÈÐà°ÄÈà°ÜÔ°ÈÔ°À¤)U%MÑMÑÑ¡M]}M!=¤(¹I¥½¸9-½U$ÍÑ¥½¸()]¡¥±Ä($ÀÌØí¹5ÍôU%Ñ5Í ¤(%MÝ¥Ñ ÀÌØí¹5Í($% ÍÀÌØíU%}Y9Q} 1=M($$%á¥Ð()¹MÝ¥Ñ )]¹ How, when the login form closes, do I do to this window open? Edited February 16, 2009 by anunes Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 16, 2009 Moderators Share Posted February 16, 2009 anunes,Just as I suggested earlier, change your Case $bOK to read:Case $bOK $user = GUICtrlRead($iUsuario) $passwd = GUICtrlRead($iSenha) If $user = "" Or $passwd = "" Then MsgBox(16, "Erro", "Você precisa digitar usuário e senha") Else GUIDelete($formLogin) ExitLoop EndIfThen you just add your second script to the end of the first one (there is no need to copy the includes).In case you are interested, there is a thread here which has a good login script if you would like some hints as to how deal with usernames/password pairs.M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
anunes Posted February 16, 2009 Author Share Posted February 16, 2009 anunes, Just as I suggested earlier, change your Case $bOK to read:Case $bOK $user = GUICtrlRead($iUsuario) $passwd = GUICtrlRead($iSenha) If $user = "" Or $passwd = "" Then MsgBox(16, "Erro", "Você precisa digitar usuário e senha") Else GUIDelete($formLogin) ExitLoop EndIf Then you just add your second script to the end of the first one (there is no need to copy the includes). In case you are interested, there is a thread here which has a good login script if you would like some hints as to how deal with usernames/password pairs. M23 Hey M23, thank you very much, it's working fine now! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now