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