|
Let me get this straight. What you want is that your main dialog is created, and IF your login dialog is closed with OK, you want your main dialog to appear on screen, but if it is closed with CANCEL you want your main dialog to still exist BUT not be shown on the screen?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
|
|
|
|
|
You can call EndDialog() and return immediately from OnInitDialog(), instead of calling exit()
|
|
|
|
|
Can you describe me with some example? I am calling login dailog on like this
Clogin dlg;
dlg.domodal();
OnInitDialog.
Plz help me
|
|
|
|
|
Like this, if my understandings are correct...
BOOL CMainDlg::OnInitDialog()
{
CDialog::OnInitDialog();
...
...
CLogin dlg;
if( dlg.DoModal() == IDCANCEL )
{
EndDilaog( 0 );
return FALSE;
}
...
}
|
|
|
|
|
Thanks for vital information but still problem not solve.When i click the cancle button then main dialog is open.Plz help me
|
|
|
|
|
Are you sure that you are getting the IDCANCEL when you click the cancel button? And how/where are you creating the main dialog and the login dialog? I wonder how the main dialog exists after calling the EndDialog... most probably it is not getting called.
|
|
|
|
|
How can i check [code]getting the IDCANCEL when click the cancel button[/code] Plz help me
|
|
|
|
|
Try to put a break point at the if( loginDlg.DoModal()... statement and check control flow.
If it is not going to the EndDialog statement, then check the login dialog code. If you are using the default cancel of the dialog then IDCANCEL will be the return value of the DoModal.
|
|
|
|
|
yes i check it as your step.Control is going to the EndDialog statement.But Application is close.
|
|
|
|
|
MsmVc wrote: But Application is close.
That is what you needed right?
|
|
|
|
|
ok i don't want to close main application dialog.I just i want to close login dialog.Very first post to till i am saying.If i make mistake then sorry.
|
|
|
|
|
MsmVc wrote: If i make mistake then sorry.
Actually I made the mistake... I misunderstood your words. Really sorry.
So I hope you just need to keep the main application running after closing the login dialog. Am I right?
If this is the case that you need, then you must not call the EndDialog. Then do you need to hide the main dialog? Could you please rephrase your need?
|
|
|
|
|
Ok i think it's part of life understood and misunderstood.Any way thanks for help.Now it's working
|
|
|
|
|
Hi sorry to distrub you but i need some more help.When i start the application and click on login cancel button then main application dialog is open.
If my application is running background and i click cancel button of login dialog then it's working well only login dialog close and main application still running.So plz help how can i solve that
|
|
|
|
|
MsmVc wrote: main application still running
What you need to do? You just want to bring it to minimized or hidden state?
|
|
|
|
|
|
Like this...
if( loginDlg.DoModal() == IDCANCEL )
{
ShowWindow( SW_HIDE );
}
|
|
|
|
|
|
I have following Dialog class in same project.
LoaderDlg.cpp
SettingDlg.cpp
in LoaderDlg.cpp i have fetched some value using WMI quary(in publi function,public varible).
I want to access those values from settingDlg.cpp . how i do that.
Help Me
|
|
|
|
|
For one, LoadDlg.cpp and SettingDlg.cpp are source files (i assume), not classes. And for two, that mostly depends on the context, you could for example give the value you set in your loaderdlg as a parameter to the setting dialog class's constructor, or store it in a global variable, or or or...
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
|
|
|
|
|
I have calling the settings dlg in on button click of loaderdlg.Like as following.How i send a value to settings dialog from loaderdlg.
Settings dlg;
dlg.DoModal();
|
|
|
|
|
Well, either give that value to your setting dlg as a parameter thorough its constructor (and store it in your setting dialog class as a member), or give a pointer to your loader dialog the same way and when you need the variable, use the pointer to access the value. Or if you need that variable after your setting window has been created, you can also try calling GetParent() in your setting dialog, convert what you get to the class of your load dialog and then access the meber as you must. But this later method is a bit ugly (what if you want to display your setting dialog from somewhere else os its parent won't be something else than your load dialog?).
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
|
|
|
|
|
Your problem has nothing to do with inheritance (if I got you). Check out toxcct's nice article on dialog communication [^].
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hi!
I want to give option to the user to select the display device his/her self if his/her computer is connected to multiple devices in my MFC application. Can anyone has idea about how to do it? And what are the APIs that give you the list of available display devices?
|
|
|
|
|