|
안녕하세요 경호님..
답변감사합니다.
그런데 로그오프시 메시지 박스가 뜨는건 문제없지만 막상 로그오프는 되지않습니다.
뭔가 로그오프 처리가 이어지다가 맥이 끈겨서 다른 프로그램들은 로그 오프준비가 되었는데 제 프로그램만
멈춰서있는것 같은데.. ^^
뭐가 잘못된 것인지 ... 도와주세욤~~
경호 님이 쓰신 글 :
: 레조님 안녕하세요 오래간만 이네요 ^^
:
: 윈도우의 로그오프나 종료 메세지를 잡아 내는 것은 그리 힘들지 않아요
: 메세지 맵을 작성하시고 메세지를 검사하면 되니까요...
:
: 간단하게 코드를 보여 드릴께요 ^^
:
: 먼저 헤더
:
: //---------------------------------------------------------------------------
: #ifndef Unit1H
: #define Unit1H
: //---------------------------------------------------------------------------
: #include <Classes.hpp>
: #include <Controls.hpp>
: #include <StdCtrls.hpp>
: #include <Forms.hpp>
: //---------------------------------------------------------------------------
: class TForm1 : public TForm
: {
: __published: // IDE-managed Components
: TButton *Button1;
: void __fastcall Button1Click(TObject *Sender);
: private: // User declarations
: void __fastcall WMQueryEndSession(TMessage Msg);
: public: // User declarations
: __fastcall TForm1(TComponent* Owner);
: BEGIN_MESSAGE_MAP
: MESSAGE_HANDLER(WM_QUERYENDSESSION,TMessage,WMQueryEndSession)
: END_MESSAGE_MAP(TForm)
: };
: //---------------------------------------------------------------------------
: extern PACKAGE TForm1 *Form1;
: //---------------------------------------------------------------------------
: #endif
:
:
: 메인 입니다.
:
: //---------------------------------------------------------------------------
: #include <vcl.h>
: #pragma hdrstop
:
: #include "Unit1.h"
: //---------------------------------------------------------------------------
: #pragma package(smart_init)
: #pragma resource "*.dfm"
: TForm1 *Form1;
: //---------------------------------------------------------------------------
: __fastcall TForm1::TForm1(TComponent* Owner)
: : TForm(Owner)
: {
: }
: //---------------------------------------------------------------------------
: void __fastcall TForm1::WMQueryEndSession(TMessage Msg)
: {
: if(MessageDlg("정말로 윈도우를 종료할까요?", mtConfirmation, mbOKCancel, 0) == mrOk)
: //이부분에서 저장하고 플그램 종료하면 되겠죠 ^^
:
: Msg.Result = true;
: else
: Msg.Result = false;
: }
:
: 그럼 즐프하세요 ^^
:
:
|