0

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

5
Contributors
5
Replies
7
Views
8 Years
Discussion Span
Last Post by Ancient Dragon
0

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?).

0

AfxMessageBox requires a LPCTSTR but you pass an array of char[30] as a parameter.

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

works without any problems (in a non-Unicode project).

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.