#ifndef KMWIN_NBOX_HPP_ #define KMWIN_NBOX_HPP_ //////// // こんな形で windows.h を include すれば便利かと #ifndef STRICT #define STRICT #endif #ifndef _WIN32_WINNT #define _WIN32_WINNT 0x500 #endif #include #ifdef WINVER # if WINVER < 0x0400 # error WINVER too min! # endif #else # error where WINVER ? #endif //////// #define DECLARE_CLASSNAME_NOTIFYBOX_0507_ TEXT("kmwinNotifyBoxClass") #define CLASS_NOTIFYBOX DECLARE_CLASSNAME_NOTIFYBOX_0507_ // CLASS_NOTIFYBOX という識別子が気に入らなければ,替えればよい // ※ DECLARE_CLASSNAME_.... という識別子は変えるべきでない .. cpp ファイルでも使っているから // ウィンドウの状態を示す定数 enum { NBSTATE_ERROR = 0, NBSTATE_BEGINNING = 1, // NotifyBox_begin() 直後〜表示が開始されるまで NBSTATE_APPEARING, // 出現中 NBSTATE_STABLE, // 完全に表示され,停止中 NBSTATE_SINKING, // 隠れていく最中 NBSTATE_SUNK // 完全に隠れた後 }; /// メソッド //! NotifyBox_begin( this_, delay, kepp, msg, mlen, cap, clen, ehandler ) -- 表示開始 UINT NBM_BEGIN(); LRESULT NotifyBox_begin( HWND this_ ); LRESULT NotifyBox_beginDirectly( HWND this_, // notify box のウィンドウハンドル DWORD delay, // 何 msec 後に表示を開始するか DWORD keep, // 何 msec 表示を続けるか LPCTSTR msg, int mlen, // 表示する文字列と長さ -- msg は NULL 不可 LPCTSTR cap, int clen, // キャプション文字列と長さ -- cap は NULL 不可 HWND event_handler ); // 各イベントを捕捉するウィンドウ -- NULL 可 //! NotifyWin_getState( this_ ) -- 現在のボックスの状態を得る UINT NBM_GETSTATE(); LRESULT NotifyBox_getState( HWND this_ ); // delay UINT NBM_SETDELAY(); UINT NBM_GETDELAY(); void NotifyBox_setDelay( HWND this_, DWORD delay ); DWORD NotifyBox_getDelay( HWND this_ ); // keep alive UINT NBM_SETKEEP(); UINT NBM_GETKEEP(); void NotifyBox_setKeep( HWND this_, DWORD keep ); DWORD NotifyBox_getKeep( HWND this_ ); // message UINT NBM_SETMESSAGE(); UINT NBM_GETMESSAGE(); UINT NBM_GETMESSAGELENGTH(); void NotifyBox_setMessage( HWND this_, LPCTSTR message, int length ); void NotifyBox_getMessage( HWND this_, LPTSTR buffer, int size ); int NotifyBox_getMessageLength( HWND this_ ); // caption UINT NBM_SETCAPTION(); UINT NBM_GETCAPTION(); UINT NBM_GETCAPTIONLENGTH(); void NotifyBox_setCaption( HWND this_, LPCTSTR caption, int length ); void NotifyBox_getCaption( HWND this_, LPTSTR buffer, int size ); int NotifyBox_getCaptionLength( HWND this_ ); // event handler UINT NBM_SETEVENTHANDLER(); UINT NBM_GETEVENTHANDLER(); void NotifyBox_setEventHandler( HWND this_, HWND event_handler ); HWND NotifyBox_getEventHandler( HWND this_ ); /// イベント -- event_handler に送られる //! on appear -- 完全に表示された後で post される UINT NBM_APPEAR(); //! on finish -- 完全に隠れた後で post される UINT NBM_FINISH(); /// デフォルトのウィンドウプロシージャ LRESULT CALLBACK NotifyBox_defWindowProc( HWND, UINT, WPARAM, LPARAM ); // サブクラス化した場合,元々のプロシージャを保持しておくのが面倒臭ければ // これを呼んでもよい(はず?) /// 初期化 (ウィンドウクラスを登録する) ATOM registerNotifyBoxClass( HINSTANCE hinst ); // CreateWindowEx で NotifyBox を作るなら,その前に 1 度だけこれが必須 // アプリケーション内で 1 度呼べば充分 (何度呼んでもよいけど) /// 簡単なコンストラクタ HWND WINAPI createNotifyBox( HINSTANCE hinst // アプリケーションのインスタンス ); // 内部では registerNotifyBoxClass を呼び出している /// MessageBox を置き換える(かも) void WINAPI NotifyBox( LPCTSTR szMessage, LPCTSTR szCaption ); #endif // KMWIN_NWIN_HPP_