TOP C C++ Languages API COM MFC
- References
- Tips
- Control
- SerialPort
- Printer
- Tutorials
- GDI+
- Win32 Console
- Mingw
- BitBlt
saved_proc = (WNDPROC)GetWindowLong(hwnd, GWL_WNDPROC); SetWindowLong(hwnd, GWL_WNDPROC, (LONG)new_proc);
LRESULT CALLBACK new_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam){ PAINTSTRUCT ps; HDC hdc; switch(message) { case WM_PAINT: hdc = BeginPaint(hwnd, &ps); OnPaint(hwnd, hdc, NULL); EndPaint(hwnd, &ps); return 0; default: break; } return CallWindowProc(saved_proc, hwnd, message, wParam, lParam); }
BeginPaint | GetDC | ||
Clipping Region | yes | no | BeginPaint can draw in clipping region. To know this , use RectVisible(HDC,const RECT *) GetDC can draw anywhere in client area |
validation | yes | no | BeginPaing will validate the invalidate area. GetDC won't do, then WM_PAINT will be sent continuously To validate use ValidateRect(HWND ,CONST RECT *) |
BLACK_BRUSH | Black brush |
DKGRAY_BRUSH | Dark gray brush |
DC_BRUSH | Solid brush.(Color is white,changed by SetDCBrushColor() |
GRAY_BRUSH | Gray brush |
HOLLOW_BRUSH | =NULL_BRUSH |
LTGRAY_BRUSH | Light gray brush |
NULL_BRUSH | =HOLLOW_BRUSH |
WHITE_BRUSH | White brush |
BLACK_PEN | Black pen |
DC_PEN | Solid pen. Color is white,changed by SetDCPenColor() |
NULL_PEN | Empty pen |
WHITE_PEN | White pen |
ANSI_FIXED_FONT | monospace system font |
ANSI_VAR_FONT | proportional system font |
DEVICE_DEFAULT_FONT | Device-dependent font |
DEFAULT_GUI_FONT | MS Sans Serif? |
OEM_FIXED_FONT | OEM monospace font |
SYSTEM_FONT | System font: MS Sans Serif(Windows 95/98/NT) Tahoma(Windows 2000/XP) |
SYSTEM_FIXED_FONT | monospace) system font(for 16-bit Windows) |
DEFAULT_PALETTE | Default palette |
Use EnableWindow(HWND,BOOL);
or Set WS_DISABLED to the control style, then use SendMessage(HWND,WM_ENABLE,BOOL,0);
or Set WS_DISABLED to the control style, then use SendMessage(HWND,WM_ENABLE,BOOL,0);
Message Source | wParam (high word) | wParam (low word) | lParam |
Menu | 0 | Menu identifier (IDM_*) | 0 |
Accelerator | 1 | Accelerator identifier (IDM_*) | 0 |
Control | Control-defined notification code | Control identifier | Handle to the control window |
0x0000 | WM_USER-1 | システム・メッセージ |
WM_USER(0x4000) | WM_APP-1 | 各ウィンドウクラス・メッセージ |
WM_APP (0x8000) | 0xBFFF | アプリケーション・メッセージ |
0xC000 | 0xFFFF | アプリケーション・文字列(RegisterWindowMessage) |
0x10000 | - | reserved |
How To Use the WM_GETDLGCODE Message
WM_GETDLGCODE Message
to handle VK_RETURN in EDIT control, return DLGC_WANTALLKEYS
WM_GETDLGCODE Message
to handle VK_RETURN in EDIT control, return DLGC_WANTALLKEYS
EXECUTION_STATE SetThreadExecutionState(
Handling OS events like Sleep, Stand-by, Hibernate, Power Status Changed, Low Battery, Critial Suspend, AC Power, Battery Power, Battery Life etc... in Windows XP and Vista.
EXECUTION_STATE esFlags);
Handling OS events like Sleep, Stand-by, Hibernate, Power Status Changed, Low Battery, Critial Suspend, AC Power, Battery Power, Battery Life etc... in Windows XP and Vista.
標準 Windows API
猫でもわかるプログラミング
EternalWindows
API別 Win32 サンプル集
SDKプログラミング
インコのWindowsSDK
窓プログラミング
C/C++によるWin32API
UsefullCode.net
The Arcpit Windows API Topics
Windowsプログラミング研究室-VC++やC#-
Windowsプログラミング
Programming Tips
VC++ プログラミング
Win32API(C言語)編 トップページ
Win32 ベースのカスタム コントロールまたはフレームワーク向けの UI オートメーション プロバイダーの作成
CodeGuru
技術メモ - 注意点、備忘録、そんなの
Win32サブルーチンズ
VC++ TIPS 記事一覧
CodeTips
Win32 Programming Tips
超初心者のプログラム入門(C言語 Windows)
猫でもわかるプログラミング
EternalWindows
API別 Win32 サンプル集
SDKプログラミング
インコのWindowsSDK
窓プログラミング
C/C++によるWin32API
UsefullCode.net
The Arcpit Windows API Topics
Windowsプログラミング研究室-VC++やC#-
Windowsプログラミング
Programming Tips
VC++ プログラミング
Win32API(C言語)編 トップページ
Win32 ベースのカスタム コントロールまたはフレームワーク向けの UI オートメーション プロバイダーの作成
CodeGuru
技術メモ - 注意点、備忘録、そんなの
Win32サブルーチンズ
VC++ TIPS 記事一覧
CodeTips
Win32 Programming Tips
超初心者のプログラム入門(C言語 Windows)
HDC hdc_mem; // memory device context HBITMAP hbitmap; // actual memory to draw : void prepare_img(){ HDC hDC = GetDC(hWnd); hdc_mem = CreateCompatibleDC(hDC); // or use NULL for screen DC RECT rt; GetClientRect(hWnd, &rt); hbitmap = CreateCompatibleBitmap( hDC, rt.right, rt.bottom ); SelectObject(hdc_mem,hbitmap); // assign memory to dc HBRUSH hOrigBrush = (HBRUSH)SelectObject( full_range_dc, GetStockObject( BLACK_BRUSH ) ); PatBlt( hdc_mem, 0, 0, rt.right, rt.bottom, PATCOPY ); // paint back in black { // Draw Something to thie hdc_mem // TextOut(hdc_mem , 10 , 10 , "Hello" , 5); } ReleaseDC(hWnd , hDC); } void un_prepare(){ DeleteDC(hdc_mem); hdc_mem=NULL; DeleteObject(hbitmap); hbitmap=NULL; } : // in Paint Handler BitBlt( hdc, 0, 0, rt.right, rt.Widtg, hdc_mem, 0, 0, SRCCOPY );
最新コメント