Solved

AfxMessageBox windows message

Posted on 2009-05-16
7
526 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 44

Assisted Solution

by:AndyAinscow
AndyAinscow earned 100 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 50 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 100 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
Independent Software Vendors: 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!

 

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 44

Assisted Solution

by:AndyAinscow
AndyAinscow earned 100 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 250 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

Preface: This article is part of a series focused on cross platform mobile app development (specifically Android and iOS) using the Alloy framework and Titanium Studio made by Appcelerator (https://www.appcelerator.com/). This article presumes a wor…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
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

739 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