Click here to Skip to main content
15,886,919 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
C#
case WM_KEYDOWN:
    if( wParam == VK_ESCAPE )
        int yesno = MessageBox(0, "Do you really want to quit?", "Msg", MB_YESNO);
        if( yesno == IDYES )
            DestroyWindow(ghMainWnd);
    return 0;


For some reason I'm getting the error "error C2065: 'yesno' : undeclared identifier". The code looks correct to me. Am I missing something?
Posted

1 solution

Yes. you are missing {}.

Like so:

case WM_KEYDOWN:
    if( wParam == VK_ESCAPE )
    {
        int yesno = MessageBox(0, "Do you really want to quit?", "Msg", MB_YESNO);
        if( yesno == IDYES )
            DestroyWindow(ghMainWnd);
    }
    return 0;
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900