首页 > 代码库 > DrawWindowFrame

DrawWindowFrame

extern void DrawWindowFrame(HWND hWnd)//画窗口边框{    RECT rc;    HWND DeskHwnd = ::GetDesktopWindow(); //取得桌面句柄    HDC DeskDC = ::GetWindowDC(DeskHwnd); //取得桌面设备场景    int oldRop2 = SetROP2(DeskDC, R2_NOTXORPEN);    ::GetWindowRect(hWnd, &rc); //获得窗口矩形    if( rc.left < 0 ) rc.left = 0;    if (rc.top < 0 ) rc.top = 0;    HPEN newPen = ::CreatePen(0, 3, RGB(125,0,125));    //建立新画笔,载入DeskDC    HGDIOBJ oldPen = ::SelectObject(DeskDC, newPen);    ::Rectangle(DeskDC, rc.left, rc.top, rc.right, rc.bottom);  //在指示窗口周围显示闪烁矩形    //::Beep(100,100);    Sleep(400);    //设置闪烁时间间隔    ::Rectangle( DeskDC, rc.left, rc.top, rc.right, rc.bottom);    ::SetROP2(DeskDC, oldRop2);    ::SelectObject( DeskDC, oldPen);    ::DeleteObject(newPen);    ::ReleaseDC( DeskHwnd, DeskDC);    DeskDC = NULL;}