|
From: Natural R. D. <nr...@my...> - 2005-08-24 08:50:52
|
>Hi! I'm one of the persons who luckily download a source code of NRDB
>Pro 2. I'm on the verge of studying the codes, as a beginner to Visual
>C++. I only want to know on what part of the project can I find the
>source code that tells me that if I click the OK button of
>the "Welcome" splash of the software will go to the Login form?
Hi Nenita,
There are two parts to the answer. The first is how to close a dialog
when its clicked on:
This is done in the dialog class (dlgabout.cpp) in response to the
WM_LBUTTONDOWN message. Use class wizard to create the function
OnLButtonDown.
This then calls to CDialog::OnOK function to close the dialog. I've
assigned the variable m_bSplash in the constructor so this
functionality can be switched off when the about dialog is opened from
the help menu.
void CDlgAbout::OnLButtonDown(UINT nFlags, CPoint point)
{
if (m_bSplash)
{
OnOK();
}
CDialog::OnLButtonDown(nFlags, point);
}
Closing the splash panel and opening the login dialog:
The about dialog is opened as a modal dialog. This means that the rest
of the program stops until it has closed. Next the login dialog is
opened...
// nrdbpro.cpp
BOOL CNRDBApp::InitInstance()
{
//...
// Display about box
CDlgAbout dlg(TRUE);
dlg.DoModal();
//...
// Display login dialog
if (!Login())
{
return FALSE;
}
//...
}
Richard
|