Jump to content
Sign in to follow this  
azhuang

Why $WS_EX_LAYERED does not work?

Recommended Posts

azhuang
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

 

Share this post


Link to post
Share on other sites
UEZ

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!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites
azhuang

Thanks UEZ, I don't know why need we to disable DWM? There is a windows tool "magnifier" can capture the background no need to disable it.

Share this post


Link to post
Share on other sites
PhoenixXL

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.

Share this post


Link to post
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
Sign in to follow this  

×