Click here to Skip to main content
15,914,255 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Duplicate Dialogs Pin
Ryan Binns21-Jul-03 1:48
Ryan Binns21-Jul-03 1:48 
GeneralRe: Duplicate Dialogs Pin
Jay Hova21-Jul-03 2:47
Jay Hova21-Jul-03 2:47 
GeneralRe: Duplicate Dialogs Pin
Ryan Binns21-Jul-03 2:55
Ryan Binns21-Jul-03 2:55 
GeneralRe: Duplicate Dialogs Pin
Jay Hova21-Jul-03 3:18
Jay Hova21-Jul-03 3:18 
GeneralRe: Duplicate Dialogs Pin
Ryan Binns21-Jul-03 3:26
Ryan Binns21-Jul-03 3:26 
GeneralRe: Duplicate Dialogs Pin
Jay Hova21-Jul-03 3:39
Jay Hova21-Jul-03 3:39 
GeneralRe: Duplicate Dialogs Pin
Ryan Binns21-Jul-03 3:40
Ryan Binns21-Jul-03 3:40 
GeneralRe: Duplicate Dialogs Pin
G. Steudtel21-Jul-03 3:34
G. Steudtel21-Jul-03 3:34 
Hi,
I feel sorry for my short and as I thought understandable answer. I didnot know, that you never coded before. So let me dig a little deeper with this answer.

In your main application class you should have a pointer to or an instance of class CMainCommand. This pointer or instance must be used by all calls to open the dialogs.

Have a look at the headerfile of your application class to find out, wheter the CMainCommand thing is private/protected or public.

In the application headerfile add a member function:
<br />
CMainCommand* GetCommandPointer(void);<br />


Assuming it is a pointer (lets call it pMainCommand) write in the applications cpp-file
<br />
CMainCommand* CWinApp::GetCommandPointer(void)<br />
{ return pMainCommand;}<br />


Of course you have to substitute CWinApp and pMainCommand with the names of the actual class name and variable name. If you do not use a pointer, but an instance of the class replace pMainCommand with &mainCommand;

In your OnOk handler write
<br />
 m_pCommantOpt = DYNAMIC_DOWNCAST(CWinApp,AfxGetApp())->GetCommandPointer();<br />

Here too you have to substitute the CWinApp with the actual name of your application class. Also you have to include the applications header file into your cpp file. (But this should be done already by class wizard)

This line above does:
It retrieves a pointer to the application class instance, casts it to your application class and after the casting calls GetCommandPointer.

Then delete the line where you create an new instance of CMainCommand, bailing out, when the pointer is inavlid and tell the user that someting went wrong.
<br />
 m_pCommantOpt = DYNAMIC_DOWNCAST(CWinApp,AfxGetApp())->GetCommandPointer();<br />
if( m_pCommandOpt != NULL )<br />
  { m_pCommandOpt = new CMainCommand(this);<br />
    if( m_pCommandOpt->Create(IDD_MAIN_TAB_DIALOG) == TRUE )<br />
      { GetDlgItem(IDOK)->EnableWindow(FALSE);<br />
        m_pCommandOpt->ShowWindow(SW_SHOW);<br />
      }<br />
    else<br />
      {	m_pCommandOpt->SetActiveWindow(); <br />
      }<br />
  }<br />
else<br />
  AfxMessagebox("Something went wrong");<br />


Regards

G.Steudtel
GeneralRe: Duplicate Dialogs Pin
Jay Hova22-Jul-03 9:42
Jay Hova22-Jul-03 9:42 
QuestionHow to disable CD ROM autoplay function? Pin
HansonDavid21-Jul-03 1:15
HansonDavid21-Jul-03 1:15 
AnswerRe: How to disable CD ROM autoplay function? Pin
Ryan Binns21-Jul-03 1:55
Ryan Binns21-Jul-03 1:55 
GeneralRe: How to disable CD ROM autoplay function? Pin
HansonDavid21-Jul-03 18:18
HansonDavid21-Jul-03 18:18 
GeneralRe: How to disable CD ROM autoplay function? Pin
Ryan Binns21-Jul-03 18:57
Ryan Binns21-Jul-03 18:57 
GeneralRe: How to disable CD ROM autoplay function? Pin
HansonDavid22-Jul-03 1:09
HansonDavid22-Jul-03 1:09 
GeneralRe: How to disable CD ROM autoplay function? Pin
Ryan Binns22-Jul-03 1:14
Ryan Binns22-Jul-03 1:14 
GeneralSet Screensaver!!!!!!!!!!!!!!!!!!!!!! Pin
xxhimanshu21-Jul-03 1:11
xxhimanshu21-Jul-03 1:11 
GeneralRe: Set Screensaver!!!!!!!!!!!!!!!!!!!!!! Pin
Ryan Binns21-Jul-03 1:50
Ryan Binns21-Jul-03 1:50 
GeneralRe: Set Screensaver!!!!!!!!!!!!!!!!!!!!!! Pin
xxhimanshu21-Jul-03 2:45
xxhimanshu21-Jul-03 2:45 
GeneralRe: Set Screensaver!!!!!!!!!!!!!!!!!!!!!! Pin
David Crow21-Jul-03 3:22
David Crow21-Jul-03 3:22 
QuestionFastest DATABASE protcol? Pin
Lars [Large] Werner21-Jul-03 1:04
professionalLars [Large] Werner21-Jul-03 1:04 
AnswerRe: Fastest DATABASE protcol? Pin
Mike Dimmick21-Jul-03 2:04
Mike Dimmick21-Jul-03 2:04 
AnswerRe: Fastest DATABASE protcol? Pin
Manfred Staiger21-Jul-03 2:07
Manfred Staiger21-Jul-03 2:07 
GeneralRe: Fastest DATABASE protcol? Pin
John M. Drescher21-Jul-03 3:50
John M. Drescher21-Jul-03 3:50 
AnswerRe: Fastest DATABASE protcol? Pin
Miguel Lopes21-Jul-03 2:29
Miguel Lopes21-Jul-03 2:29 
GeneralRe: Fastest DATABASE protcol? Pin
Lars [Large] Werner21-Jul-03 3:32
professionalLars [Large] Werner21-Jul-03 3:32 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.