How to make the Win32 APP Background Transparent?

How to make the Win32 APP Background Transparent?

By : pedracca
Date : October 22 2020, 11:12 AM
it helps some times Give it the WS_EX_TRANSPARENT extended window style, and handle WM_ERASEBKGND message by doing nothing.
This will make the transparent parts of your window transparent to mouse messages also, if you don't want that, then handle the WM_NCHITTEST message and return HTCLIENT rather than HTTRANSPARENT.
code :

Share : facebook icon twitter icon
How to make a movie with transparent background in a flash with transparent background

How to make a movie with transparent background in a flash with transparent background

By : Ra Odan
Date : March 29 2020, 07:55 AM
will help you I'm not sure what you're asking but it looks like the lady on the linked site is just a alpha channel flv (very much like this.) That's accomplished in the encoding process for the video and not in actionscript...are you looking for a programmatic way to do that?
Setting transparent background Win32

Setting transparent background Win32

By : user3089917
Date : March 29 2020, 07:55 AM
This might help you There are two basic ways to achieve "transparent" child controls on Windows:
Draw / print text with transparent background in c++ win32

Draw / print text with transparent background in c++ win32

By : R4ndDm
Date : March 29 2020, 07:55 AM
I wish this helpful for you I am trying to draw/print a text, but i need a transparent background. I have been trying this:
code :
SetBkMode( hdc, TRANSPARENT );
C++ Win32 Static Control Transparent Background

C++ Win32 Static Control Transparent Background

