Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++
Hello,
 
I have a project with one file that is a COM plugin for a hosting application.
In that code I can freely use AfxMessageBox(), or if I want a bit more control
I can also use MessageBox() like so:
 
MessageBox(NULL,"File Missing.","Error",MB_OK);
 
In another .cpp file in the same solution is a property page for my plugin that the host pops up from it's menu system I can again use AfxMessageBox() to my hearts content but MessageBox() throws up the compiler error:
 
'CWnd::MessageBoxA' : function does not take 4 arguments.
 
Intellisense in both file point to the define in winuser.h
 

I really would like to use MessageBox() in the property page so I can change the dialog title text.
 
Thanks for all your help in advance.
 
:Ron
Posted 12-Jan-13 5:27am
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

The chances are that in one case you are getting CWnd::MessageBox[^] and in the other Win API ::MessageBox[^]
It's difficult to tell without your code, but try putting the :: specifier in there as see it it corrects the problem.
  Permalink  
Comments
Ron Anders at 12-Jan-13 11:04am
   
double comment
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

In case 2 you are obviously calling it from within your CWnd derived class, so the correct call would be:
MessageBox("File Missing.","Error",MB_OK);
as described in the documentation[^].
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Afzaal Ahmad Zeeshan 256
1 OriginalGriff 251
2 BillWoodruff 240
3 Maciej Los 230
4 Sergey Alexandrovich Kryukov 195
0 OriginalGriff 6,419
1 Sergey Alexandrovich Kryukov 6,008
2 DamithSL 5,183
3 Manas Bhardwaj 4,673
4 Maciej Los 4,070


Advertise | Privacy | Mobile
Web04 | 2.8.1411019.1 | Last Updated 12 Jan 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100