In our application, the login is a mandatory action so we do a simple thing:
develop a login form, adding the following to be the first form displayed:
initialization
RegisterMainFormClass(TfrmLogin);
and deleting similar lines in the MainForm
If the login succeeds, simply initialize what you need and do:
frmLogin.Hide;
frmMain.Show;
All session flags and shared information, we put them in MainModule.pas as public members of TUniMainModule, so they are available for all session forms through UniMainModule function (be sure that MainModule is present under "uses" clause of your forms).
It is very simple, but it works for us...
Regards,
develop a login form, adding the following to be the first form displayed:
initialization
RegisterMainFormClass(TfrmLogin);
and deleting similar lines in the MainForm
If the login succeeds, simply initialize what you need and do:
frmLogin.Hide;
frmMain.Show;
All session flags and shared information, we put them in MainModule.pas as public members of TUniMainModule, so they are available for all session forms through UniMainModule function (be sure that MainModule is present under "uses" clause of your forms).
It is very simple, but it works for us...
Regards,
本文介绍了一种简单的方法来实现应用程序的登录功能。通过将登录窗体设置为应用程序的第一个显示窗体,并在登录成功后隐藏登录窗体并显示主窗体。会话标志和共享信息被放置在MainModule.pas中作为TUniMainModule类的公共成员,以便在整个会话期间的窗体间共享。
537

被折叠的 条评论
为什么被折叠?



