Jump to content
Sign in to follow this  
TK_Incorperate

WinSetTrans problem

Recommended Posts

TK_Incorperate

Whenever I call my function to set a transparency to a window, it will not do it. I've called this function over and over and nothing happens. I don't have the slightest clue what's wrong with it.

I even have it search for the process ID, window name, and first word of the window name. Still no luck making it transparent. Help please?

P.S. I know I use a GUI but it has nothing to do with my problem, so this doesn't go in GUI section.

#include<misc.au3>
#include<GUIConstants.au3>
#include<string.au3>

Global $Trans

$Trans = 0

AutoItSetOption("PixelCoordMode", 2)

$GUI1 = GUICreate("Chicken-Pix v1.4 -Lite-", 112, 40)
GUISetState(@SW_SHOW, $GUI1)

$Button1 = GUICtrlCreateButton("+", 90, 10, 12, 20)

$Input1 = GUICtrlCreateInput("Transparent D2", 10, 10, 80, 20, $ES_AUTOhSCROLL+$ES_READONLY)

While 1
    $Msg = GUIGetMsg()
    If $Msg = $Button1 Then
        _Transparent()
    EndIf

    If ProcessExists("Diablo II.exe") = 0 Then
        ExitLoop
    EndIf
    
    Sleep(1000)
WEnd

Func _Transparent()
    $PID1 = ProcessExists("Diablo II.exe")
    If $Trans = 0 Then
        WinSetTrans($PID1, "", 100)
        Sleep(1)
        WinSetTrans("Diablo II", "", 100)
        Sleep(1)
        WinSetTrans("Diablo", "", 100)
        $Trans = 1
    ElseIf $Trans = 1 Then
        WinSetTrans($PID1, "", 255)
        Sleep(1)
        WinSetTrans("Diablo II", "", 255)
        Sleep(1)
        WinSetTrans("Diablo", "", 255)
        $Trans = 0
    EndIf
    Sleep(1)
EndFunc

Share this post


Link to post
Share on other sites
Achilles

Maybe try the AutoItWindow tool?

Or make something (since your not getting the name right) use winlist to make tell you all the current windows and then one of those should be the one you want for the title.

You could try this to:

Opt("WinTitleMatchMode", 2)
That will make is so that the title matches to any substring in the window title. Edited by Piano_Man

My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]

Share this post


Link to post
Share on other sites
TK_Incorperate

Well I tried your way, and it still didn't work. As far as making something to show me all current windows names, I have no clue how to do that, it is a good idea however.

Share this post


Link to post
Share on other sites
TK_Incorperate

does anyone have a solution? this is a vita issue with my program, lol seeing as how its one of the main features

Share this post


Link to post
Share on other sites
Achilles

does anyone have a solution? this is a vita issue with my program, lol seeing as how its one of the main features

Alright, this is what I meant.

Uncomment the commented code if you don't use Scite, that will it will right the windows to an .ini file which will be in the script directory.

HotKeySet('1', '_ConsoleWriteList')

While 1
    Sleep(1000)
WEnd

Func _ConsoleWriteList()
    Local $temp = WinList()
    
;~  If FileExists(@ScriptDir & '\Open Windows.ini') then 
;~      FileDelete(@ScriptDir & '\Open Windows.ini') 
;~  EndIf
    
    ConsoleWrite(@CRLF & '+> Writing current windows in order of appearence' & @CRLF)
    For $a = 1 To $temp[0][0]
        If $temp[$a][0] <> "" And _IsVisible($temp[$a][1]) Then
;~          IniWrite(@ScriptDir & '\Open windows.ini', '_Current Windows', $a, $temp[$a][0])
            ConsoleWrite('>Window name: ' & $temp[$a][0] & @CRLF)
        EndIf
    Next
    ConsoleWrite('+> Complete' & @CRLF)
EndFunc ;==>_GetTopMost

Func _IsVisible($handle)
    If BitAND(WinGetState($handle), 2) Then
        Return 1
    Else
        Return 0
    EndIf
EndFunc ;==>_IsVisible

This way is should give you the actual name of the window which you be able to use in the WinSetTrans()

Edited by Piano_Man

My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]

Share this post


Link to post
Share on other sites
Siao

Sleep() in the main GUIGetMsg loop always is a very bad thing to do.

It's the reason why you don't see anything working - your GUI is unresponsive.

And in any case, if you expect that the whole game window will become transparent, I think you'll be disappointed. I'm pretty sure only titlebar will become see-through.

Edited by Siao

"be smart, drink your wine"

Share this post


Link to post
Share on other sites
TK_Incorperate

Sleep() in the main GUIGetMsg loop always is a very bad thing to do.

It's the reason why you don't see anything working - your GUI is unresponsive.

And in any case, if you expect that the whole game window will become transparent, I think you'll be disappointed. I'm pretty sure only titlebar will become see-through.

Sleep is used in every GUI ive ever created, it in absolutely no way makes GUI unresponsive. Ive been using it for as long as I've been using AutoIt

As far as making the whole game screen transparent, I've done it before with AutoIt but deleted the script, WinSetTrans does work for the game, but I don't remember how I did it.

~TK

Share this post


Link to post
Share on other sites
Siao

Sleep is used in every GUI ive ever created, it in absolutely no way makes GUI unresponsive.

Good for you :)


"be smart, drink your wine"

Share this post


Link to post
Share on other sites
SmOke_N

Sleep is used in every GUI ive ever created, it in absolutely no way makes GUI unresponsive. Ive been using it for as long as I've been using AutoIt

As far as making the whole game screen transparent, I've done it before with AutoIt but deleted the script, WinSetTrans does work for the game, but I don't remember how I did it.

~TK

Why in the world you use a sleep in a loop when you're already using GUIGetMsg() ?

GUICreate("")
GUISetState()
While 1
    Switch GUIGetMsg()
        Case -3
            Exit
    EndSwitch
WEnd
You're going to tell me you get the same response time?

Edit:

Holy mother of god, went to make the example include an Exit, and what a mess my edit ended up being.

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites
Achilles

Edit:

Holy mother of god, went to make the example include an Exit, and what a mess my edit ended up being.

That's why I gave up on the AutoIt tags... I got sick of the

4!`!28$9d23^$sf57@#&8%43#9qp%fi*oas;djv*8%9f4ujvf9%#p8pjo@lsc


My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]

Share this post


Link to post
Share on other sites
Cyber

i prefer use

254 and not 255

why?

becouse from 254 to 255 the window do jump


Console Browse: Navigate on the WEB in a textual consoleMultiPing!: Show computer on the lan and/or show the local/remote task, ALL animated!KillaWin: Event executingCryptPage: Crypt your webpage and show only with key

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.