Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Transparent Dialog but not control..

Transparent Dialog but not control..

Scheduled Pinned Locked Moved C / C++ / MFC
helptutorialquestion
8 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    gothic_coder
    wrote on last edited by
    #1

    Hello all.. I don't know how to achieve this but i guess that's possible.. I've one dialog box and a picture control on it. I'm using CxImage Class to load and display PNG on that picture box.. Till now everything is good.. Now i've to show that PNG in a way so that it look like it's drawn on desktop screen. So for that i make my dialog transparent.. But making dialog transparent makes my picture control transparent. So no PNG is being shown. How do i overcome this problem...Or is there any way in CxImage Class to show PNG directly on desktop screen by taking DC of desktop screen.. Here is code to make dialog transparent..

    SetWindowLong(hWnd,GWL_EXSTYLE,GetWindowLong(hWnd,GWL_EXSTYLE)^WS_EX_LAYERED);
    SetLayeredWindowAttributes(hWnd,RGB(0,0,0),0,LWA_ALPHA);

    Thanks all...

    A H 2 Replies Last reply
    0
    • G gothic_coder

      Hello all.. I don't know how to achieve this but i guess that's possible.. I've one dialog box and a picture control on it. I'm using CxImage Class to load and display PNG on that picture box.. Till now everything is good.. Now i've to show that PNG in a way so that it look like it's drawn on desktop screen. So for that i make my dialog transparent.. But making dialog transparent makes my picture control transparent. So no PNG is being shown. How do i overcome this problem...Or is there any way in CxImage Class to show PNG directly on desktop screen by taking DC of desktop screen.. Here is code to make dialog transparent..

      SetWindowLong(hWnd,GWL_EXSTYLE,GetWindowLong(hWnd,GWL_EXSTYLE)^WS_EX_LAYERED);
      SetLayeredWindowAttributes(hWnd,RGB(0,0,0),0,LWA_ALPHA);

      Thanks all...

      A Offline
      A Offline
      AtomAnt
      wrote on last edited by
      #2

      Look into "UpdateLayeredWindow" if you want to use per-pixel blending.

      AtomAnt

      1 Reply Last reply
      0
      • G gothic_coder

        Hello all.. I don't know how to achieve this but i guess that's possible.. I've one dialog box and a picture control on it. I'm using CxImage Class to load and display PNG on that picture box.. Till now everything is good.. Now i've to show that PNG in a way so that it look like it's drawn on desktop screen. So for that i make my dialog transparent.. But making dialog transparent makes my picture control transparent. So no PNG is being shown. How do i overcome this problem...Or is there any way in CxImage Class to show PNG directly on desktop screen by taking DC of desktop screen.. Here is code to make dialog transparent..

        SetWindowLong(hWnd,GWL_EXSTYLE,GetWindowLong(hWnd,GWL_EXSTYLE)^WS_EX_LAYERED);
        SetLayeredWindowAttributes(hWnd,RGB(0,0,0),0,LWA_ALPHA);

        Thanks all...

        H Offline
        H Offline
        Hamid Taebi
        wrote on last edited by
        #3

        I think I told you yesterday did you see GetDesktopWindow?

        G 1 Reply Last reply
        0
        • H Hamid Taebi

          I think I told you yesterday did you see GetDesktopWindow?

          G Offline
          G Offline
          gothic_coder
          wrote on last edited by
          #4

          Yes i did.. And that'll be great if i show my PNG on desktop rather than dialog box.. I did something like this..

          BeginPaint (hWnd, &ps) ;

          HWND hDesktop = GetDesktopWindow();

          HDC hdc = GetDC(hDesktop);

          CxImage image("E:\\My_Prog\\FINAL_PNG\\Res\\Test.png", CXIMAGE_FORMAT_PNG);
          BOOL iReturn = image.Draw(hdc, 50, 50);

          EndPaint (hWnd, &ps) ;

          I get the handle of desktop and DC also.. But it didn't draw the PNG. What am i doing wrong?

          H 1 Reply Last reply
          0
          • G gothic_coder

            Yes i did.. And that'll be great if i show my PNG on desktop rather than dialog box.. I did something like this..

            BeginPaint (hWnd, &ps) ;

            HWND hDesktop = GetDesktopWindow();

            HDC hdc = GetDC(hDesktop);

            CxImage image("E:\\My_Prog\\FINAL_PNG\\Res\\Test.png", CXIMAGE_FORMAT_PNG);
            BOOL iReturn = image.Draw(hdc, 50, 50);

            EndPaint (hWnd, &ps) ;

            I get the handle of desktop and DC also.. But it didn't draw the PNG. What am i doing wrong?

            H Offline
            H Offline
            Hamid Taebi
            wrote on last edited by
            #5

            Its working for me of course like this: HWND hDesktop = ::GetDesktopWindow(); HDC hdc = ::GetDC(hDesktop); CImage image; image.Load("f:\\1.png"); BOOL iReturn = image.BitBlt(hdc, 50, 50);

            G 1 Reply Last reply
            0
            • H Hamid Taebi

              Its working for me of course like this: HWND hDesktop = ::GetDesktopWindow(); HDC hdc = ::GetDC(hDesktop); CImage image; image.Load("f:\\1.png"); BOOL iReturn = image.BitBlt(hdc, 50, 50);

              G Offline
              G Offline
              gothic_coder
              wrote on last edited by
              #6

              Ok so you're using BitBlt.. But when i use image.BilBlt it says. "error C2039: 'BitBlt' : is not a member of 'CxImage'" Obviously there's no member called BitBlt in CxImage Class.. So do i need to use CImage??? Does BitBlt comes under Cimage??? Or can i use BitBlt on CxImage??

              H 1 Reply Last reply
              0
              • G gothic_coder

                Ok so you're using BitBlt.. But when i use image.BilBlt it says. "error C2039: 'BitBlt' : is not a member of 'CxImage'" Obviously there's no member called BitBlt in CxImage Class.. So do i need to use CImage??? Does BitBlt comes under Cimage??? Or can i use BitBlt on CxImage??

                H Offline
                H Offline
                Hamid Taebi
                wrote on last edited by
                #7

                Yeah because I use of CImage class not CXImage article.

                G 1 Reply Last reply
                0
                • H Hamid Taebi

                  Yeah because I use of CImage class not CXImage article.

                  G Offline
                  G Offline
                  gothic_coder
                  wrote on last edited by
                  #8

                  Alright.. Anyways i manage to Draw the PNG on desktop screen.. But the problem is that it get erases whenever any window is dragged on it.. Is there any way to refresh it???

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups