c++ - Secondary window in MFC application -


I am trying to add a secondary window to my MFC application. I've written to show this main window:

Header:

  Class CMyApp: Public CWinApp {Public: Virtual BOOL InitInstance (); }; Square CMainWindow: Public CFrameWnd {Public: CMainWindow (four * p_mchar); Protected: afx_msg zero OnPaint (); DECLARE_MESSAGE_MAP (); };  

Source file:

  #include & lt; Afxwin.h & gt; # Include & lt; Afxmt.h & gt; #include "mfc0.h" #include & lt; String.h & gt; CMyApp myApp; BOOL CMyApp :: InitInstance () {m_pMainWnd = New CMainWindow ("Test 1"); M_pMainWnd-> Shovando (m_nCmdShow); M_pMainWnd-> Update window (); Return TRUE; } BEGIN_MESSAGE_MAP (CMainWindow, CFrameWnd) ON_WM_PAINT () END_MESSAGE_MAP () CMainWindow :: CMainWindow (char * p_mchar) {Create (NULL, L "mfc0"); } Zero CMainWindow :: OnPaint () {CPaintDC DC (this); CMainWindow * hwnd = this; }  

I think there is a way to add another CRRRM, but I can not understand how to show that window in the application. I can not use m_pMainWnd twice, right? There should be a simple solution, but I have lost a bit here.

If you want to paint on another window then there is a good way to create another CFRAMand just your To add a member variable to the CWAP app derived class, such as m_pSecondWindow, if you want to control the second window, then a model dialog is a better way.


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -