I have created a login form that is set as the project's startup form. This form contains code to check a password against a database. If correct, this login form needs to be closed, and the program's main form loaded so that the user can go on his merry way. (Pretty much the procedure most secured apps use I would think.)
The problem I'm running into is -- I can't get both the program's main form opened, and the login form closed without the entire application unloading.
Can someone recommend a way to handle this?
Hi Dan - you could try somethign like this post: http://www.planetsquires.com/protect/forum/index.php?topic=939.msg9065#msg9065
Very nice, thanks! I searched the forums, but obviously missed this one.
I'll give it a try after my day job!
Here is a minimal project for asking for a license key.
It simply writes the license key to an ini file. If the license key is there the program will start, if not it will open a dialog to enter a valid license key. Again if the license key is valid the program will save the key and start the program, if the license key is not valid the program will be terminated.
You would need to write your routines to check for the validity of a license key. Also where you want to store the license information, encryption, etc.
Paul - thanks, we now have a working login screen.
Now here's a little twist... using this method, the startup form is shown first, and then the login form as a modal. Is there a way to hide the startup form until the login form is successful?
This is how I did mine:
Function FRMMAIN_WM_CREATE ( _
hWndForm As Dword, _ ' handle of Form
ByVal UserData As Long _ ' optional user defined Long value
) As Long
'Show login dialog
Local nReturn As Integer
nReturn = Logon_Show(hWndForm, %True)
If nReturn = %False Then
FF_CloseForm hWndForm
End If
End Function
Thanks Sean -- give your code a go, and works great.
Glad to hear...thanks for posting back