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

This board is for introductions only. Moved to C forum.

Post the line of code that caused that error because I'm not a mind reader or clairvoyant.

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

Member Avatar for jencas

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

or for UNICODE

TCHAR str[] = _TEXT("Hello world!");
  AfxMessageBox(x);
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.