以下这段代码可以用于对话框的淡入
你试一试。
///////////////////////
typedef BOOL (FAR PASCAL * FUNC1)(
  HWND hwnd,           // handle to the layered window
  COLORREF crKey,      // specifies the color key
  BYTE bAlpha,         // value for the blend function
  DWORD dwFlags        // action
);
//////////////////////////
//以下在OnTimer()里运行
HMODULE hModule = GetModuleHandle("user32.dll");
FUNC1 SetLayeredWindowAttributes;
SetLayeredWindowAttributes =  (FUNC1) GetProcAddress (hModule, _T( "SetLayeredWindowAttributes" ) );
// 设置分层扩展标记
SetWindowLong(GetSafeHwnd(), GWL_EXSTYLE, GetWindowLong(GetSafeHwnd(), GWL_EXSTYLE) | 0x80000L);
//颜色深度随时间增长或降低
SetLayeredWindowAttributes(GetSafeHwnd(), 0, (255 * i) / 100, 0x2);
////////////////////////////////