一个初始化实例的问题 - C++ Builder / Windows SDK/API
void CALLBACK PlayDrawFun(long nPort,HDC hDc,LONG nUser) { CPlayer264demoDlg* pDlg = (CPlayer264demoDlg*)nUser; pDlg->m_VideoWndDC = hDc; if (!pDlg->m_bLButtonDown) return ; if ((pDlg->m_StartPoint.x == pDlg->m_EndPoint.x) && (pDlg->m_StartPoint.y == pDlg->m_EndPoint.y)) return ; SelectObject(hDc, CreatePen(PS_SOLID, 2, RGB(255,0,0))); MoveToEx(pDlg->m_VideoWndDC, pDlg->m_StartPoint.x, pDlg->m_StartPoint.y, 0); LineTo(pDlg->m_VideoWndDC, pDlg->m_EndPoint.x, pDlg->m_StartPoint.y); LineTo(pDlg->m_VideoWndDC, pDlg->m_EndPoint.x, pDlg->m_EndPoint.y); MoveToEx(pDlg->m_VideoWndDC, pDlg->m_StartPoint.x, pDlg->m_StartPoint.y, 0); LineTo(pDlg->m_VideoWndDC, pDlg->m_StartPoint.x, pDlg->m_EndPoint.y); LineTo(pDlg->m_VideoWndDC, pDlg->m_EndPoint.x, pDlg->m_EndPoint.y); DeleteObject(SelectObject(hDc, GetStockObject(BLACK_PEN))); DeleteObject(SelectObject(hDc, GetStockObject(WHITE_BRUSH)));}
CPlayer264demoDlg* pDlg = (CPlayer264demoDlg*)nUser;