![]() |
China DOS Union-- Unite DOS · Advance DOS · Grow DOS --Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum |
| Guest | Log in | Register | Members | Search | China DOS Union |
|
中国DOS联盟论坛 The time now is 2026-08-24 18:03 |
47,812 topics / 349,910 posts / today 1 new / 48,262 members |
| 论坛回收站 » Help to compile this C++ into an executable file that can be called and executed by EXE or batch processing? |
| Printable Version 2,068 / 2 |
| Floor1 bd123456789 | Posted 2010-06-23 15:55 |
| 中级用户 Posts 216 Credits 360 | |
|
```cpp
#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; } ``` |
|
| Floor2 yksoft1 | Posted 2010-06-23 21:46 |
| 高级用户 Posts 395 Credits 823 | |
|
This seems to be the simplest win stub. Let's send a function to turn off the monitor power.
|
|
| Floor3 bd123456789 | Posted 2010-06-26 17:17 |
| 中级用户 Posts 216 Credits 360 | |
Originally posted by yksoft1 at 2010-6-23 09:46 PM: Hmm, powerful Can anyone help compile it? |
|
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |