禁止关机 (C++ Builder)

来源(怡园)

From: http://yynets.best.163.com/cbuilder.htm

禁止关机 (C++ Builder)

1.先打开头文件作如下修改:

class TForm1 : public TForm {
    __published: // IDE-managed Components
    private: // User declarations
    void __fastcall WMQueryEndSession(TWMQueryEndSession &msg);
    public: // User declarations
    __fastcall TForm1(TComponent* Owner);
    BEGIN_MESSAGE_MAP
    MESSAGE_HANDLER(WM_QUERYENDSESSION,TWMQueryEndSession,WMQueryEndSession)
    END_MESSAGE_MAP(TForm)
};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endif


2.然后对unit.cpp文件添加如下代码:

void __fastcall TForm1::WMQueryEndSession(TWMQueryEndSession &msg) {
    msg.Result = 0;
    ShowMessage("你不能关闭系统");
}

Link: http://www.asm32.net/article_details.aspx?id=1914


浏览次数 496 发布时间 2006/8/25 7:36:17 从属分类 C/C++ 【评论】【 】【打印】【关闭
 
| www.asm32.net | 2006版 | 资料中心 | linux | asm/asm32 | C/C++ | VC++ | java | Python | 书签 | ASP.Net书签 | 京ICP备09029108号-1