向有“有容大哥”问个windowS编程自学手册makewin问题?
#define STRICT#include<windows.h>
#include<windowsx.h>
#include<string.h>
char Name[]="MakeWin";
LRESULT CALLBACK WndProc(HWND,UINT,WPARAM,LPARAM);
#pragma warning (disable:4068)
#pragma argsused
int WINAPI WinMain(HINSTANCE hInst,HINSTANCE hPrevInstance,
LPSTR lpszCmdPram,int nCmdShow)
{
HWND hwnd;
MSG Msg;
WNDCLASS WndClass;
memset (&WndClass,0,sizeof(WNDCLASS));
WndClass.style = CS_HREDRAW|CS_VREDRAW;
WndClass.lpfnWndProc = WndProc;
WndClass.hInstance = hInst;
WndClass.hbrBackground = Name;这里出问题了
RegisterClass(&WndClass);
hwnd = CreateWindow(Name,Name,WS_OVERLAPPEDWINDOW,
10,10,600,400,NULL,NULL,hInst,NULL);
ShowWindow(hwnd,nCmdShow);
UpdateWindow(hwnd);
while(GetMessage(&Msg,NULL,0,0))
{
TranslateMessage(&Msg);
DispatchMessage(&Msg);
}
return Msg.wParam;
}
LRESULT CALLBACK WndProc(HWND hwnd,UINT Message,
WPARAM wParam,LPARAM lParam)
{
if(Message==WM_DESTROY)
{
PostQuitMessage(0);
return 0;
}
return DefWindowProc(hwnd,Message,wParam,lParam);
}
E:\windows\test\makewin.cpp(23) : error C2440: '=' : cannot convert from 'char [8]' to 'struct HBRUSH__ *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
第一个WINDOWS程序,出了好多问题,经过调试,只剩一个问题了,这最后一个我不知道是什么原因