vc mfc实现dialog半透明置顶效果

来源:互联网 发布:河北网络公益广告大赛 编辑:程序博客网 时间:2024/05/01 04:52
vc mfc实现dialog半透明置顶效果
通过修改GWL_EXSTYLE和GWL_STYLE实现半透明

SetWindowPos设置对话框置顶

    LONG i1 = ::GetWindowLong(this->m_hWnd, GWL_EXSTYLE);
    LONG i2 = ::GetWindowLong(this->m_hWnd, GWL_STYLE);
    i1 |= WS_EX_LAYERED;
    i1 |= WS_EX_TOPMOST;
    SetWindowLong(this->m_hWnd, GWL_EXSTYLE, i1);
    SetWindowLong(this->m_hWnd, GWL_STYLE, i2);

    ::SetWindowPos(this->m_hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_SHOWWINDOW);
    ::SetLayeredWindowAttributes(this->m_hWnd, 0, 200, LWA_ALPHA);

示例代码下载

http://download.csdn.net/detail/csdddn/5282440

原创粉丝点击