Jump to content

GhostIt like windows..


Recommended Posts

A ghost window is translucent and will always appear on top of otherwindows. When a ghost window loses the input focus, it remainstranslucent and always on top, but all clicks will pass right throughit like it wasn't even there

That's what I want to do, but I want to know if there's a way to do that in AutoIt, so I don't have to use a third-party program.

I've messed around with WinSetTrans, WinSetState, and WinSetOnTop, but nothing I've tried does what the program GhostIt does. I just want a way to do functions like GhostIt does, but through AutoIt. I don't know if this is possible, but, worth asking...

We ought not to misbehave, but we should look as though we could.

Link to comment
Share on other sites

That's what I want to do, but I want to know if there's a way to do that in AutoIt, so I don't have to use a third-party program.

I've messed around with WinSetTrans, WinSetState, and WinSetOnTop, but nothing I've tried does what the program GhostIt does. I just want a way to do functions like GhostIt does, but through AutoIt. I don't know if this is possible, but, worth asking...

Trancexx showed how to do this a few months ago. Set the window extended style to $WS_EX_TOPMOST), and set its transparency with WinSetTrans.

Here is an example I wrote for someone who had no CAPS indicator on their keyboard.

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_outfile=CapsLok.exe
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <Misc.au3>
#include <windowsconstants.au3>
#include <winapi.au3>
#include <guiconstantsEx.au3>
Opt("sendcapslockmode", 0)
$gui = GUICreate("capslok",20,25,0,@DesktopHeight - 25,$WS_POPUP,$WS_EX_TOPMOST);BitOr($WS_EX_TRANSPARENT,$WS_EX_TOPMOST))
GUISetFont(12)
GUISetBkColor(0xff0000)
WinSetTrans($gui,"",200)
GUISetState()
$lab = GUICtrlCreateLabel("CAPS",1,2);,80,22)
GUICtrlSetResizing(-1,$GUI_DOCKLEFT+$GUI_DOCKWIDTH)
GUICtrlSetColor(-1,0x33ff55)
$tags =_WinAPI_GetTextExtentPoint32(_WinAPI_GetDC($gui)," CAPS  ")
$wid=DllStructGetData($tags,1)
ConsoleWrite("wid = " & $wid & @CRLF)
$ht=DllStructGetData($tags,2)
;ConsoleWrite($ht & @CRLF)
$ls = ControlGetPos($gui,"",$lab)
ConsoleWrite("labwid = " & $ls[2] & @CRLF)
WinMove($gui,"",0,@DesktopHeight - 25,$wid+1)
$CAPS = 8
$displayCL = 9
While 1
    $stateCL = GETCAPSLOCK()
    If $stateCL <> $displayCL And Not _IsPressed("14") Then
        If $stateCL Then
            GUICtrlSetData($lab,"CAPS")
        Else
            GUICtrlSetData($lab,"")
        EndIf
        $displayCL = $stateCL
        WinSetOnTop($gui,"",1)
    EndIf
    Sleep(100)
WEnd

Func GETCAPSLOCK()
    Local $RET
    $RET = DllCall("user32.dll", "long", "GetKeyState", "long", "0x14")
    Return $RET[0]
EndFunc   ;==>GETCAPSLOCK
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

Trancexx showed how to do this a few months ago. Set the window extended style to $WS_EX_TOPMOST), and set its transparency with WinSetTrans.

