AFXMessageBox

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Oct 2008
Posts: 1
Reputation: morais is an unknown quantity at this point 
Solved Threads: 0
morais morais is offline Offline
Newbie Poster

AFXMessageBox

 
0
  #1
Oct 22nd, 2008
I would like to insert a function AFXMessageBox in generic class, but the compiler said this "error C2665: 'AfxMessageBox' : none of the 2 overloads can convert parameter 1 from type 'char [30]'"
.
I have de same code in oder project type CDialog and i haven't any error
Reply With Quote Quick reply to this message  
Join Date: Apr 2005
Posts: 16,221
Reputation: jbennet is a name known to all jbennet is a name known to all jbennet is a name known to all jbennet is a name known to all jbennet is a name known to all jbennet is a name known to all 
Solved Threads: 538
Moderator
Featured Poster
jbennet's Avatar
jbennet jbennet is offline Offline
Moderator

Re: AFXMessageBox

 
0
  #2
Oct 22nd, 2008
This board is for introductions only. Moved to C forum.
If i am helpful, please give me reputation points.
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,448
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1475
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Still Learning

Re: AFXMessageBox

 
0
  #3
Oct 22nd, 2008
Post the line of code that caused that error because I'm not a mind reader or clairvoyant.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
Reply With Quote Quick reply to this message  
Join Date: Sep 2008
Posts: 429
Reputation: Denniz is on a distinguished road 
Solved Threads: 15
Denniz's Avatar
Denniz Denniz is offline Offline
Posting Pro in Training

Re: AFXMessageBox

 
0
  #4
Oct 22nd, 2008
I suppose you are using Visual C++. From the little info that you give, you seem to be calling the function AfxMessageBox, but passing parameter that does not match its declaration.

We need to see the codes where you call this function, and the full error message (your error message says "convert parameter 1 from type 'char [30]", but did not mention to which type?).
Reply With Quote Quick reply to this message  
Join Date: Dec 2007
Posts: 360
Reputation: jencas is just really nice jencas is just really nice jencas is just really nice jencas is just really nice jencas is just really nice 
Solved Threads: 69
jencas jencas is offline Offline
Posting Whiz

Re: AFXMessageBox

 
0
  #5
Oct 23rd, 2008
AfxMessageBox requires a LPCTSTR but you pass an array of char[30] as a parameter.

  1. char str[30] = "Hello world!";
  2. AfxMessageBox(&x[0]);

works without any problems (in a non-Unicode project).
Last edited by jencas; Oct 23rd, 2008 at 6:47 am.
If you are forced to reinvent the wheel at least try to invent a better one!

Please use code tags - Please mark solved threads as solved
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,448
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1475
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Still Learning

Re: AFXMessageBox

 
0
  #6
Oct 23rd, 2008
or for UNICODE
  1. TCHAR str[] = _TEXT("Hello world!");
  2. AfxMessageBox(x);
Last edited by Ancient Dragon; Oct 23rd, 2008 at 7:50 am.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC