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);

    }

  • 相关阅读:
    0_ReviewML-1
    1_Convolution(卷积)
    0_overview
    遗传算法
    使用多线程下载文件思路
    大文件断点下载
    输出流
    大文件的下载
    XML解析
    文件下载
  • 原文地址:https://www.cnblogs.com/thbCode/p/4200256.html
Copyright © 2011-2022 走看看