#include <GUIConstants.au3>
#include <Windowsconstants.au3>
#include <EditConstants.au3>
#region - GUI Create
Global $Topx = 300, $Topy = 400, $extMsg
Global $Plusx = 15, $Plusy = 70
Global $gui1 = GUICreate('Parent GUI', 500, 500, $Topx, $Topy)
GUISetFont(6)
GUICtrlCreatePic(@ScriptDir & '\1.bmp', 0, 0, 500, 500) ; картинка
GUISetState()
;create layered window so we can have a transparent colour which will be applied to edit background as well as the window
Global $gui2 = GUICreate('child', 400, 450, $Topx + 15, $Topy + 70, $WS_POPUP, BitOR(0x2000000, $WS_EX_LAYERED, $WS_EX_TOPMOST));$WS_EX_COMPOSITED = 0x2000000
$Edit1=GUICtrlCreateEdit('', 0, 0, 400, 450, BitOR($ES_AUTOVSCROLL, $ES_WANTRETURN), 0)
GUICtrlSetBkColor(-1, 0xABCDEF);set background to a special colour
$text = FileRead(@ScriptFullPath)
GUICtrlSetData(-1, $text)
_API_SetLayeredWindowAttributes($gui2, 0xABCDEF, 255);set special colour fully transparent
GUISetState()
GUIRegisterMsg($WM_MOVE, 'Follow')
#endregion - GUI Create
#region - GUI SelectLoop
While 1
$extMsg = GUIGetMsg(1)
$msg = $extMsg[0]
Switch $extMsg[1]
Case $gui1
Select
Case $msg = $GUI_EVENT_CLOSE
Exit
EndSelect
EndSwitch
WEnd
#endregion - GUI SelectLoop
;===============================================================================
;
; Function Name: _API_SetLayeredWindowAttributes
; Description:: Sets Layered Window Attributes:) See MSDN for more informaion
; Parameter(s):
; $hwnd - Handle of GUI to work on
; $i_transcolor - Transparent color
; $Transparency - Set Transparancy of GUI
; $isColorRef - If True, $i_transcolor is a COLORREF-Strucure, else an RGB-Color
; Requirement(s): Layered Windows
; Return Value(s): Success: 1
; Error: 0
; @error: 1 to 3 - Error from DllCall
; @error: 4 - Function did not succeed - use
; _WinAPI_GetLastErrorMessage or _WinAPI_GetLastError to get more information
; Author(s): Prog@ndy
;
;===============================================================================
;
Func _API_SetLayeredWindowAttributes($hwnd, $i_transcolor, $Transparency = 255, $isColorRef = False)
Local Const $AC_SRC_ALPHA = 1
Local Const $ULW_ALPHA = 2
Local Const $LWA_ALPHA = 0x2
Local Const $LWA_COLORKEY = 0x1
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', $LWA_COLORKEY + $LWA_ALPHA)
Select
Case @error
Return SetError(@error, 0, 0)
Case $Ret[0] = 0
Return SetError(4, 0, 0)
Case Else
Return 1
EndSelect
EndFunc ;==>_API_SetLayeredWindowAttributes
Func Follow($hwnd)
Local $wp = WinGetPos($gui1)
If $hwnd = $gui1 Then WinMove($gui2, '', $wp[0] + $Plusx, $wp[1] + $Plusy)
EndFunc ;==>Follow