# Visual Basic > Games and Graphics Programming >  [RESOLVED] How to make transparent window ?

## trailerbutton

Hi, I hope you are doing good.
I am working in UnrealEngine and I want to make a transparent background by color, for example black color. I have tryed in two different ways.

1. I get a result like in the picture below.



```
HDC hdc = GetDC(hwnd);
HDC hdc1 = CreateCompatibleDC(hdc);
HBITMAP hBitmap = CreateCompatibleBitmap(hdc, rect.right - rect.left, rect.bottom - rect.top);
HBITMAP hBmpOld = (HBITMAP)SelectObject(hdc, hBitmap);
FillRect(hdc,&rect,CreateSolidBrush(RGB(0,0,0)));
SelectObject ( hdc, hBitmap );
TransparentBlt(hdc, 0, 0, rect.right - rect.left, rect.bottom - rect.top, hdc1, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, 0x00000000);
const MARGINS margins{ -1 };
DwmExtendFrameIntoClientArea(hwnd, &margins);
LONG nExStyle = GetWindowLong(hwnd, GWL_EXSTYLE);
SetWindowLong(hwnd, GWL_EXSTYLE, nExStyle | WS_EX_LAYERED);
SetLayeredWindowAttributes( hwnd, 0x00000000, FMath::TruncToInt( 0.2 255.0f ), LWA_ALPHA );
or
//SetLayeredWindowAttributes( hwnd, 0x00000000, FMath::TruncToInt( 0.2 255.0f ), LWA_COLORKEY );
```



2. I get a full transparent window

TransparentBlt(hdc, 0, 0, rect.right - rect.left, rect.bottom - rect.top, hdc1, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, 0x00000000);
 if (hdc)
 {
     HGDIOBJ hPrevObj = 0;
     POINT ptDest = {rect.left, rect.top};
     POINT ptSrc = {0, 0};
     SIZE client = {rect.right - rect.left, rect.bottom - rect.top};
     BLENDFUNCTION blendFunc = {AC_SRC_OVER, 0, 255, AC_SRC_ALPHA};
     UpdateLayeredWindow(hwnd, hdc1, &ptDest, &client, hdc, &ptSrc, RGB(0, 0, 0), &blendFunc, ULW_COLORKEY);
     //AlphaBlend(hdc, 0, 0, rect.right - rect.left, rect.bottom - rect.top, hdc1, 0, 0, rect.right - rect.left, rect.bottom - rect.top, blendFunc);
     SelectObject(hdc, hBmpOld);
     DeleteObject(hBitmap);
     DeleteDC(hdc);
     ReleaseDC(NULL, hdc1);
 }

----------


## trailerbutton

So the problem I was facing had nothing to do with alpha-blending, after so many days I have managed to find the solution. I had to change from directx to ES3.1

----------


## Ooops558

Hey did you implement this in the windowswindow.cpp or create a new blank class of the engine?

----------


## PokaLoka

Hey could guide a bit on where and which file we have to make such edits? I have some sort or ui made in unreal and wants it to be transparent overlay. Please guide on how and where such edits we need to make.
Replies are highly appreciated!!

----------

