TOP C C++ Languages API COM MFC
MSDN
socket
ECMA234
Resource
version.rc
SubClass
Hook
saved_proc = (WNDPROC)GetWindowLong(hwnd, GWL_WNDPROC); SetWindowLong(hwnd, GWL_WNDPROC, (LONG)new_proc);
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 vs GetDC
| 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 *) |
StockObject
| 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 |
WM_ENABLE
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);
WM_COMMAND memo
| 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 |
WM_USER WM_APP
| 0x0000 | WM_USER-1 | システム・メッセージ |
| WM_USER(0x4000) | WM_APP-1 | 各ウィンドウクラス・メッセージ |
| WM_APP (0x8000) | 0xBFFF | アプリケーション・メッセージ |
| 0xC000 | 0xFFFF | アプリケーション・文字列(RegisterWindowMessage) |
| 0x10000 | - | reserved |
MessageBox
self-extract
Knowledge Base
Font
Power Management
スリープへの移行回避
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
窓プログラミング
C/C++によるWin32API
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
窓プログラミング
C/C++によるWin32API
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 );


最新コメント