stdafx.hとかに
#include <windows.h>
#pragma comment(lib, "user32.lib")
#pragma comment(lib, "gdi32.lib")
とか
で、
::MessageBox( 0 , "test" , "caption" , MB_OK );
等が使える。
- HWND取得
//丁寧にキャスト
HWND hWnd = reinterpret_cast<HWND>(this->Handle.ToPointer());
//てきとうにキャスト
HWND hWnd = (HWND)this->Handle.ToPointer();
- HDC取得
・Paintイベントの時
private: System::Void Form1_Paint(System::Object^ sender, System::Windows::Forms::PaintEventArgs^ e)
{
HDC hdc = (HDC)(e->Graphics->GetHdc().ToPointer());
...
e->Graphics->ReleaseHdc((System::IntPtr)hdc);
}
まあ、
HWND取れれば、GetDC/ReleaseDCできるじゃん。
関連スレ
http://hpcgi1.nifty.com/MADIA/Vcbbs/wwwlng.cgi?print+200601/06010032.txt