Jump to content

Making windows transparent


Recommended Posts

I've been trying to make MS Word transparent so I can put images or a movie behind it while I type(I hate stareing at a white screen).

This is what I've come up with but it doesnt work... anyone know why or what I'm doing wrong?

#include <GuiConstants.au3>

GuiCreate("MyGUI", 392, 152,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

$WinName = GUICtrlCreateInput("Window Name", 10, 10, 370, 20)
$Slider_2 = GuiCtrlCreateSlider(10, 50, 370, 25)
;$Label_3 = GuiCtrlCreateLabel("Current transperency", 10, 80, 370, 20)
$Button_4 = GuiCtrlCreateButton("Set", 10, 120, 370, 20)

GuiCtrlSetLimit($Slider_2, 255, 0)

GuiSetState()
While 1
    $slide = GuiCtrlRead($Slider_2)
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $Button_4
        WinSetTrans($WinName,"",$slide)
    Case Else
        ;;;
EndSelect
WEnd
Exit
Link to comment
Share on other sites

I've been trying to make MS Word transparent so I can put images or a movie behind it while I type(I hate stareing at a white screen).

This is what I've come up with but it doesnt work... anyone know why or what I'm doing wrong?

WinSetTrans?
Link to comment
Share on other sites

#include <GuiConstants.au3>
Opt("WinTitleMatchMode", 2) ; Match substring

GuiCreate("MyGUI", 392, 152,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

$WinName = GUICtrlCreateInput("Window Name", 10, 10, 370, 20)
$Slider_2 = GuiCtrlCreateSlider(10, 50, 370, 25)
;$Label_3 = GuiCtrlCreateLabel("Current transperency", 10, 80, 370, 20)
$Button_4 = GuiCtrlCreateButton("Set", 10, 120, 370, 20)

GuiCtrlSetLimit($Slider_2, 255, 0)

GuiSetState()
While 1      
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
     Case $msg = $Button_4
        $slide = Number(GuiCtrlRead($Slider_2))
        $AppName = GUICtrlRead($WinName)
        $ret = WinSetTrans($AppName, "", $slide)        
    Case Else
        ;;;
EndSelect
WEnd
Exit
This should work better for you, also keep in mind that you have to match any substring of the title.

Ex:

Windows title = AutoIt Forms -> Replying in Making windows transparent - M$ Internet Explorer

if you type replying won't work because in the windows title start with upper case.

if you type Replying work because is an exact match of a substring in the windows title.

Sorry if I confuse you but English is my second language...

AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line
Link to comment
Share on other sites

#include <GUIConstants.au3>
#Include <GuiCombo.au3>

; == GUI generated with Koda ==
$Form1 = GUICreate("Making Windows Transparent", 550, 24, 0, 0, BitOr($WS_CAPTION, $WS_SYSMENU))
$Combo1 = GUICtrlCreateCombo("", 0, 0, 281, 21, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL, $WS_VSCROLL, $CBS_DROPDOWNLIST))
$Slider1 = GUICtrlCreateSlider(280, 0, 270, 21)
GuiCtrlSetLimit(-1, 255, 0)
GUISetState(@SW_SHOW)

AdlibEnable('RebuildComboBox')
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
     Case $msg = $Slider1
        If GUICtrlRead($Combo1) == '' Then ContinueLoop
        WinSetTrans(GUICtrlRead($Combo1), '', Number(GuiCtrlRead($Slider1)))    
    Case Else
        ;;;;;;;
    EndSelect
WEnd
Exit

Func RebuildComboBox()
   Local $listItems
   Dim $var = WinList()

   For $i = 1 to $var[0][0]
      ; Only display visble windows that have a title
      If $var[$i][0] <> "" AND IsVisible($var[$i][1]) And $var[$i][0] <> "Program Manager" And $var[$i][1] <> $Form1 Then
         If _GUICtrlComboFindString($Combo1, $var[$i][0]) == $CB_ERR Then
            _GUICtrlComboAddString($Combo1, $var[$i][0])
         EndIf
      EndIf
   Next

   $listItems = StringSplit(_GUICtrlComboGetList($Combo1, '|'), '|')
   For $x = 1 To $listItems[0]
      If Not WinExists($listItems[$x]) Then
         _GUICtrlComboDeleteString($Combo1, _GUICtrlComboFindString($Combo1, $listItems[$x]))
      EndIf
   Next
EndFunc

Func IsVisible($handle)
  If BitAnd( WinGetState($handle), 2 ) Then 
    Return 1
  Else
    Return 0
  EndIf
EndFunc
I just add another twist into the script. No need for typing, the script is always checking for active windows and adding the title into the combobox. If any of the active windows close the script will remove the title from the combobox.

Edited by Danny35d
AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line
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...