execute Ex12_01 no result
#include <windows.h>
//#include <iostream>
//#include <stdio.h>
//using namespace std;
LRESULT CALLBACK WindowFirstProc(HWND hwnd, UINT message,
WPARAM wParam, LPARAM lParam);
int WINAPI WinMain(
HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nShowCmd
)
{
WNDCLASS myWindow ;
static LPCTSTR szAppName="OFWIN";
HWND hwnd;
MSG msg;
//myWindow.cbSize=sizeof(WNDCLASSEX);
myWindow.style =CS_HREDRAW | CS_VREDRAW;
myWindow.lpfnWndProc=WindowFirstProc;
myWindow.cbClsExtra=0;
myWindow.cbWndExtra=0;
myWindow.hInstance= hInstance;
myWindow.hIcon=LoadIcon(0,IDI_APPLICATION);
myWindow.hCursor=LoadCursor(0,IDC_ARROW);
myWindow.hbrBackground=(HBRUSH)GetStockObject(WHIT E_BRUSH);
myWindow.lpszMenuName=NULL;
myWindow.lpszClassName=szAppName;
//myWindow.hIconSm=0;
RegisterClass(&myWindow);
//hwnd = CreateWindow("sunxin2006","http://www.sunxin.org",WS_OVERLAPPEDWINDOW,
//0,0,600,400,NULL,NULL,hInstance,NULL);
hwnd = CreateWindow("First_Window_1","First_Window",WS_OV ERLAPPEDWINDOW,0,0,100,100,NULL,NULL,hInstance,NUL L);
ShowWindow(hwnd,SW_SHOWNORMAL);
UpdateWindow(hwnd);
while(GetMessage(&msg,NULL,0,0)==TRUE)
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam;
}
LRESULT CALLBACK WindowFirstProc(HWND hwnd, UINT message,
WPARAM wParam, LPARAM lParam)
{
HDC hdc;
PAINTSTRUCT Paintst;
RECT aRect;
switch(message)
{
case WM_PAINT:
hdc = BeginPaint(hwnd,&Paintst);
GetClientRect(hwnd,&aRect);
SetBkMode(hdc,TRANSPARENT);
DrawText(hdc,"Valcano's soft",-1,&aRect,DT_SINGLELINE | DT_CENTER | DT_VCENTER);
EndPaint(hwnd, &Paintst);
return 0;
case WM_DESTROY:
PostQuitMessage(0);
return 0;
default:
return DefWindowProc(hwnd,message,wParam,lParam);
//return 0;
}
}
Buliding no errors
execute it no result
give me some idears, TKS!
|