zoukankan      html  css  js  c++  java
  • 关于非对话框的透明窗口

    #include "StdAfx.h"

    #include "TransWnd.h"

    CTransWnd::CTransWnd(void)

    {  

    const TCHAR szClassName[] = TEXT ("TransWindow") ;    

    WNDCLASS wndclass ;  

    wndclass.style = CS_HREDRAW | CS_VREDRAW ;  

    wndclass.lpfnWndProc = DefWindowProc ;  

    wndclass.cbClsExtra = 0 ;  

    wndclass.cbWndExtra = 0 ;  

    wndclass.hInstance = ::AfxGetInstanceHandle() ;  

    wndclass.hIcon = LoadIcon (NULL, IDI_APPLICATION) ;  

    wndclass.hCursor = LoadCursor (NULL, IDC_ARROW) ;  

    wndclass.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH) ;

     wndclass.lpszMenuName = NULL ;  wndclass.lpszClassName = szClassName ;

     if(!RegisterClass (&wndclass))  

     AfxMessageBox(L"REGISTRE 'TransWindow' CLASS ERROR!");

    }

    CTransWnd::~CTransWnd(void)

    {  

    ::DestroyWindow(m_hwnd);

    }

    void CTransWnd::Create(CRect rc, HWND hParentHwnd)

    {  

    ::DestroyWindow(m_hwnd);  

    m_hwnd = ::CreateWindowEx(      

    WS_EX_LAYERED,      

    TEXT ("TransWindow"), // wndow class name      

    NULL, // window caption      

    WS_POPUP | WS_CHILD, // window style     

     rc.left, // initial x position     

     rc.top, // initial y position     

     rc.Width(), // initial x size      

    rc.Height(), // initial y size      

    NULL, // parent window handle      

    NULL, // window menu handle      

    ::AfxGetInstanceHandle(), // program instance handle     

     NULL) ; // creation parameters

     SetLayeredWindowAttributes(   m_hwnd,   RGB(0,0,0),   100, LWA_ALPHA   );

     ShowWindow(m_hwnd, SW_SHOW);

    }

  • 相关阅读:
    vue组件重新加载的方法
    事件触发方法获取当前值的写法 (含方法要传2个参数的写法)
    mac 解压 rar压缩文件
    表格
    小米8安装charles证书方法
    视频结构化技术栈全解析
    多目标跟踪全解析,全网最全
    SpringBoot
    技术方案设计的方法
    Java的强引用、软引用、弱引用、虚引用
  • 原文地址:https://www.cnblogs.com/thbCode/p/4200256.html
Copyright © 2011-2022 走看看