Jump to content

Simple text placment on desktop without boarders


PeterAtkin
 Share

Recommended Posts

I'm looking for a way to have just some text 'Version Number' to be discreetly displayed without boarder and preferably overlayed so as not to disturb the background/desktop showing while the compiled script is running.

I've had a look to see if these anything I could use but either I'm just not looking right or this is harder than it looks.

Any pointers would be appreciated

Edited by PeterAtkin

[topic='115020'] AD Domain Logon Script[/topic]

Link to comment
Share on other sites

maybe this example is usefull for you:

#include <StaticConstants.au3>
#include <EditConstants.au3>
#include <ComboConstants.au3>
#include <GuiConstants.au3>
#include <WindowsConstants.au3>
#include <ButtonConstants.au3>
#Include <Misc.au3>
#include <Constants.au3>
#Include <GuiButton.au3>
#include <GDIPlus.au3>
_GDIPlus_Startup()
$kPen = _GDIPlus_BrushCreateSolid()
$hFamily = _GDIPlus_FontFamilyCreate ("Arial")
$hFont = _GDIPlus_FontCreate ($hFamily, 12, 2)
$hFormat = _GDIPlus_StringFormatCreate ()
_GDIPlus_StringFormatSetAlign($hFormat, 1)
Opt("GuiOnEventMode", 1)
GUICreate("temptext", 100, 25, @DesktopWidth/2, @DesktopHeight/2, BitOR($WS_POPUP,$WS_CLIPCHILDREN), $WS_EX_LAYERED+$WS_EX_TOPMOST)
GUISetBkColor(0x010101)
GUISetState()
$xys = WinGetHandle ("[ACTIVE]")
_WinAPI_SetLayeredWindowAttributes($xys, 0x010101)
$tGraphic = _GDIPlus_GraphicsCreateFromHWND($xys)
$ttLayout = _GDIPlus_RectFCreate (0, 0, 100, 25)
_GDIPlus_GraphicsDrawStringEx ($tGraphic, "Version 1.0", $hFont, $ttLayout, $hFormat, $kPen)
GUISetOnEvent($GUI_EVENT_PRIMARYDOWN, "SystemEvents")
GUISetOnEvent($GUI_EVENT_SECONDARYDOWN, "SystemEvents")
While 1
    Sleep(10)
WEnd
Func SystemEvents()
    Switch @GUI_CtrlId
        Case $GUI_EVENT_PRIMARYDOWN
            DllCall("user32.dll","int","SendMessage","hWnd", $xys,"int",$WM_NCLBUTTONDOWN,"int", $HTCAPTION,"int", 0)
        Case $GUI_EVENT_SECONDARYDOWN
            exit
    EndSwitch
EndFunc
Link to comment
Share on other sites

You might also be interested in this one by Valuater

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

Here an example from help file (GUICtrlCreateProgress ()) modified:

#include <Constants.au3>
#include <WinAPI.au3>
#include <GuiEdit.au3>
#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <ProgressConstants.au3>

Opt('MustDeclareVars', 1)

Example()

Func Example()
    Local $progressbar1, $progressbar2, $button, $wait, $s, $msg, $m, $hGUI

    $hGUI = GUICreate("My GUI Progressbar", 220, 100, -1, -1, Default, $WS_EX_TOPMOST)
    $progressbar1 = GUICtrlCreateProgress(10, 10, 200, 20)
    GUICtrlSetColor(-1, 32250); not working with Windows XP Style
    $progressbar2 = GUICtrlCreateProgress(10, 40, 200, 20, $PBS_SMOOTH)
    $button = GUICtrlCreateButton("Start", 75, 70, 70, 20)
    GUISetState(@SW_SHOW, $hGUI)

    #region additional
    Local $hGUI_Transparent, $label
    $hGUI_Transparent = GUICreate("Test", 100, 50, @DesktopWidth - 100, @DesktopHeight - 80, $WS_POPUP, BitOR($WS_EX_TOOLWINDOW, $WS_EX_LAYERED, $WS_EX_TOPMOST))
    GUISetBkColor(0x00, $hGUI_Transparent)
    $label = GUICtrlCreateLabel("v1.0.0.1", 0, 0, 100, 50)
    GUICtrlSetColor(-1, 0x0000A0)
    GUICtrlSetFont(-1, 16, 800)
    _WinAPI_SetLayeredWindowAttributes($hGUI_Transparent, 0x00, 255, 1, False)
    GUISetState(@SW_SHOW, $hGUI_Transparent)
    #endregion

    $wait = 20; wait 20ms for next progressstep
    $s = 0; progressbar-saveposition
    Do
        $msg = GUIGetMsg()
        If $msg = $button Then
            GUICtrlSetData($button, "Stop")
            For $i = $s To 100
                If GUICtrlRead($progressbar1) = 50 Then MsgBox(0, "Info", "The half is done...", 1)
                $m = GUIGetMsg()

                If $m = -3 Then ExitLoop

                If $m = $button Then
                    GUICtrlSetData($button, "Next")
                    $s = $i;save the current bar-position to $s
                    ExitLoop
                Else
                    $s = 0
                    GUICtrlSetData($progressbar1, $i)
                    GUICtrlSetData($progressbar2, (100 - $i))
                    Sleep($wait)
                EndIf
            Next
            If $i > 100 Then
                ;       $s=0
                GUICtrlSetData($button, "Start")
            EndIf
        EndIf
    Until $msg = $GUI_EVENT_CLOSE
EndFunc   ;==>Example

The additional code is within the region :graduated:

Br,

UEZ

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

  • 5 months later...

Im sorry for necro this thread but i got a question about this text.

How to make this text to appear on screen when im running full window program/game? I cant find a solution, maybe someone can give me direction where to look at?

Thanks

Link to comment
Share on other sites

sorry for double post.

I did transparent text with layered window, workin great, I can keep it on top in FULL window game/program with ShiftWindow program. It doesnt solve my issue completly coz i wanted to do it with autoit only, If anyone know how to do it let me know.

Link to shiftwindow: http://www.grismar.net/shiftwindow/

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