5,530
社区成员
发帖
与我相关
我的任务
分享
#include <windows.h>
LRESULT CALLBACK vvc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam)
{
HDC hdc;
PAINTSTRUCT ps;
RECT rect;
switch(msg)
{
case WM_CREATE:
//MessageBox(NULL,"aa","bb",MB_OK);
return 0;
case WM_PRINT:
hdc=BeginPaint(hwnd,&ps);
DrawText ( hdc, "fuck", -1, &rect,
DT_SINGLELINE | DT_CENTER | DT_VCENTER) ;
EndPaint(hwnd,&ps);
return 0 ;
case WM_DESTROY:
PostQuitMessage(0);
return 0 ;
case WM_LBUTTONDBLCLK:
//SendMessage(hwnd,WM_DESTROY,NULL,NULL);
MessageBox(hwnd,"aa","bb",MB_OKCANCEL);
return 0 ;
default:
return DefWindowProc(hwnd,msg,wParam,lParam);
}
}
char szClassName[] = "afd";
int WINAPI WinMain(HINSTANCE hThisInstance,HINSTANCE hPrevInstance,LPSTR lpszArgument,int nFunsterStil)
{
/* TODO: Place code here.*/
char ch[]="test";
WNDCLASSEX wincl;
HWND hwnd=NULL;
MSG msge;
wincl.hInstance = hThisInstance;
wincl.lpszClassName = szClassName;
wincl.lpfnWndProc = vvc; /* This function is called by windows */
wincl.style = CS_DBLCLKS; /* Catch double-clicks */
wincl.cbSize = sizeof (WNDCLASSEX);
/* Use default icon and mouse-pointer */
wincl.hIcon = NULL;
wincl.hIconSm = NULL;
wincl.hCursor = NULL;
wincl.lpszMenuName = NULL; /* No menu */
wincl.cbClsExtra = 0; /* No extra bytes after the window class */
wincl.cbWndExtra = 0; /* structure or the window instance */
/* Use Windows's default color as the background of the window */
wincl.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
if(!RegisterClassEx (&wincl))
{
MessageBoxA(NULL,"xx","xx",0);
return 0;
}
hwnd=CreateWindowEx(0, /* Extended possibilites for variation */
szClassName, /* Classname */
"aavvcc", /* Title Text */
WS_SYSMENU, /* default window */
CW_USEDEFAULT, /* Windows decides the position */
CW_USEDEFAULT, /* where the window ends up on the screen */
544, /* The programs width */
375, /* and height in pixels */
HWND_DESKTOP, /* The window is a child-window to desktop */
NULL, /* No menu */
hThisInstance, /* Program Instance handler */
NULL );
ShowWindow(hwnd,SW_SHOWNORMAL);
UpdateWindow(hwnd);
while (GetMessage(&msge, NULL, 0, 0))
{
TranslateMessage (&msge) ;
DispatchMessage (&msge) ;
}
return msge.wParam ;
}