int m_xScreen = GetSystemMetrics(SM_CXSCREEN)
int m_yScreen = GetSystemMetrics(SM_CYSCREEN)
SetWindowLong(GetSafeHwnd(),GWL_EXSTYLE,WS_EX_TOOLWINDOW)SetLayeredWindow(m_hWnd,80)SetWindowPos(&CWnd::wndTopMost,0,0,m_xScreen,m_yScreen,SWP_SHOWWINDOW)SetForegroundWindow()
实现透明函数
void SetLayeredWindow(HWND m_hWnd,int nRate)
{HINSTANCE hInstif ((hInst = LoadLibrary(_T("USER32.dll"))) != NULL)
{
SetWindowLong(m_hWnd, GWL_EXSTYLE, GetWindowLong(m_hWnd, GWL_EXSTYLE) | WS_EX_LAYERED)typedef BOOL (WINAPI* lpfnSetTransparent)(HWND hWnd, COLORREF crKey, BYTE bAlpha, DWORD dwFlags)if (hInst){lpfnSetTransparent pFnSetTransparent = NULLpFnSetTransparent= (lpfnSetTransparent)GetProcAddress(hInst, "SetLayeredWindowAttributes")if (pFnSetTransparent)pFnSetTransparent(m_hWnd, 0, (255 * nRate) / 100, LWA_ALPHA)}
}
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)