1.获取与释放DC的相关函数:
函数定义在gdi.h文件中。
MG_EXPORT HDC GUIAPI GetDC (HWND hwnd); //gets a window DC of the specified \a hwnd, and returns the handle to the DC. MiniGUI will try to return an unused DC from the internal DC pool, rather than allocate a new one from the system heap
MG_EXPORT HDC GUIAPI GetClientDC (HWND hwnd);//gets a client DC of the specified \a hwnd, and returns the handle to the DC. MiniGUI will try to return an unused DC from the internal DC pool, rather than allocate a new one from the system heap
MG_EXPORT void GUIAPI ReleaseDC (HDC hdc);//Releases a DC from DC pool
注意:GetDC 是获得window的DC,即整个Screen的DC,而GetClientDC是获得客户区域的DC。例如执行如下代码:
case MSG_MOUSEMOVE:
{
int x = LOWORD (lParam);
int y = HIWORD (lParam);