bd123456789
中级用户
积分 360
发帖 216
注册 2007-5-29
状态 离线
|
『楼 主』:
帮忙把这段C++编译成EXE或批处理能调用执行的文件?
#include <windows.h>
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
PSTR szCmdLine, int iCmdShow)
{
static TCHAR szAppName[] = TEXT("ScreenDown") ;
HWND hwnd ;
WNDCLASS wndclass ;
wndclass.style = CS_HREDRAW | CS_VREDRAW ;
wndclass.lpfnWndProc = DefWindowProc ;
wndclass.cbClsExtra = 0 ;
wndclass.cbWndExtra = 0 ;
wndclass.hInstance = hInstance ;
wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION) ;
wndclass.hCursor = LoadCursor(NULL, IDC_ARROW) ;
wndclass.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH) ;
wndclass.lpszMenuName = NULL ;
wndclass.lpszClassName = szAppName ;
if (!RegisterClass(&wndclass))
{
MessageBox(NULL, TEXT("This program requires Windows NT!"), szAppName,
MB_ICONERROR) ;
return 0 ;
}
hwnd = CreateWindow(szAppName, TEXT("ScreenDown"), WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL,
NULL, hInstance, NULL) ;
ShowWindow(hwnd, 0) ;
UpdateWindow(hwnd) ;
Sleep(1000);
SendMessage(hwnd, WM_SYSCOMMAND, SC_MONITORPOWER, 2);
return 0;
}
|
|