Jump to content

display text on top but dont activate on click

Recommended Posts

Dear AutoIt community,

im a hobbyscripter and got quite far with this awesome tool and its functions/tutorials already but now im stuck and dont find an answer for my problem (beside d3d drawing, which would require c++/dll injection)

my goal is it to display text on top of a borderless game window which is not active and NOT ACTIVATABLE

(just like i would DrawText with D3D)

that means i also dont want the text/label to "activate" if i accidentaly click it, since that would open the taskbar and id loose gamecontrol until i click the game again.

so is there any way to disable activating clicks for that gui? or is there even an better solution?

here an example what i got so far:

(press END to exit)

#include <GUIConstantsEx.au3> 
#include <Misc.au3>

global $EXIT = "23";Exit Hotkey = END
global $DisplayText="!!!!!!!!!!!!!!!!!!! TEXT TO DISPLAY !!!!!!!!!!!!!!!!!!!     'END' -> exit"


while 1

Func CreateDisplay()
   Global $GUI4LABEL = GUICreate("Display", 200, 200, 800, 3, 0x80000000, 128);$WS_POPUP = 0x80000000, $WS_EX_TOOLWINDOW = 128
    ;Create Label with text
    Global $Label = GUICtrlCreateLabel($DisplayText, 3, 3)    
    $cgp = ControlGetPos($GUI4LABEL, "", $Label);get label size
    WinMove($GUI4LABEL, "", $X, $Y, $cgp[2], $cgp[3]);form gui
    ;Show no activate
 Func HotKeys()
   ;;Hotkey END
   if _IsPressed($EXIT) = 1 Then
   While _IsPressed ($EXIT) = 1



Edited by iB07
Link to post
Share on other sites

You have some errors and unnecessary elements there.

For starters, all your Globals should be at the top of your script.

If _IsPressed($exit) does indeed equal 1, it will never get to the While part of your Hotkeys function, because of the Exit.

Perhaps you meant it to part of an Else statement and use doesn't equal (<>)?

But then, your code execution would be trapped in that loop, and never return to your first While, until you pressed the END key.

Not quite sure why you need to keep sending the same text to the label again (repeatedly and so frequently)?

Or why you need to repetitively set the window on top, when it was made that way at creation?

And I'm not sure that I completely understand your overall aim, but you could disable the Mouse while the Text GUI is showing.

Perhaps, if you rethink the logic of what you are doing and correct your code, then I or another may be able to help.


Welcome to the forum! :)

Edited by TheSaint

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.


What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)


Link to post
Share on other sites

I think maybe something like this is what you are looking for?

#include <GUIConstantsEx.au3>


Global $DisplayText = "                                           !!!!!!!!!!!!!!!!!!! TEXT TO DISPLAY !!!!!!!!!!!!!!!!!!!     'END' -> exit"

HotKeySet("{END}", "Leave")

$GUI4LABEL = GUICreate("GreenGui", @DesktopWidth / 2, @DesktopHeight / 2, -1, -1, 0x80000000, 128);$WS_POPUP = 0x80000000, $WS_EX_TOOLWINDOW = 128
$Label = GUICtrlCreateLabel($DisplayText, 3, 3, @DesktopWidth / 2 - 10, 17)                     ; Need to set the width and height of the Label 

$hWnd = WinGetHandle("GreenGui", "TEXT TO DISPLAY")

while 1
   If Not WinActive($hWnd) Then WinActivate($hWnd)

Func Leave()

Hope this helps.

Link to post
Share on other sites
This topic is now closed to further replies.
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...