투명 다이얼로그 만들기

Category:
Author: zemna
Date: April 17, 2021
Share this:

투명 다이얼로그 만들기

다이얼로그의 OnInitDialog() 함수에서 다음과 같이 코딩한다 .

Visual C++ 6.0 일 경우

Window 2000 이상에서 지원되는 기능으로 Layered Window 특성을 이용해야한다 . VC++ 6.0 에서는 지원되지 않으므로 함수가 있는 USER32.DLL 에서 함수를 직접호출하여야 한다 .

#define WS_EX_LAYERED 0x00080000

#define LWA_ALPHA 0x00000002

typedef BOOL(WINAPI *SLWA)(HWND, COLORREF, BYTE, DWORD);

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*10)/100,LWA_ALPHA);

Visual C++.NET 의 경우

SetWindowLong(m_hWnd, GWL_EXSTYLE, GetWindowLong(m_hWnd, GWL_EXSTYLE) | WS_EX_LAYERED);

::SetLayeredWindowAttributes(m_hWnd, 0, (255*10)/100, LWA_ALPHA);

Share this:

Leave a Reply

Your email address will not be published. Required fields are marked *

Let's connect and create
something awesome together!
2023 - Copyright, All Rights Reserved, Made by ZEMNA.NET with ❤️
crossmenu linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram