| *** |
| ドキュメント |
*** |
| ヘッダファイル |
*** |
| ソースファイル |
*** |
| 関連項目 |
| 名前空間 |
*** |
| クラス |
*** |
siki/win32/win32util.hpp : ver090505
/*
* win32util.hpp
* Copyright (C) 2009 siki
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see
* http://www.gnu.org/licenses/gpl-3.0.html.
*
* author:rei
*/
#ifndef __SIKI_WIN32_WIN32UTIL_H__
#define __SIKI_WIN32_WIN32UTIL_H__
#include <windows.h>
namespace siki{
namespace win32{
/***
*** hwndがダイアログかどうかを取得する
***/
bool IsDialog(HWND hwnd);
/***
*** hwndに関連付けられているHINSTANCEを取得する
***/
HINSTANCE GetInstanceHandle(HWND hwnd);
/***
*** hwndのウィンドウプロシージャを取得する
***/
WNDPROC GetWndProc(HWND hwnd);
/***
*** hwndのウィンドウプロシージャを設定する
***/
WNDPROC SetWndProc(HWND hwnd, WNDPROC proc);
} // namespace win32
} // namespace siki
#endif // __SIKI_WIN32_WIN32UTIL_H__
siki/win32/win32util.cpp : ver090505
/*
* win32util.cpp
* Copyright (C) 2009 siki
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see
* http://www.gnu.org/licenses/gpl-3.0.html.
*
* author:rei
*/
#include "win32util.hpp"
namespace siki{
namespace win32{
/***
***
***/
bool IsDialog(HWND hwnd){
return static_cast<bool>(GetWindowLong(hwnd, DWL_DLGPROC));
}
/***
*** WNDPROC GetInstanceHandle(HWND hwnd)
***
*** hwndに関連付けられているHINSTANCEを取得する
***/
HINSTANCE GetInstanceHandle(HWND hwnd){
return reinterpret_cast<HINSTANCE>(GetWindowLong(hwnd, GWL_HINSTANCE));
}
/***
*** WNDPROC GetWndProc(HWND hwnd)
***
*** hwndのウィンドウプロシージャを取得する
***/
WNDPROC GetWndProc(HWND hwnd){
return reinterpret_cast<WNDPROC>(
GetWindowLong(hwnd, IsDialog(hwnd) ? DWL_DLGPROC : GWL_WNDPROC));
}
/***
*** WNDPROC SetWndProc(HWND hwnd, WNDPROC proc)
***
*** hwndのウィンドウプロシージャを設定する
***/
WNDPROC SetWndProc(HWND hwnd, WNDPROC proc){
return reinterpret_cast<WNDPROC>(
SetWindowLong(
hwnd,
IsDialog(hwnd) ? DWL_DLGPROC : GWL_WNDPROC,
reinterpret_cast<long>(proc)
)
);
}
} // namespace win32
} // namespace siki
最終更新:2009年05月05日 19:55