Windows/MFC

Fade window

aucd29 2013. 10. 2. 18:17
http://www.devpia.com/MAEUL/Contents/Detail.aspx?BoardID=50&MAEULNO=20&no=676264&ref=676264&page=10
void CUltra_mobile_pcDlg::SetTransparency(int percent)
{
    SLWA pSetLayeredWindowAttributes = NULL; // 함수포인터 선언, 초기화.
    HINSTANCE hmodUSER32 = LoadLibrary("USER32.DLL"); // 인스턴스 얻음.
    pSetLayeredWindowAttributes=(SLWA)GetProcAddress(hmodUSER32,"SetLayeredWindowAttributes");

    // 함수포인터 얻음.
    HWND hwnd = this->m_hWnd; //다이얼로그의 핸들 얻음.
    SetWindowLong(hwnd, GWL_EXSTYLE,GetWindowLong(hwnd, GWL_EXSTYLE) | WS_EX_LAYERED);
    pSetLayeredWindowAttributes(hwnd, 0, (255 * percent) / 100, LWA_ALPHA);
}