2 small errors in my Second Win32 Project

Here are the errors
1
2
3
4
5
1
1>  WinMain.cpp
1>c:\users\david\documents\visual studio 2010\projects\win32 projects\winmain.cpp(53): error C2440: '=' : cannot convert from 'const char [15]' to 'LPCWSTR'
1>          Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>c:\users\david\documents\visual studio 2010\projects\win32 projects\winmain.cpp(77): fatal error C1057: unexpected end of file in macro expansion
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========



The equal sign is underlined here
wc.lpszClassName = "MyWndClassName";

and ZeroMemory is underlined here
1
2
MSG msg;
ZeroMemory(&msg, sizeof(MSG);
#include "tchar.h"

TCHAR szClassName[]=_T("MyWndClassName");
...
...
...
wc.lpszClassName=szClassName;

Youn shouldn't need ZeroMemory() there.
Last edited on
Thank you!
Consider that Microsoft Visual Studio defaults to UNICODE builds. If you use the tchar.h macros your code will always work. If you are using chars instead of TCHARs, then you would likely be better off going into to 'Properties' and setting the character set to 'Multi-Byte' or 'unset'. You would probably be better off sticking to the wide character stuff so you get used to it.
Okay now the equal sign under
 
winClass.hbrBackground	= GetStockObject(BLACK_BRUSH);


is red and it says

 
Error: a value of type "HGDIOBJ" cannot be assigned to an entity of type "HBRUSH"


Help is very appreciated!
Topic archived. No new replies allowed.