|
// GlassDialog.cpp
//
#include "stdafx.h"
#include "GlassTest.h"
#include "GlassDialog.h"
#include ".\glassdialog.h"
IMPLEMENT_DYNAMIC(CGlassDialog, CDialog)
CGlassDialog::CGlassDialog(UINT nDlgID, CWnd* pParent)
: m_nInterval(10), m_nStepUnit(1), m_nGlass(0), CDialog(nDlgID, pParent)
{
}
CGlassDialog::~CGlassDialog()
{
}
void CGlassDialog::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
}
BEGIN_MESSAGE_MAP(CGlassDialog, CDialog)
//{{AFX_MSG_MAP(CGlassDialog)
ON_WM_CREATE()
ON_WM_TIMER()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
void CGlassDialog::OnTimer(UINT nIDEvent)
{
MakeGlass();
CDialog::OnTimer(nIDEvent);
}
void CGlassDialog::MakeGlass(void)
{
SLWA pSetLayeredWindowAttributes = NULL;
HINSTANCE hmodUSER32 = LoadLibrary("USER32.DLL");
pSetLayeredWindowAttributes = (SLWA)GetProcAddress(hmodUSER32,"SetLayeredWindowAttributes");
SetWindowLong(m_hWnd, GWL_EXSTYLE,GetWindowLong(m_hWnd, GWL_EXSTYLE) | WS_EX_LAYERED);
pSetLayeredWindowAttributes(m_hWnd, 0, (255 * m_nGlass) / 100, LWA_ALPHA);
(m_nGlass >= 70) ? ReleaseTimer() : m_nGlass += m_nStepUnit;
}
void CGlassDialog::ReleaseTimer(void)
{
KillTimer (IDT_TIMER);
}
int CGlassDialog::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
SetTimer(IDT_TIMER, m_nInterval , NULL);
if (CDialog::OnCreate(lpCreateStruct) == -1)
return -1;
MakeGlass();
GdiFlush();
Sleep(10);
return 0;
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.