Click here to Skip to main content
15,892,927 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: CListBox multiple selection painting...? Pin
RedZenBird2-Oct-02 4:47
RedZenBird2-Oct-02 4:47 
GeneralRe: CListBox multiple selection painting...? Pin
alex.barylski2-Oct-02 11:51
alex.barylski2-Oct-02 11:51 
GeneralUsing ADSI to access computer properties Pin
abhinarulkar1-Oct-02 21:14
abhinarulkar1-Oct-02 21:14 
QuestionTransparent Bitmaps in a Tree Control ? Pin
Daniel Strigl1-Oct-02 20:30
Daniel Strigl1-Oct-02 20:30 
AnswerRe: Transparent Bitmaps in a Tree Control ? Pin
Stephane Rodriguez.1-Oct-02 21:48
Stephane Rodriguez.1-Oct-02 21:48 
GeneralCOM events Pin
Shamoon1-Oct-02 18:59
Shamoon1-Oct-02 18:59 
GeneralRe: COM events Pin
Michael P Butler1-Oct-02 23:29
Michael P Butler1-Oct-02 23:29 
GeneralMFC Menu Woes Pin
Jeff Patterson1-Oct-02 16:42
Jeff Patterson1-Oct-02 16:42 
Confused | :confused: I'm having a problem getting a menu to display in a window.

This is a simple class assignment. I can get the thing to show up with Create but not CreateEx. Can someone tell me why? The debugger crashes when it reaches the m_btnAdd.Create function.

The error in the debugger window first show 0x00000579 which is an invalid menu handle.

The message that is displayed at crash is:
First-chance exception in CIS279_4.exe (MFC42D.DLL): 0xC0000005: Access Violation.


I have an .rc file where the menu is created and a header file with #define IDR_MAINMENU 3000.

    CString strWndClass = AfxRegisterWndClass(CS_DBLCLKS, <br />
        AfxGetApp()->LoadCursor(IDC_ARROW), <br />
        (HBRUSH)(COLOR_3DFACE+1),<br />
        AfxGetApp()->LoadIcon(IDI_ICON1));<br />
<br />
    m_btnRect = CRect(0,0,80,30); //Application Default Button Size<br />
<br />
    CreateEx(WS_EX_OVERLAPPEDWINDOW, strWndClass, _T("Jeff's Calculator"), <br />
        WS_OVERLAPPEDWINDOW, m_rect, NULL, IDR_MAINMENU, NULL);<br />
<br />
    //~~~~~~~~~~~~BUTTONS~~~~~~~~~~~~~~<br />
    m_btnRect.OffsetRect(85,100);<br />
    m_btnAdd.Create(_T("&Add"), WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, m_btnRect, this, ID_BTNADD);


My instructor has tried to help with no luck and the Prosise book and MSDN aren't specific enough. My instructor is accepting the assignment with the Create function instead so now I just have a burning desire to know.

Can anyone help?

Thanks

Jeff Patterson

Programmers speak in Code.
http://www.anti-dmca.org
GeneralRe: MFC Menu Woes Pin
Tomasz Sowinski2-Oct-02 0:05
Tomasz Sowinski2-Oct-02 0:05 
GeneralRe: MFC Menu Woes Pin
Jeff Patterson2-Oct-02 15:45
Jeff Patterson2-Oct-02 15:45 
Questionkeboard mouse messages? Pin
imran_rafique1-Oct-02 16:31
imran_rafique1-Oct-02 16:31 
AnswerRe: keboard mouse messages? Pin
alex.barylski1-Oct-02 21:16
alex.barylski1-Oct-02 21:16 
GeneralRe: keboard mouse messages? Pin
imran_rafique2-Oct-02 16:19
imran_rafique2-Oct-02 16:19 
GeneralRe: keboard mouse messages? Pin
alex.barylski2-Oct-02 20:10
alex.barylski2-Oct-02 20:10 
GeneralAdding MFC controls to a MDI child window Pin
Daaave1-Oct-02 15:43
Daaave1-Oct-02 15:43 
GeneralRe: Adding MFC controls to a MDI child window Pin
PJ Arends1-Oct-02 16:51
professionalPJ Arends1-Oct-02 16:51 
QuestionIs it becuase the object is destroyed? Pin
monrobot131-Oct-02 14:44
monrobot131-Oct-02 14:44 
AnswerRe: Is it becuase the object is destroyed? Pin
Nish Nishant1-Oct-02 14:58
sitebuilderNish Nishant1-Oct-02 14:58 
GeneralRe: Is it becuase the object is destroyed? Pin
monrobot132-Oct-02 13:23
monrobot132-Oct-02 13:23 
QuestionHow to re-enable XP visual styles in app? Pin
IGx891-Oct-02 14:05
IGx891-Oct-02 14:05 
AnswerRe: How to re-enable XP visual styles in app? Pin
Tomasz Sowinski2-Oct-02 0:11
Tomasz Sowinski2-Oct-02 0:11 
AnswerRe: How to re-enable XP visual styles in app? Pin
Gary Wheeler2-Oct-02 1:48
Gary Wheeler2-Oct-02 1:48 
GeneralRe: How to re-enable XP visual styles in app? Pin
Tomasz Sowinski2-Oct-02 2:10
Tomasz Sowinski2-Oct-02 2:10 
GeneralRe: How to re-enable XP visual styles in app? Pin
IGx892-Oct-02 4:16
IGx892-Oct-02 4:16 
GeneralVector graphics help Pin
Christian Graus1-Oct-02 13:01
protectorChristian Graus1-Oct-02 13:01 

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.