|
-
February 28th, 2006, 10:52 PM
#1
Problems with first Win32... pls help!
Hello everyone!
I'm a newbie to windows programming, having migrated from Linux, and am having problems even with my Hello World app... Could someoen please tell me what I am doing wrong here... thanks!
#include <windows.h>
int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nShowCmd )
{
MessageBox( NULL, "I finally work!",
"Hello World", MB_OK | MB_ICONEXCLAMATION ) ;
}
The error says Error 1 error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'const char [16]' to 'LPCWSTR'
Thanks in advance!
-
March 1st, 2006, 02:25 AM
#2
Re: Problems with first Win32... pls help!
Looks like you are using Unicode build in that case change the code:
Code:
::MessageBox( NULL, _T("I finally work!"),_T("Hello World"), MB_OK | MB_ICONEXCLAMATION ) ;
// or
::MessageBox( NULL, L"I finally work!",L"Hello World", MB_OK | MB_ICONEXCLAMATION ) ;
Cheers
-
March 1st, 2006, 04:42 AM
#3
Re: Problems with first Win32... pls help!
Hmm... unicode build eh? Is that the standard? Is there another mode I should use? I use VS2005. Thanks for the info!
-
March 1st, 2006, 04:44 AM
#4
Re: Problems with first Win32... pls help!
My compiler cannot find the _T...
-
March 1st, 2006, 04:51 AM
#5
Re: Problems with first Win32... pls help!
 Originally Posted by jwcalifo
My compiler cannot find the _T... 
Help the compiler to find it. 
include <TCHAR.H>
-
March 1st, 2006, 05:00 AM
#6
Re: Problems with first Win32... pls help!
If you are just beginning with WIN32 applications i would not worry about doing anything with unicode, its just tht bit of exta work that makes things more complex..
-
March 1st, 2006, 05:27 AM
#7
Re: Problems with first Win32... pls help!
 Originally Posted by UnfitElf
If you are just beginning with WIN32 applications i would not worry about doing anything with unicode, its just tht bit of exta work that makes things more complex..
Yeah, sure, but making a habit from Using Generic-Text Mappings (also definitions for generic international functions from TCHAR.H) even for a beginner is not bad.
Later, maybe he/she will work on a serious comercial application and if he/she will consider that "its just tht bit of exta work that makes things more complex" usually will ignore that.
One day, when the application is complex with tens/hundred of thousands lines of code, the boss comes and says "We have to deploy on Japanese market, ASAP!!!".
Then he/she will see indeed much much (usually unallocated in the development plan) extra work necessary.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|