Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8212353
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T10:43:39+00:00 2026-06-07T10:43:39+00:00

I’ve just made a simple C++ Window and added a menu, but when I

  • 0

I’ve just made a simple C++ Window and added a menu, but when I click on the menu, specifally “About” i want to show a simply MessageBox but I can’t – because it doesn’t show.

LPCWSTR App_Name = TEXT("TestApp");
LPCWSTR App_Title = TEXT("TestTitle");

const int windowWidth = 480;
const int windowHeight = 480;

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int iCmdShow)
{
    WNDCLASS wc;
    wc.cbClsExtra = 0;
    wc.cbWndExtra = 0;
    wc.hbrBackground = (HBRUSH)GetStockObject( WHITE_BRUSH );
    wc.hCursor = LoadCursor( NULL, IDC_ARROW );
    wc.hIcon = LoadIcon( NULL, IDI_APPLICATION );
    wc.hInstance = hInstance;
    wc.lpfnWndProc = WndProc;
    wc.lpszClassName = App_Name;
    wc.lpszMenuName = MAKEINTRESOURCE(MNU_MAINMENU);
    wc.style = CS_HREDRAW | CS_VREDRAW;

    RegisterClass(&wc); 

    RECT rc;
    GetWindowRect(GetDesktopWindow(), &rc);

    long screenWidth = rc.right;
    long screenHeight = rc.bottom;

    HWND hwnd = CreateWindow
    (
        App_Name,
        App_Title,
        WS_MINIMIZEBOX | WS_SYSMENU,
        (screenWidth / 2) - (windowWidth / 2), (screenHeight / 2)-(windowHeight/2),
        windowWidth, windowHeight,
        NULL, NULL,
        hInstance, NULL
    );


    ShowWindow(hwnd, iCmdShow );
    UpdateWindow(hwnd);

    MSG msg;

    while( GetMessage( &msg, NULL, 0, 0 ) )
    {
        TranslateMessage( &msg );
        DispatchMessage( &msg );
    }

    return msg.wParam;
}

and the MessageBox…:

LRESULT CALLBACK WndProc(HWND hwnd,UINT message, WPARAM wparam, LPARAM lparam)
{   
        switch( message )
        {

        case WM_COMMAND:
            id = LOWORD(wparam);
            event = LOWORD(wparam);
            switch(id)
            {
                case MNU_HELP_ABOUT:
                MessageBox(NULL, TEXT("TEXT"), TEXT("TITLE"), MB_OK | MB_ICONINFORMATION);
                break;
            }
        break;

        }
}

Menu works, cause I’ve added a Quit and such so I know it responds to the clicks on the menu but when I click the About button you hear the popup sound but there’s no MessageBox showing.

Any ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T10:43:41+00:00Added an answer on June 7, 2026 at 10:43 am

    I figured it out, somehow. Problem was because I haven’t done anything in WM_CREATE, or that that “nothing” was on the form – White background, or something. As soon as I started adding controls (buttons) to the Window it suddenly appeared where it didn’t before. Just weird…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I have a French site that I want to parse, but am running into
Seemingly simple, but I cannot find anything relevant on the web. What is the
I want to construct a data frame in an Rcpp function, but when I
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the
I want use html5's new tag to play a wav file (currently only supported
I am doing a simple coin flipping experiment for class that involves flipping a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.