level 12
贴吧用户_Q9JD88t
楼主
#include<windows.h>
#include<stdio.h>
LRESULT CALLBACK imhere(
HWND hwnd,
UINT uMsg,
WPARAM wParam,
LPARAM lParam
);
int CALLBACK WinMain(
HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow
)
{
WNDCLASS imcoming;
imcoming.cbClsExtra=0;
imcoming.cbWndExtra=0;
imcoming.hbrBackground=(HBRUSH)GetStockObject(BLACK_PEN);
imcoming.hCursor=LoadCursor(NULL,IDC_NO);
imcoming.hIcon=LoadIcon(NULL,IDI_ERROR);
imcoming.hInstance=hInstance;
imcoming.lpfnWndProc=imhere;
imcoming.lpszClassName="Imcoming";
imcoming.lpszMenuName=NULL;
imcoming.style=CS_HREDRAW|CS_VREDRAW;
RegisterClass(&imcoming);
HWND hwnd;
hwnd=CreateWindow("Imcoming","警告!",WS_OVERLAPPED|WS_DISABLED,0,0,61,100,NULL,NULL,hInstance,NULL);
ShowWindow(hwnd,SW_SHOWNORMAL);
UpdateWindow(hwnd);
MSG msg;
while(GetMessage(&msg,NULL,0,0)){
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return 0;
}
LRESULT CALLBACK imhere(
HWND hwnd,
UINT uMsg,
WPARAM wParam,
LPARAM lParam
)
{
switch(uMsg){
case WM_PAINT:
HDC hdc;
PAINTSTRUCT ps;
hdc=BeginPaint(hwnd,&ps);
TextOut(hdc,30,50,"您的煞笔已超出电脑认知范畴,请长按电源键",strlen("您的煞笔已超出电脑认知范畴,请长按电源键"));
EndPaint(hwnd,&ps);
break;
case WM_CLOSE:
if(IDYES==MessageBox(hwnd,"你终于愿意承认自己的煞笔了么?","抉择",MB_YESNO)){
DestroyWindow(hwnd);
}
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hwnd,uMsg,wParam,lParam);
}
return 0;
}
新人初学MFC处女作,然而VS2010上运行失败,求告知错误原因!!!求大触点明!!!
2015年07月25日 05点07分
1
#include<stdio.h>
LRESULT CALLBACK imhere(
HWND hwnd,
UINT uMsg,
WPARAM wParam,
LPARAM lParam
);
int CALLBACK WinMain(
HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow
)
{
WNDCLASS imcoming;
imcoming.cbClsExtra=0;
imcoming.cbWndExtra=0;
imcoming.hbrBackground=(HBRUSH)GetStockObject(BLACK_PEN);
imcoming.hCursor=LoadCursor(NULL,IDC_NO);
imcoming.hIcon=LoadIcon(NULL,IDI_ERROR);
imcoming.hInstance=hInstance;
imcoming.lpfnWndProc=imhere;
imcoming.lpszClassName="Imcoming";
imcoming.lpszMenuName=NULL;
imcoming.style=CS_HREDRAW|CS_VREDRAW;
RegisterClass(&imcoming);
HWND hwnd;
hwnd=CreateWindow("Imcoming","警告!",WS_OVERLAPPED|WS_DISABLED,0,0,61,100,NULL,NULL,hInstance,NULL);
ShowWindow(hwnd,SW_SHOWNORMAL);
UpdateWindow(hwnd);
MSG msg;
while(GetMessage(&msg,NULL,0,0)){
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return 0;
}
LRESULT CALLBACK imhere(
HWND hwnd,
UINT uMsg,
WPARAM wParam,
LPARAM lParam
)
{
switch(uMsg){
case WM_PAINT:
HDC hdc;
PAINTSTRUCT ps;
hdc=BeginPaint(hwnd,&ps);
TextOut(hdc,30,50,"您的煞笔已超出电脑认知范畴,请长按电源键",strlen("您的煞笔已超出电脑认知范畴,请长按电源键"));
EndPaint(hwnd,&ps);
break;
case WM_CLOSE:
if(IDYES==MessageBox(hwnd,"你终于愿意承认自己的煞笔了么?","抉择",MB_YESNO)){
DestroyWindow(hwnd);
}
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hwnd,uMsg,wParam,lParam);
}
return 0;
}
新人初学MFC处女作,然而VS2010上运行失败,求告知错误原因!!!求大触点明!!!