Here is an example I wrote for someone who had no CAPS indicator on their keyboard.

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_outfile=CapsLok.exe
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <Misc.au3>
#include <windowsconstants.au3>
#include <winapi.au3>
#include <guiconstantsEx.au3>
Opt("sendcapslockmode", 0)
$gui = GUICreate("capslok",20,25,0,@DesktopHeight - 25,$WS_POPUP,$WS_EX_TOPMOST);BitOr($WS_EX_TRANSPARENT,$WS_EX_TOPMOST))
GUISetFont(12)
GUISetBkColor(0xff0000)
WinSetTrans($gui,"",200)
GUISetState()
$lab = GUICtrlCreateLabel("CAPS",1,2);,80,22)
GUICtrlSetResizing(-1,$GUI_DOCKLEFT+$GUI_DOCKWIDTH)
GUICtrlSetColor(-1,0x33ff55)
$tags =_WinAPI_GetTextExtentPoint32(_WinAPI_GetDC($gui)," CAPS  ")
$wid=DllStructGetData($tags,1)
ConsoleWrite("wid = " & $wid & @CRLF)
$ht=DllStructGetData($tags,2)
;ConsoleWrite($ht & @CRLF)
$ls = ControlGetPos($gui,"",$lab)
ConsoleWrite("labwid = " & $ls[2] & @CRLF)
WinMove($gui,"",0,@DesktopHeight - 25,$wid+1)
$CAPS = 8
$displayCL = 9
While 1
    $stateCL = GETCAPSLOCK()
    If $stateCL <> $displayCL And Not _IsPressed("14") Then
        If $stateCL Then
            GUICtrlSetData($lab,"CAPS")
        Else
            GUICtrlSetData($lab,"")
        EndIf
        $displayCL = $stateCL
        WinSetOnTop($gui,"",1)
    EndIf
    Sleep(100)
WEnd

Func GETCAPSLOCK()
    Local $RET
    $RET = DllCall("user32.dll", "long", "GetKeyState", "long", "0x14")
    Return $RET[0]
EndFunc   ;==>GETCAPSLOCK

I tested your script, it works, but it doesn't pass clicks through the red "CAPS" window, which is mainly what I want. I know how to make a window semi transparent (or all the way, which makes clicks pass through it, because it isn't there, for some reason). I've tried something like WinSetOnTop("Win", ,"", 1) to set it on top, and WinSetTrans("Win", "", 175) to make it transparent, but it still receives clicks.

I also don't want to create a GUI window, I want to do this to an already existing window, like a picture or something. Right now I'm using GhostIt to watch Stargate SG-1 while I do an online college math course. So I can watch it, and still work, even though the player is technically covering my work space

We ought not to misbehave, but we should look as though we could.

Link to comment
Share on other sites

I tested your script, it works, but it doesn't pass clicks through the red "CAPS" window, which is mainly what I want. I know how to make a window semi transparent (or all the way, which makes clicks pass through it, because it isn't there, for some reason). I've tried something like WinSetOnTop("Win", ,"", 1) to set it on top, and WinSetTrans("Win", "", 175) to make it transparent, but it still receives clicks.

I also don't want to create a GUI window, I want to do this to an already existing window, like a picture or something. Right now I'm using GhostIt to watch Stargate SG-1 while I do an online college math course. So I can watch it, and still work, even though the player is technically covering my work space

In XP it works but I've tried it in Vista and it doesn't allow clicks through so if you are using Vista I don't know the answer.

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

Yeah I'm using Vista Home Premium or some version. And yeah, that would work... but that's more a temporary fix... I want it to be more versatile, and doing that would make the math a lot harder to read (and I use Firefox for the course). I was just thinking of making a script to take over some things that my computer does normally, but not how I want, and I was thinking that this would be a neat function... and being built in to one program, would be useful.

We ought not to misbehave, but we should look as though we could.

Link to comment
Share on other sites

Have a look at the code of this script, Yet another clock - AutoIt Forums, written by WideBoyDixon. The background of the GUI is transparent, and does 'pass thru' clicks to whatever is 'underneath'. The program 'getting the click' gets the focus too, but it would only take some additional code to 'return focus to where it was'..

Edited by snowmaker

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Link to comment
Share on other sites

In XP it works but I've tried it in Vista and it doesn't allow clicks through so if you are using Vista I don't know the answer.

It's strange, but I have XP and it does not get through a mouse click, and in fact as it can do.
Link to comment
Share on other sites

Have a look at the code of this script, Yet another clock - AutoIt Forums, written by WideBoyDixon. The background of the GUI is transparent, and does 'pass thru' clicks to whatever is 'underneath'. The program 'getting the click' gets the focus too, but it would only take some additional code to 'return focus to where it was'..

I looked at the clock program... I don't know WinAPI stuff very well. Or at all really, but I see what you're talking about... I don't know if that'd be able to help me though... Thanks for the suggestion. I'll look into WinAPI functions and see if I can come up with anything

We ought not to misbehave, but we should look as though we could.

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...