Jump to content
Sign in to follow this  
Andreik

How can I do this effect

Recommended Posts

Andreik

How can I do this effect in background of application?

Edited by Andreik

When the words fail... music speaks

Share this post


Link to post
Share on other sites
Malkey

How can I do this effect in background of application?

This is a start. Hope it helps.

#include <GUIConstants.au3>
#include <WindowsConstants.au3>
#include <WINAPI.au3>
;http://www.autoitscript.com/forum/index.php?s=&showtopic=74768&view=findpost&p=543233
Global Const $WM_LBUTTONDOWN = 0x0201 ; Drag Window 1 of 3 addin
Local $iWidth = @DesktopWidth/2, $iHeight = @DesktopHeight/2

;---------------------------------------
$hGui = GUICreate("BG", @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUPWINDOW )
GUISetBkColor(0x000000)
WinSetTrans($hGui, "", 180)

GUIRegisterMsg($WM_LBUTTONDOWN, "_WinMove") ; Drag Window 2 of 3 addin
GUISetState()

;---------------------------------------
$gui = GUICreate("Control Gui", $iWidth , $iHeight, -1, -1,-1, $WS_EX_TOPMOST) ;, $WS_POPUPWINDOW, BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD), $hGui)
GUICtrlCreateLabel( @CRLF & " Press Esc to Exit", 10, 10, 200, 50)
$but = GUICtrlCreateButton("Button", ($iWidth - 120 - 5) / 2, ($iHeight - 23 - 4) / 2, 120, 23)
GUICtrlSetBkColor(-1, 0xFFFF00)
GUISetBkColor(0xABCDEF)

_WinAPI_SetLayeredWindowAttributes($gui, 0xABCDEF)

GUISetState()
;---------------------------------------

Do
    $msg = GUIGetMsg()
    If $msg = $but Then MsgBox(0, "", "Button Pressed",0,$gui)
Until $msg = $GUI_EVENT_CLOSE

; From http://www.autoitscript.com/forum/index.ph...st&p=541838
Func _WinAPI_SetLayeredWindowAttributes($hwnd, $i_transcolor, $Transparency = 255, $dwFlages = 0x03, $isColorRef = False)
    If $dwFlages = Default Or $dwFlages = "" Or $dwFlages < 0 Then $dwFlages = 0x03

    If Not $isColorRef Then
        $i_transcolor = Hex(String($i_transcolor), 6)
        $i_transcolor = Execute('0x00' & StringMid($i_transcolor, 5, 2) & StringMid($i_transcolor, 3, 2) & StringMid($i_transcolor, 1, 2))
    EndIf
    Local $Ret = DllCall("user32.dll", "int", "SetLayeredWindowAttributes", "hwnd", $hwnd, "long", $i_transcolor, "byte", $Transparency, "long", $dwFlages)
    Select
        Case @error
            Return SetError(@error, 0, 0)
        Case $Ret[0] = 0
            Return SetError(4, _WinAPI_GetLastError(), 0)
        Case Else
            Return 1
    EndSelect
EndFunc   ;==>_WinAPI_SetLayeredWindowAttributes

; =================================================================
; Drag Window 3 of 3 addin
; =================================================================
Func _WinMove($hwnd, $Command, $wParam, $lParam)
    If BitAND(WinGetState($hwnd), 32) Then Return $GUI_RUNDEFMSG   
    ;DllCall("user32.dll", "long", "SendMessage", "hwnd", $HWnd, "int", $WM_SYSCOMMAND, "int", 0xF009, "int", 0)
    If $hwnd = $gui Then DllCall("user32.dll", "int", "SendMessage", "hWnd", $hwnd, "int", $WM_NCLBUTTONDOWN, "int", $HTCAPTION, "int", 0)   
    Return
EndFunc   ;==>_WinMove

Share this post


Link to post
Share on other sites
Andreik

Is necessary two GUI? Anyway is ok, I like your example. Thanks.


When the words fail... music speaks

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  

×