Re: Password Prompt - How?
- Posted by Louis at cwshop.com Oct 01, 2003
- 572 views
Thanks, Derek. I had come to the conclusion that Win32Lib was "thin",= meaning that it didn't hide much of Microsoft's underlying structure, as= opposed to a language like Visual Basic which presents a completely= different model of Windows programming. I had asked before about a= Windows Programming reference, but got no reply then. Since I am= unfamiliar with Windows programming, I am relying completely on your= Win32Lib documentation and the examples. I knew I needed a more extensive= reference. To answer your question, I had assumed that if I set up handlers and ran= WinMain() and windows opened, I could close the window and do it again.= When that didn't work, I set up handlers for the password window and= called openDialog() without calling WinMain(). The documentation seemed= to indicate it would obey the handlers and wait for input, but it didn't.= Your technique is clearly the right way, I just don't (yet) have a proper= reference for Windows programming, so I greatly appreciate your help. To change the subject, I am impressed with the ease with which Euphoria= programs can be written, though Windows programming is a bit more= difficult. Has anyone put some thought in to a "Visual Euphoria" library= which supports Windows programming in a simplified way? I'm thinking of a= Window Designer program which the programmer uses to graphically arrange= his fields, checkboxes, etc. It then creates an include file which= supports simple calls like this: sResults =3D wPassword({default values, optional parms}) -- Opens a window= to prompt for a password sPW =3D GetField(sResults, "pw") -- Extract the value of a field from the= sResults sequence ... sResults =3D wMaininput({default values, optional parms}) -- Opens a window= data entry form sName =3D GetField(sResults, "name") sAdr =3D GetField(sResults, "adr") sPhone =3D GetField(sResults, "phone") sButton =3D GetButton(sResults) -- Determine which button caused the window= to close, eg. OK, Cancel, etc. ... wPassword and wMaininput are previously defined window forms. sResults is a compound sequence (structure) which receives the output of= the window. Optional parms could control which field got initial focus, provide the= ability to leave the window open for a specified time, then close it= automatically, etc. At the moment, I haven't thought about how these windows could be= interactive (e.g. validity checking), but much could be accomplished by a= simple input window, and this model seems more Euphoria-like. Louis. *********** REPLY SEPARATOR *********** On 10/1/2003 at 6:37 AM Derek Parnell wrote: > > >----- Original Message ----- >From: <Louis at cwshop.com> >To: "EUforum" <EUforum at topica.com> >Sent: Wednesday, October 01, 2003 4:08 AM >Subject: Re: Password Prompt - How? > > >> OK, The secret undocumented control ES_PASSWORD works. > >It is documented, just not in the stuff I supply with win32lib. It is a >standard flag supplied by Microsoft and its documented in the hundreds of >books about Windows programming AND in the Microsoft SDK. These flags are >not dreamed up by myself - they are what Microsoft have decided upon. > >>Now another question. >> >> I understand how to set up handlers and call WinMain(). I have >>always assumed that when the window is closed, WinMain() returns >>and execution resumes. That's where I close the database. > >True, execution does continue after WinMain() returns, but no more calls >to win32lib code should execute. Closing the database here is okay to do. > >>I tried to use a second WinMain() to open another window and found >>that it didn't work. Then I found WinMain is documented that >>when it closes, the application also closes. > >Well, more specifically, when WinMain returns, all the windows have been >destroyed and resources returned to Windows. The application is expected >to end and no further calls to routines inside win32lib are permitted. > >Why did you try to call WinMain again, after it had returned? > >>I tried openDialog, >>which says it activates handlers and waits for input. It >>doesn't. It flashes the window on the screen and closes it >>immediately. > >Is this after WinMain had returned? > >> What I am trying to do is open a window to prompt for a password. >>The user types in the EditText field and clicks an "OK" button >>(or presses Enter). The window closes and if the password was >>correct, the main application window opens. (Has anyone seen >>example code?) I'm not asking someone to write this for me, >>just give me some hints as to what functions to use. > >The w32HOpen event is invoked just PRIOR to a window being opened. You can >use this event to show your password form and process the user's >interaction with it before the main window is displayed. > >procedure Open_MainWin(integer self, integer event, sequence parms) > openDialog(PasswordForm) >end procedure >setHandler(MainWin, w32HOpen, routine_id("Open_MainWin")) > >Is that enough of a hint? > >And by the way, the w32HActivate event occurs AFTER the window is opened. > >> Where would I find things like ES_PASSWORD documented? >>Would this be in a "Windows Programming" text? > >Oh yes. There are thousands of special symbol names used when programming >for Windows and I do not intend to repeat their documentation in the stuff >I release with win32lib. The Microsoft documenation is already in the >public domain at http://msdn.microsoft.com and the many Windows >programming books. I recommend the book called "Windows Programming" by >Charles Pretzold for API level programming, and "About Face, The >Essentials of User Interface Design" by Alan Cooper for how make GUI >programming effective. > >-- >Derek