|
또 '로렌조'임다...^^
저두 테스트 해봤는데요...^^;
그냥은 안되더군요....만약 님이 사용하시는 OS가 Windows9x 버전이 아니라면 님 프로그램에서
시스템을 셧다운 할 수 있는 권한이 있어야만 합니다...
도움말 보시면 AdjustTokenPrivileges로 권한을 준 다음에 하면 될 것 같군요...
BOOL AdjustTokenPrivileges(
HANDLE TokenHandle, // handle to token that contains privileges
BOOL DisableAllPrivileges, // flag for disabling all privileges
PTOKEN_PRIVILEGES NewState, // pointer to new privilege information
DWORD BufferLength, // size, in bytes, of the PreviousState buffer
PTOKEN_PRIVILEGES PreviousState, // receives original state of changed privileges
PDWORD ReturnLength // receives required size of the PreviousState buffer
);
도움말 참조하세요.....이만...
kkadin 님이 쓰신 글 :
: App1에서 다음 명령을 수행해서 windows 종료 msg를 발생시키구요
: ::ExitWindowsEx(EWX_POWEROFF,0);
:
: app2에서 message map 을 만들어서요.
: class TForm1 : public TForm
: {
: __published: // IDE-managed Components
: private: // User declarations
: public: // User declarations
: __fastcall TForm1(TComponent* Owner);
:
: void __fastcall WinCloseCommand(TMessage& Msg);
: BEGIN_MESSAGE_MAP
: MESSAGE_HANDLER(WM_QUERYENDSESSION, TMessage, WinCloseCommand)
: END_MESSAGE_MAP(TForm)
: };
:
: 문제는 다음과 같이 함수를 작성하면 msg box만 보여주고 종료과정이 더이상 진행되지 않는다는점이며
: 두번째 라인의 주석처리를 제거하면 다운됩니다. ( 재귀호출이 되는것 같습니다.) 어떻게 원하는 명령을 수행한 후에도 windows를 종료시킬수 있을까요?
: void __fastcall TForm1::WinCloseCommand(TMessage& Msg)
: {
: ShowMessage("종료합니다. ");
: //::ExitWindowsEx(EWX_POWEROFF,0);
: }
:
:
|