Error C2664 MessageBoxW

A

antione

I am using VS2005, and when trying to do a simple message box display
I get the following error message.
error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'const
char [40]' to 'LPCWSTR'

any sugestions on the problem here is a copy of the code I am using


#include "windows.h"
#include <iostream>
using namespace std;

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nShowCmd)
{
MessageBox(NULL, "MotoKo Kusanagi has hacked your system!",
"Public Security Section9", MB_OK | MB_ICONEXCLAMATION);
}
 
C

Christian Resma Helle

MessageBox(NULL, TEXT("MotoKo Kusanagi has hacked your system!"),
TEXT("Public Security Section9"), MB_OK | MB_ICONEXCLAMATION);

Should do the trick. By the way this is a managed code newsgroup...
 
A

antione

MessageBox(NULL, TEXT("MotoKo Kusanagi has hacked your system!"),
TEXT("Public Security Section9"), MB_OK | MB_ICONEXCLAMATION);

Should do the trick. By the way this is a managed code newsgroup...

--
Regards,
Christian Resma Hellehttp://christian-helle.blogspot.com




I am using VS2005, and when trying to do a simple message box display
I get the following error message.
error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'const
char [40]' to 'LPCWSTR'
any sugestions on the problem here is a copy of the code I am using
#include "windows.h"
#include <iostream>
using namespace std;
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nShowCmd)
{
MessageBox(NULL, "MotoKo Kusanagi has hacked your system!",
"Public Security Section9", MB_OK | MB_ICONEXCLAMATION);
}- Hide quoted text -

- Show quoted text -

Thank you very much! sorry for posting in wrong newsgroup. Is there a
newsgroup that you could recomend for a college student that is
learning Visual C++ 2005?
Thanks again
Timothy A Schnedler
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top