Jump to content

Why $WS_EX_LAYERED does not work?


azhuang
 Share

Recommended Posts

Hi all,
 
I created a GUI window with $WS_EX_LAYERED style, then used _WinAPI_BltBit API with parameter $SRCCOPY (no $CAPTUREBLT) to copy the desktop to the GUI window. What I want is captured the background which was covered by the GUI window.
 
However, the Bitblt can still captured the GUI window, not the background. How can I do to get the background instead?
 
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Misc.au3>
#include <WinAPIGdi.au3>

Opt("GUIOnEventMode", 1)
Opt("MouseCoordMode", 1)

$ZoomSizeX = 256
$ZoomSizeY = 256

$ZoomGUI = GUICreate("Capture Backgroud", $ZoomSizeX, $ZoomSizeY, 400, 200, BitOR($WS_SIZEBOX,$WS_THICKFRAME, $WS_SYSMENU, $WS_BORDER, $WS_CAPTION), BitOR($WS_EX_LAYERED,  $WS_EX_TOPMOST, $WS_EX_TRANSPARENT) )
_WinAPI_SetLayeredWindowAttributes($ZoomGUI,  0, 255, $LWA_ALPHA)

GUISetState()

Main()

Func Main()
    Local $aMPosNew
    Local $dll = DllOpen("user32.dll")

    Do
        $ZoomDC = _WinAPI_GetDC($ZoomGUI)
        $DeskDC = _WinAPI_GetDC(0)

        $aMPosNew = MouseGetPos()
        _WinAPI_BitBlt($ZoomDC, 0, 0, $ZoomSizeX, $ZoomSizeY, $DeskDC, $aMPosNew[0], $aMPosNew[1],  $SRCCOPY )

        _WinAPI_ReleaseDC(0, $DeskDC)
        _WinAPI_ReleaseDC($ZoomGUI, $ZoomDC)
        Sleep(10)
    Until _IsPressed("1B", $dll); ESC key
EndFunc   ;==>Main

Thanks

 

Link to comment
Share on other sites

Have a look to >Pseudo Aero Look where I copy the desktop background under the GUI to the GUI.

 

 

Br,

UEZ

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

WM_PRINTCLIENT | WM_PRINT  - Might be useful, but its not perfect..!!

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...