?
Solved

AfxMessageBox windows message

Posted on 2009-05-16
7
Medium Priority
?
537 Views
Last Modified: 2013-12-27
When I pop up a message box like so:
AfxMessageBox(_T("message"));

What windows message is posted when the user presses OK?
0
Comment
Question by:Wanting2LearnMan
7 Comments
 
LVL 45

Assisted Solution

by:AndyAinscow
AndyAinscow earned 400 total points
ID: 24401779
None.

The code waits until the user dismisses the message box.  The message box will return a value dependig on what button was pressed (as described in the help files).
0
 
LVL 24

Assisted Solution

by:alexey_gusev
alexey_gusev earned 200 total points
ID: 24401801
to be precise, you'd get IDOK (in your particular sample), IDCANCEL, IDYES, IDNO etc, depending on the buttons you requested to display
0
 
LVL 7

Assisted Solution

by:lucky_james
lucky_james earned 400 total points
ID: 24401835
As already described by Andy, it is the value which will be returned to the caller code, rather than a message getting posted.

check out:
http://msdn.microsoft.com/ja-jp/library/cc417604.aspx

..
James
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:Wanting2LearnMan
ID: 24401841
Thanks.  Would the AfxMessageBox function couse the OnActivatefunction to be called?  My problem is that I want my dialog fullscreen.  I have a tab control in my dialog and it is doing something funny as the dialog does not go fullscreen once the tabs dialogs are created.  If I put in AfxMessageBox in my OnInit then after I press OK it goes fullscreen.

BOOL CMyClass::OnInitDialog()
{
      SHINITDLGINFO shidi;
      shidi.dwMask = SHIDIM_FLAGS;
      shidi.dwFlags =SHIDIF_FULLSCREENNOMENUBAR;
      shidi.hDlg = m_hWnd;
      ::SHInitDialog(&shidi);

      SetForegroundWindow();

      SHFullScreen( m_hWnd, SHFS_HIDESTARTICON|
      SHFS_HIDETASKBAR|
      SHFS_HIDESIPBUTTON );

      MoveWindow(0,0,240,320,TRUE);

      HWND hWnd;
      hWnd = ::SHFindMenuBar(this->m_hWnd);
      ::ShowWindow(hWnd, SW_HIDE);
}

AND
void COptions::OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimized)
{
     CDialog::OnActivate(nState, pWndOther, bMinimized);

     SHFullScreen( m_hWnd, SHFS_HIDESTARTICON|SHFS_HIDETASKBAR|
                                                SHFS_HIDESIPBUTTON );

     MoveWindow(0,0,240,320,TRUE);

     HWND hWnd;
     hWnd = ::SHFindMenuBar(this->m_hWnd);
     ::ShowWindow(hWnd, SW_HIDE);

}

I create the dialogs for my tab control in the OnInit of my dialog like so:
//Tab Options
     dlgTab1Dlg = new CTab1(this);
     dlgTab1Dlg->Create(IDD_TAB1_DIALOG, this);
     dlgTab1Dlg->SetParent(&m_tabOptions);
     dlgTab1Dlg->ShowWindow(SW_SHOW);
     dlgTab1Dlg->SetWindowPos(NULL, rTab.left, rTab.top, rTab.Width(), rTab.Height(), SWP_NOZORDER);

     dlgTab2Dlg = new CTab2(this);
     dlgTab2Dlg->Create(IDD_TAB2_DIALOG, this);
     dlgTab2Dlg->SetParent(&m_tabOptions);
     dlgTab2Dlg->ShowWindow(SW_SHOW);
     dlgTab2Dlg->SetWindowPos(NULL, rTab.left, rTab.top, rTab.Width(), rTab.Height(), SWP_NOZORDER);
0
 

Author Comment

by:Wanting2LearnMan
ID: 24401851
The above OnInit should be:
BOOL CMyClass::OnInitDialog()
{
//Tab Options
     m_tabOptions.InsertItem(0, _T("Tab 1"));
     m_tabOptions.InsertItem(1, _T("Tab 2"));
......
.....
     dlgTab1Dlg = new CTab1(this);
     dlgTab1Dlg->Create(IDD_TAB1_DIALOG, this);
     dlgTab1Dlg->SetParent(&m_tabOptions);
     dlgTab1Dlg->ShowWindow(SW_SHOW);
     dlgTab1Dlg->SetWindowPos(NULL, rTab.left, rTab.top, rTab.Width(), rTab.Height(), SWP_NOZORDER);

     dlgTab2Dlg = new CTab2(this);
     dlgTab2Dlg->Create(IDD_TAB2_DIALOG, this);
     dlgTab2Dlg->SetParent(&m_tabOptions);
     dlgTab2Dlg->ShowWindow(SW_SHOW);
     dlgTab2Dlg->SetWindowPos(NULL, rTab.left, rTab.top, rTab.Width(), rTab.Height(), SWP_NOZORDER);


      SHINITDLGINFO shidi;
      shidi.dwMask = SHIDIM_FLAGS;
      shidi.dwFlags =SHIDIF_FULLSCREENNOMENUBAR;
      shidi.hDlg = m_hWnd;
      ::SHInitDialog(&shidi);

      SetForegroundWindow();

      SHFullScreen( m_hWnd, SHFS_HIDESTARTICON|
      SHFS_HIDETASKBAR|
      SHFS_HIDESIPBUTTON );

      MoveWindow(0,0,240,320,TRUE);

      HWND hWnd;
      hWnd = ::SHFindMenuBar(this->m_hWnd);
      ::ShowWindow(hWnd, SW_HIDE);
}

0
 
LVL 45

Assisted Solution

by:AndyAinscow
AndyAinscow earned 400 total points
ID: 24403436
Your app probably receives an onActive after the OnInitDialog completes as part of the normal procedure.  
The dialog is initialised, OnInit leaves then the dialog is actually shown then (I assume it is a dialog based app) a WM_ACTIVATE message is pumped to the app to indicate it is now the active window.

I guess you have something else not correct in your app.


ps.  I don't think it is very good to use the OnActivate to make it full screen.  
0
 
LVL 33

Accepted Solution

by:
pgnatyuk earned 1000 total points
ID: 24405379
Yes, you will receive WM_ACTIVATE each time when your window become active or inactive. One of the parameters of this message say if it is interprocess switch or not. Please take more details from here:
http://msdn.microsoft.com/en-us/library/aa922525.aspx
there is the following text: "This handle can be NULL, and is always NULL when the window being activated and the window being deactivated are in separate processes"
I saw a problem with it on old Pocket PCs, but I hope on Windows Mobile it will work fine.
So nice to meet someone who use C++ for his mobile development and not .NET. :)
Here is a part from my handling:
UINT nFlags = LOWORD(wParam);
BOOL bMinimized = (BOOL)HIWORD(wParam);
HWND hWnd = (HWND)lParam;
And this last handle is NULL if you have switch from another thread.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently asked a question (http://www.experts-exchange.com/Programming/Smartphones/Android/Q_28684946.html) about Computer Inventory applications for Mobile Devices.  I was specifically interested in an app I could use on my android phone.  The be…
Article by: evilrix
Looking for a way to avoid searching through large data sets for data that doesn't exist? A Bloom Filter might be what you need. This data structure is a probabilistic filter that allows you to avoid unnecessary searches when you know the data defin…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.
Suggested Courses
Course of the Month13 days, 10 hours left to enroll

750 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question