like this:
_UNICODE and UNICODE are commented out because these are enabled by default in project properties(if i enable them i get a redefinition warning)
there is a setting in project properties under:
configuration properties -> general -> character set
i changed character set property to use unicode... but i checked that if i put it on use multibyte... or Not setthen everything works ok...
so what this setting means?
Code:
#define WIN32_LEAN_AND_MEAN
//#define _UNICODE
#include <tchar.h>
//#define UNICODE
#include <windows.h>
#include "resource.h"
LRESULT CALLBACK WndProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam);
int WINAPI _tWinMain(HINSTANCE hInst,HINSTANCE hPreInst,LPTSTR lpszCmdLine,int nCmdShow)
{
_TCHAR g_szClassName[] = _T("myWindowClass");
WNDCLASSEX wc;
HWND hwnd;
MSG Msg;
wc.cbSize = sizeof(WNDCLASSEX);
wc.style = 0;
wc.lpfnWndProc = WndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInst;
wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
wc.lpszMenuName = NULL;
wc.lpszClassName = g_szClassName;
wc.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
// this is THE messagebox
MessageBox(NULL, _T("жми ок"), _T("привет"),
MB_ICONEXCLAMATION | MB_OK);
if(!RegisterClassEx(&wc))
{
MessageBox(NULL, _T("Window Registration Failed!"), _T("Error!"),
MB_ICONEXCLAMATION | MB_OK);
return 0;
}
hwnd = CreateWindowEx(
WS_EX_CLIENTEDGE,
g_szClassName,
_T("The title of my window"),
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, CW_USEDEFAULT, 240, 120,
NULL, NULL, hInst, NULL);
if(hwnd == NULL)
{
MessageBox(NULL, _T("Window Creation Failed!"), _T("Error!"),
MB_ICONEXCLAMATION | MB_OK);
return 0;
}
ShowWindow(hwnd, nCmdShow);
UpdateWindow(hwnd);
while (GetMessage(&Msg,NULL,0,0))
{
TranslateMessage(&Msg);
DispatchMessage(&Msg);
}
return 0;
}