By : Chandrakant Kumar
Date : March 29 2020, 07:55 AM
help you fix your problem No need to do Owner Draw, you can just use SetWindowText() and handle the WM_CTLCOLORSTATIC message, see the code in this SO Answer <-- this will not work if the window has a pattern background, we need to subclass the static control and use the transparent background mode while drawing the text:
code :
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{   MSG msg;

    hInst = hInstance;
    w.style = CS_HREDRAW | CS_VREDRAW;
    w.lpfnWndProc = WndProc;
    w.hInstance = hInst;
    w.hbrBackground = CreateHatchBrush(HS_DIAGCROSS, RGB(255, 0, 0));
    w.lpszClassName = L"My Class";
    w.hCursor = LoadCursor(NULL, IDC_ARROW); 

    HWND hWndWindow = CreateWindow(L"My Class", L"My title", WS_OVERLAPPEDWINDOW, 300, 200, 800, 600, NULL, NULL, hInst, NULL);

    ShowWindow(hWndWindow, nCmdShow);

    while(GetMessage(&msg, NULL, 0, 0))
    {   TranslateMessage(&msg);


    return msg.wParam;

WNDPROC StaticWndProc = NULL;
TCHAR szText[] = _T("TestString");

LRESULT CALLBACK MyStaticWndProc(HWND hwnd, UINT Message, WPARAM wparam, LPARAM lparam)
{   if (Message == WM_PAINT)
    {   RECT rc;
        PAINTSTRUCT ps;
        HDC hdc = BeginPaint(hwnd, &ps);
        GetClientRect(hwnd, &rc);
        SetBkMode(hdc, TRANSPARENT);
        DrawText(hdc, szText, _tcslen(szText), &rc, DT_CENTER | DT_VCENTER);
        EndPaint(hwnd, &ps);
        return 0;

      //v2 StaticWndProc(hwnd, Message, wparam, lparam);
    return return CallWindowProc(StaticWndProc, hwnd, Message, wparam, lparam); //v2

HWND hWndStatic; //v2
LONG WINAPI WndProc(HWND hwnd, UINT Message, WPARAM wparam, LPARAM lparam)
{   switch (Message)
    {   case WM_CREATE:
        {   LRESULT lRes = DefWindowProc(hwnd, Message, wparam, lparam);
            hWndStatic = CreateWindowEx(0, L"Static", NULL, WS_CHILD| WS_VISIBLE |SS_LEFT, 10, 130, 200, 40, hwnd, NULL, hInst, NULL); //v2 deleted HWND
            StaticWndProc = (WNDPROC) SetWindowLong(hWndStatic, GWL_WNDPROC, (LPARAM)MyStaticWndProc);
            return lRes;

        case WM_DESTROY: 
            SetWindowLong(hWndStatic, GWL_WNDPROC, (LPARAM)StaticWndProc); //v2

            return DefWindowProc(hwnd, Message, wparam, lparam);

    return 0;
win32 menu item bitmap with transparent background

win32 menu item bitmap with transparent background

By : user3677656
Date : March 29 2020, 07:55 AM
Hope this helps Alpha transparency in Windows' GDI is a minefield. It was added very late, and only a handful of API calls are truly capable of handling a dedicated alpha channel. LoadBitmap is not one of those that support (or at least do not break) alpha transparency. The alpha channel gets lost when you're loading the image from the application's resources.
To fix that, you'll have to use LoadImage, passing in the correct flags. LR_CREATEDIBSECTION is the important one, as that preserves the alpha channel in the source bitmap.
code :
                   IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION)
Related Posts Related Posts :
  • `LoadLibraryExW` triggers exception `0xC0000023` from `NtMapViewOfSection`
  • static_cast to a struct type to access all of its member variable
  • Forward declaration for boost::intrusive_ptr class to reduce compile time
  • How to use priority_queue with a non-static compare method of class instance?
  • Template parameters inside and outside class/struct
  • Determining prime number
  • How to resolve ambiguity between constructors taking std::string and std::vector
  • My program crashes when I try to change private values from an object
  • Unordered_map with custom class as key
  • Strict aliasing rules broken with templates and inheritance
  • C++ Derived Class Override Return Type
  • singly linked list c++ constructor, destructor and printing out
  • How to clone class with vector of unique_ptr to base class
  • error: no match for operator
  • std::vector doesnt accept my struct as template
  • selection of people's contours
  • how to fix the (Error using mexOpenCV) on matlab?
  • Is or was there a proposal for c++ to use the context for short enum values?
  • Fair assumptions about std::hash implementations
  • undefined reference to libusb using cyusb
  • Function returns null pointer instead of address
  • C++17 copy elision and object destruction
  • Input multiple strings via operator>> c++
  • Avoiding overflow boost container
  • How to Write a Lambda Wrapping a Function with Optional Return Value
  • Partial specialization with more template parameters
  • How to convert fixed size array to pointer on pointer array
  • Memory leak in const member constructor with tag dispatching
  • C++ function with a generic and optional class
  • Custom QGraphicsItem That Contains Child QGraphicsItems
  • Are There Restrictions on What can be Passed to auto Template Parameters?
  • Rotating line inside rectangle bounds
  • Why do I need dynamic memory allocation if I can just create an array?
  • How can I convert a text file into a form that MPI_Bcast can send?
  • How to get array of all `this` of an instance
  • Using pointers as parameters
  • Automatic type deduction with const_cast is not working
  • Why does std::is_rvalue_reference not do what it is advertised to do?
  • Function Template Specialization with Forward Declared Type
  • template deduction failed in vector
  • Is there a signed `sizeof` alternative in Qt
  • clarification on overloading the -> operator
  • What is __m128d?
  • QtConcurrent: why releaseThread and reserveThread cause deadlock?
  • Function receiving different value than passed
  • Can C++ close a '''fstream''' variable after '''.close()'''?
  • Is it necessary to overload operator in this specific case
  • Comparing an element of a string array with a string
  • how to dereference a pointer of a map of pointers to objects in c++
  • How recursive function control flow change for static variable?
  • SDL 2 blitting BMP File
  • Why does an extremely large value cause this code to repeat infinitely?
  • Function returning different value than what is in function body before return statement
  • Struggling with including Headers in another header file (C++)
  • WebViewProcessControl initialization crash
  • C++ exception 0xC00000FD: Stack overflow (parameters: 0x00000001, 0x00C02F30)
  • What's difference between forward and move in the constructor of class?
  • C++: Is it possible to condense `bool` objects within the same byte?
  • I cant understand this access modifier
  • Boost Spirit X3: Collapsing one-element lists
  • shadow
    Privacy Policy - Terms - Contact Us © bighow.org