유용한 정보
[C++]다이얼로그창 투명하게 만들기
DevReff
2024. 12. 25. 12:35
728x90
728x90
SMALL
반응형
typedef BOOL (WINAPI *SetLayer)(HWND hWnd, COLORREF crKey, BYTE bAlpha, DWORD dwFlags);
#define LWA_COLORKEY 0x01
#define LWA_ALPHA 0x02
우선 위와 같이 새로운 타입과 상수를 정의하고
특정 Function 에 다음과 같이 정의하면 됩니다.
HMODULE hUser32 = GetModuleHandle(_T("USER32.DLL"));
SetLayer pSetLayer = (SetLayer)GetProcAddress( hUser32, "SetLayeredWindowAttributes" );
if( pSetLayer == NULL )
return FALSE;
int alphaValue = 100; //투명도 설정 0 ~ 255 ( 0은 완전투명 )
SetWindowLong( this->m_hWnd, GWL_EXSTYLE, GetWindowLong(this->m_hWnd, GWL_EXSTYLE) | 0x80000 );
pSetLayer( this->m_hWnd, 0, alphaValue, LWA_ALPHA );
투명도는 alphaValue 값을 변경하여 조절할 수 있습니다.
출처: https://use1348.tistory.com/6 [유용한 정보:티스토리]
728x90
728x90
LIST