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;
}
posted @ 2014-07-21 15:55  oszhouzhb  阅读(256)  评论(0编辑  收藏  举报