Link to home
Create AccountLog in
Avatar of mammouth

asked on

Change msgbox title caption

I use AfxMessageBox to display msgbox.
How can i change title caption of this box?
Currently the only solution i found is rename the .exe file.
But i can't because i need to have different msgbox title.

Thank you

Avatar of AlexFM

Use MessageBox API or CWnd::MessageBox function.
::MessageBox(hWnd, _T("Text"), _T("Title), MB_OK);     // you can use NULL instead of hWnd

In MFC CWnd-derived class you can write:

MessageBox(T("Text"), _T("Title), MB_OK);
Avatar of mammouth


In the 2 case, i get error:
error C2146: syntax error : missing ';' before identifier 'theApp'
error C2501: 'theApp' : missing storage-class or type specifiers

What can i do to resolve this?
There is typo in the second line:

MessageBox(_T("Text"), _T("Title), MB_OK);

It should be used only in MFC application, from CWnd-derived class.
I don't use class.
Do you know where i can find a sample project who use class and MessageBox?
Avatar of Svetlin_Panayotov

Link to home
Create an account to see this answer
Signing up is free. No credit card required.
Create Account