登登登登!
我发现如何克制可恶的机房管理助手,以及如何阻止关机的方法。
首先,关闭可恶的机房管理助手,我们只需要在关机的时候(关机的时候助手会没) 阻止关机
这就是把他们联系在一起的原因,现在,只需要在关机时弹出一个*窗口,阻止关机,
此时助手也没了,就可以实现了。
放代码:
(本代码不是原创,注意!) 链接 密码:i6eu
查看代码
#include "windows.h"
LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM);
char szClassName[ ] = "WindowsApp";
int WINAPI WinMain (HINSTANCE hThisInstance,
HINSTANCE hPrevInstance,
LPSTR lpszArgument,
int nFunsterStil)
{
HWND hwnd;
MSG messages;
WNDCLASSEX wincl;
wincl.hInstance = hThisInstance;
wincl.lpszClassName = szClassName;
wincl.lpfnWndProc = WindowProcedure;
wincl.style = CS_DBLCLKS;
wincl.cbSize = sizeof (WNDCLASSEX);
wincl.hIcon = LoadIcon (NULL, IDI_APPLICATION);
wincl.hIconSm = LoadIcon (NULL, IDI_APPLICATION);
wincl.hCursor = LoadCursor (NULL, IDC_ARROW);
wincl.lpszMenuName = NULL;
wincl.cbClsExtra = 0;
wincl.cbWndExtra = 0;
wincl.hbrBackground = (HBRUSH) COLOR_BACKGROUND;
if (!RegisterClassEx (&wincl))
return 0;
hwnd = CreateWindowEx (
0,
szClassName,
"Windows App",
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,
CW_USEDEFAULT,
544,
375,
HWND_DESKTOP,
NULL,
hThisInstance,
NULL
);
//ShowWindow (hwnd, nFunsterStil);
while (GetMessage (&messages, NULL, 0, 0))
{
TranslateMessage(&messages);
DispatchMessage(&messages);
}
return messages.wParam;
}
LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
int mymessage;
switch (message)
{
case WM_DESTROY:
PostQuitMessage (0);
break;
case WM_QUERYENDSESSION:
mymessage=::MessageBox(NULL,"操作完成","现在可以点击取消",MB_OK);
if (mymessage==IDYES)
return 1;
else
return 0;
case WM_ENDSESSION:
return 0;
default:
return DefWindowProc (hwnd, message, wParam, lParam);
}
return 0;
}