Click here to Skip to main content
16,007,814 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Simple STL Stream Problem Pin
markkuk22-Oct-01 0:27
markkuk22-Oct-01 0:27 
GeneralRe: Simple STL Stream Problem Pin
Derek Lakin22-Oct-01 0:43
Derek Lakin22-Oct-01 0:43 
GeneralMore Help Needed Pls :( Pin
Derek Lakin22-Oct-01 1:19
Derek Lakin22-Oct-01 1:19 
GeneralRe: More Help Needed Pls :( Pin
markkuk22-Oct-01 20:14
markkuk22-Oct-01 20:14 
GeneralRe: More Help Needed Pls :( Pin
Derek Lakin23-Oct-01 0:26
Derek Lakin23-Oct-01 0:26 
Generalregarding dlls Pin
21-Oct-01 21:26
suss21-Oct-01 21:26 
GeneralMy Computer Pin
21-Oct-01 21:08
suss21-Oct-01 21:08 
Generalprogrammatically creating menus in SDI Pin
marym21-Oct-01 18:13
marym21-Oct-01 18:13 
I am trying to programmatically create menus in SDI.
The error message I get is "failed to create
empty document."
I started with a SDI application that was working fine
with menus created by menu templates in the
.RC file. The only thing I changed was to remove the
menu templates in the .RC file. I left the menu
resource definition for IDR_MAINFRAME in
Resource.h. I also left the reference to IDR_MAINFRAME
in InitInstance:
///////////////////////////////////////////////
pDocTemplate = new CSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(CSdiDoc),
RUNTIME_CLASS(CMainFrame),
RUNTIME_CLASS(CSdiView));
//////////////////////////////////////////////
Question 1) Is this use of IDR_MAINFRAME correct?
Question 2) If not, what is supposed to be the second
argument instead of IDR_MAINFRAME?

I placed the following menu creation
commands in the OnCreate function of the frame window
.cpp file, but OnCreate never gets called by InitInstance.
////////////////////////////////////////////////////////////////////////////
CMenu mainmenu; // create main menu
mainmenu.CreateMenu();

CMenu menuPopup; // create the popup menu
menuPopup.CreatePopupMenu();
menuPopup.AppendMenu(MF_STRING, ID_COLOR_RED, "&Red");
menuPopup.AppendMenu(MF_STRING, ID_COLOR_YELLOW, "&Yellow");
menuPopup.AppendMenu(MF_STRING, ID_COLOR_GREEN, "&Green");

// attach popup menu to main menu using menu handle
mainmenu.AppendMenu(MF_POPUP, (UINT) menuPopup.Detach(),
"&Colors");

// the next line is a *complete guess* as to how to load the menu
mainmenu.LoadMenu(MAKEINTRESOURCE(&mainmenu));
AfxGetMainWnd()->SetMenu(&mainmenu);
////////////////////////////////////////////////////////////////////////////
Question 3) Are these menu commands correct for
creating & loading menus?

From what I can tell, the application gets only partly
through InitInstance, specifically up to this command:

if (!ProcessShellCommand(cmdInfo)) return FALSE

It returns false & OnCreate is never called & the
frame window is not created.

Question 3) What else am I doing wrong?

thank you for your assistance.
mary, houston, texas
GeneralRe: programmatically creating menus in SDI Pin
Christian Graus21-Oct-01 20:15
protectorChristian Graus21-Oct-01 20:15 
GeneralRe: programmatically creating menus in SDI Pin
marym22-Oct-01 10:08
marym22-Oct-01 10:08 
GeneralRe: programmatically creating menus in SDI Pin
Christian Graus22-Oct-01 11:14
protectorChristian Graus22-Oct-01 11:14 
Generalillegal use of type as an expression Pin
Stephen Caldwell21-Oct-01 17:14
Stephen Caldwell21-Oct-01 17:14 
GeneralGetting Rect of a Menu Pin
denis.flotat21-Oct-01 12:41
denis.flotat21-Oct-01 12:41 
GeneralPainting a dialog background Pin
Michael P Butler21-Oct-01 12:36
Michael P Butler21-Oct-01 12:36 
GeneralRe: Painting a dialog background Pin
Michael Dunn21-Oct-01 17:07
sitebuilderMichael Dunn21-Oct-01 17:07 
GeneralRe: Painting a dialog background Pin
Christian Graus21-Oct-01 17:29
protectorChristian Graus21-Oct-01 17:29 
GeneralModeless Dialogbox inside an MDI Window Pin
2sky21-Oct-01 9:50
2sky21-Oct-01 9:50 
QuestionHow to convert my MFC View class into a DLL? Pin
21-Oct-01 8:09
suss21-Oct-01 8:09 
AnswerRe: How to convert my MFC View class into a DLL? Pin
kumar_p321-Oct-01 18:08
kumar_p321-Oct-01 18:08 
GeneralRich Edit control Zooming Pin
asimu21-Oct-01 5:12
asimu21-Oct-01 5:12 
Generalerror LNK2001: unresolved external symbol _DirectDrawCreate@12 Pin
21-Oct-01 4:12
suss21-Oct-01 4:12 
GeneralRe: error LNK2001: unresolved external symbol _DirectDrawCreate@12 Pin
21-Oct-01 4:24
suss21-Oct-01 4:24 
GeneralRe: error LNK2001: unresolved external symbol _DirectDrawCreate@12 Pin
21-Oct-01 4:46
suss21-Oct-01 4:46 
GeneralRe: error LNK2001: unresolved external symbol _DirectDrawCreate@12 Pin
21-Oct-01 4:52
suss21-Oct-01 4:52 
GeneralRe: error LNK2001: unresolved external symbol _DirectDrawCreate@12 Pin
Carlos Antollini21-Oct-01 4:40
Carlos Antollini21-Oct-01 4:40 

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.