The annoying LPCWSTR in as WinAPI parameter

I'm just trying to launch a message box in visual c++

This does not work....

MessageBox(NULL,TCHAR("test"),(LPCWSTR)"test",NULL);

Help. :-)
silentthread2kSenior Software EngineerAsked:
Who is Participating?
 
LordOfPortsConnect With a Mentor Commented:
Visual C++ .NET
MessageBox::Show("Test");

Navtive C++
MessageBox(_T("test"), _T("test"));
0
 
silentthread2kSenior Software EngineerAuthor Commented:
It rocks man! Clean, short and to the point!
0
 
LordOfPortsCommented:
Here is also a reference to the .NET version with various other options such as icons (code is in the lower section of the page:

http://msdn.microsoft.com/en-us/library/system.windows.forms.messagebox.aspx

...and the native Win32 version reference:

http://msdn.microsoft.com/en-us/library/ms645505(VS.85).aspx
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.