Avatar of mammouth
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

Visual C++.NET

Avatar of undefined
Last Comment
Svetlin_Panayotov

8/22/2022 - Mon
AlexFM

Use MessageBox API or CWnd::MessageBox function.
AlexFM

::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);
mammouth

ASKER
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?
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
AlexFM

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.
mammouth

ASKER
I don't use class.
Do you know where i can find a sample project who use class and MessageBox?
ASKER CERTIFIED SOLUTION
Svetlin_Panayotov

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.