Jump to content

Pic control keeps appearing on top of other controls

Recommended Posts

Hello forums,

I already followed what the people on the previous threads about the same topic suggested, i.e., disabling the pic control. It keeps on appearing tho on top of the button unless I hover my mouse over the location of the button.

The problem disappears when I comment out the __SetBitmapAdjust function.

Help please?


#include <ScreenCapture.au3>
Global $hGUI, $hButt
Opt('GUIOnEventMode', 1)

Func Example()
    $hGUI = GUICreate("Example", @DesktopWidth, @DesktopHeight, 0, 0, 0x80000000)

    Local $aArea[4] = [0, 0, @DesktopWidth, @DesktopHeight]
    Local $hPic = GUICtrlCreatePic('', $aArea[0], $aArea[1], $aArea[2], $aArea[3]);$iH)
    _SetBitmapAdjust($hPic, $aArea)
    GUICtrlSetState($hPic, 128)

    $hButt = GUICtrlCreateButton("OK", 100, 100, 100, 100);, -1, 0x00000008)
    GUICtrlSetState($hButt, 256 + 2048)
    GUICtrlSetOnEvent($hButt, "_Exit")

    ; Loop until the user exits.
    While 1
EndFunc   ;==>Example

Func _SetBitmapAdjust(ByRef Const $cID, ByRef Const $Area)
    Local Const $STM_SETIMAGE = 0x0172
    Local Const $STM_GETIMAGE = 0x0173
    If Not IsHWnd($cID) Then
        $hWnd = GUICtrlGetHandle($cID)
        If Not $hWnd Then Return 0
        $hWnd = $cID
    Local Const $aAdjust = StringSplit('10000|10000|10000|0|10000|0|-100|0|0|0|0', '|', 2); _WinAPI_CreateColorAdjustment(0, 0, 65000, 65000, 1000, 0, 50000, 60, 10000)
    Local Const $tAdjust = _WinAPI_CreateColorAdjustment($aAdjust[9], $aAdjust[10], $aAdjust[0], $aAdjust[1], $aAdjust[2], $aAdjust[3], $aAdjust[4], $aAdjust[5], $aAdjust[6], $aAdjust[7], $aAdjust[8])
    Local $hBitmap = _ScreenCapture_Capture("", $Area[0], $Area[1], $Area[2], $area[3], False)
    $hBitmap = _WinAPI_AdjustBitmap($hBitmap, -1, -1, $HALFTONE, $tAdjust)
    If @error Then Return 0
    Local $hPrev = _SendMessage($hWnd, $STM_SETIMAGE, $IMAGE_BITMAP, $hBitmap)
    If $hPrev Then _WinAPI_DeleteObject($hPrev)
    $hPrev = _SendMessage($hWnd, $STM_GETIMAGE)
    If $hPrev <> $hBitmap Then _WinAPI_DeleteObject($hBitmap)
    Return 1
EndFunc   ;==>_SetBitmapAdjust

Func _Exit()
EndFunc   ;==>_Exit


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
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...