Jump to content

input transperant


marcelvn
 Share

Recommended Posts

the only way i can get an input transparent is making a .bmp as a background... or a child GUI and then make the parent invisible with the intput on top

Link to comment
Share on other sites

Transparent see through the GUI or Transparent same background as GUI

Here are two examples

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <WINAPI.au3>
#include <sendmessage.au3>

;Global Const $LWA_ALPHA = 0x2
;Global Const $LWA_COLORKEY = 0x1

HotKeySet("ESC", "_Exit")

$hGUI = GUICreate("Test", 500, 500, -1, -1, $WS_POPUP)


GUICtrlCreateInput("", 10, 10,200,50)
GUIctrlSetBkColor(-1,0xD4D0C8)

GUISetState()

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $GUI_EVENT_PRIMARYDOWN
            _SendMessage($hGUI, $WM_SYSCOMMAND, 0xF012, 0)
    EndSwitch

WEnd

Func _Exit()
    Exit
EndFunc
Link to comment
Share on other sites

same background as GUI but the background of my gui is a image her is a part of my script:

GUICtrlCreatePic("wm/plaatjes/ach.bmp",1,1,600,400)
 GuiCtrlSetState(-1,$GUI_DISABLE)
You can do it by having another window to hold the input. You need to have some way to keep the extra window in place, which I have done, and it is difficult to select the input. In this example you have to click on the input outline or a letter in the input if there is one. But you could do it by detecting the left mouse button click and working out if it is inside the input and then setting the focus to the input with ControlFocus.

#include <windowsconstants.au3>
#include <winapi.au3>


$Gui = GUICreate("My GUI picture", 350, 300, 200, 200, $WS_SIZEBOX + $WS_SYSMENU); will create a dialog box that when displayed is centered

GUISetBkColor(0xE0FFFF)
$n = GUICtrlCreatePic(@SystemDir & "\oobe\images\mslogo.jpg", 50, 50, 200, 50)

GUISetState()

$hB = GUICreate("inputwindow", 200, 25, 240, 270, $WS_POPUP, $WS_EX_LAYERED)
GUICtrlCreateInput("", 0, 0, 200, 25)
GUICtrlSetBkColor(-1, 0xabcdef)
GUICtrlSetFont(-1, 10, 800)
GUISetState()
Sleep(300)
_WinAPI_SetLayeredWindowAttributes($hB, 0xabcdef, 255)
WinSetOnTop($hB, "", 1)
GUIRegisterMsg($WM_MOVE, "moved")
While GUIGetMsg() <> -3
    Sleep(40)
    
WEnd


Func Moved($hWnd, $iMsg, $wParam, $lParam)
    Local $gp
    If $hWnd = $Gui Then
        $gp = WinGetPos($Gui)
        WinMove($hB, "", $gp[0] + 40, $gp[1] + 70)
    EndIf
    
    
EndFunc  ;==>Moved


Func _WinAPI_SetLayeredWindowAttributes($hWnd, $i_transcolor, $Transparency = 255, $dwFlages = 0x03, $isColorRef = False)
;===============================================================================
;
; 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
;
;===============================================================================
    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

If you don't want the inout borders then reduce the size of the $hB window and shift the input up and left so that the window only covers the inside of the input.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
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...