Introduction
This is an XP dockbar program like Apple's dockbar. It switches scrolling with a flip animation effect.
Using the code
Step 1. This step inludes loading the library "User32.DLL" for the "UpdateLayeredWindow
" function. This is a per-pixel-alpha transparence. Therefore, we have no more jagged edges.
hFuncInst = LoadLibrary("User32.DLL");
BOOL bRet=FALSE;
if(hFuncInst){
UpdateLayeredWindow=(MYFUNC)GetProcAddress(hFuncInst, "UpdateLayeredWindow");
}
else
{
AfxMessageBox("User32.dll ERROR!");
exit(0);
}
Step 2. Initialize GDI+.
m_Blend.BlendOp=0;
m_Blend.BlendFlags=0;
m_Blend.AlphaFormat=1;
m_Blend.SourceConstantAlpha=255;
Step 3. Now, the DrawTXBar
function.
void DrawTXBar()
{
DWORD dwExStyle=GetWindowLong(m_hWnd,GWL_EXSTYLE);
if((dwExStyle&0x80000)!=0x80000)
SetWindowLong(m_hWnd,GWL_EXSTYLE,dwExStyle^0x80000);
BOOL bRet=FALSE;
bRet= UpdateLayeredWindow( m_hWnd,hdcScreen,&ptWinPos,
&sizeWindow,m_hdcMemory,&ptSrc,0,&m_Blend,2);
...
}
Points of interest
The API function "UpdateLayeredWindow
" must by executed to update the alpha window's image.