win32-笔记
1
.创建DirectDraw对象的方法,创建主DirectDraw对象并使用QueryInterface()得到一个IDirectDraw7接口.
或者直接用DirectDrawCreateEx()创建一个DirectDraw7的接口.
HRESULT WINAPI DirectDrawCreate(GUID FAR * lpGUID, // guid of object
LPDIRECTDRAW FAR * lplpDD, // receives interface
IUnknown FAR * pUnkOuter); // com stuff
LpGUID -- NULL,(视频卡驱动的Globally Unique Identifier)
lplpDD -- 返回一个DirectDraw的接口而不是DirectDraw7的接口.
pUnkOuter -- NULL(always set to zero)
或者直接用DirectDrawCreateEx()创建一个DirectDraw7的接口.
HRESULT WINAPI DirectDrawCreate(GUID FAR * lpGUID, // guid of object
LPDIRECTDRAW FAR * lplpDD, // receives interface
IUnknown FAR * pUnkOuter); // com stuff
LpGUID -- NULL,(视频卡驱动的Globally Unique Identifier)
lplpDD -- 返回一个DirectDraw的接口而不是DirectDraw7的接口.
pUnkOuter -- NULL(always set to zero)
自行发送消息:
1 .SendMessage() --- send a message which is processed immediately to a window.In fact,
it calls WinProc().
LRESULT SendMessage(HWND hWnd,UINT,WPARAM,LPARAM);
2 .PostMessage() --- send a message to the messagequeue.just that. if it ' s succeed,it return a value(!0).
BOOL PostMessage(HWND hWnd,UINT Msg,WPARAM wParam,LPARAM lParam);
1 .SendMessage() --- send a message which is processed immediately to a window.In fact,
it calls WinProc().
LRESULT SendMessage(HWND hWnd,UINT,WPARAM,LPARAM);
2 .PostMessage() --- send a message to the messagequeue.just that. if it ' s succeed,it return a value(!0).
BOOL PostMessage(HWND hWnd,UINT Msg,WPARAM wParam,LPARAM lParam);
1
.SetBkMode(hdc,TRANSPARENT);
2 .FillRect(hdc, & r,(HBRUSH)GetStockObject(WHITE_BRUSH));
3 .CreateSolidBrush(RGB( 255 , 0 , 0 ));
4 .wchar_t tmp[ 20 ];
GetDlgItemText(hDlg,IDC_EDIT1,tmp, 20 );
::wstringstream is ;
is << tmp;
is >> size;
5.InvalidateRect(hWnd,0,1);
6.DialogBox(hInst, MAKEINTRESOURCE(IDD_DIALOG1), hWnd, inputsize);
7.WM_CLOSE is sent before WM_DESTYOY.
2 .FillRect(hdc, & r,(HBRUSH)GetStockObject(WHITE_BRUSH));
3 .CreateSolidBrush(RGB( 255 , 0 , 0 ));
4 .wchar_t tmp[ 20 ];
GetDlgItemText(hDlg,IDC_EDIT1,tmp, 20 );
::wstringstream is ;
is << tmp;
is >> size;
5.InvalidateRect(hWnd,0,1);
6.DialogBox(hInst, MAKEINTRESOURCE(IDD_DIALOG1), hWnd, inputsize);
7.WM_CLOSE is sent before WM_DESTYOY.
//
创建全屏(空白)模式窗口:
if ( ! (hWnd = CreateWindowEx(NULL, // extend style
WINDOW_CLASS_NAME, // class
" BX " , // title
WS_POP | WS_VISIBLE,
0 , 0 , // initial x,y
GetSystemMetrics(SM_CXSCREEN), // Initial width
GetSystemMetrics(SM_CYSCREEN), // Initial height
NULL, // handle to parent
NULL, // handle to menu
hinstance, // instance of this application
NULL))) // extra creation parms
return ( 0 );
if ( ! (hWnd = CreateWindowEx(NULL, // extend style
WINDOW_CLASS_NAME, // class
" BX " , // title
WS_POP | WS_VISIBLE,
0 , 0 , // initial x,y
GetSystemMetrics(SM_CXSCREEN), // Initial width
GetSystemMetrics(SM_CYSCREEN), // Initial height
NULL, // handle to parent
NULL, // handle to menu
hinstance, // instance of this application
NULL))) // extra creation parms
return ( 0 );