Jump to content
Sign in to follow this  

SplashText with color

Recommended Posts


This is just a quick and nasty proof of concept that I experimented with but unfortunately I haven't really got time to improve so feel free to post up changes. The SplashTextOn options should all work as well (ie. 1 = Thin bordered titleless window etc) and using a while loop gives you flashing text (albeit not exactly regular).

That said, it's probably just simpler to create your own GUI. In any case, thought I'd share so those who want to experiment can.

#include <WinAPI.au3>
#include <WindowsConstants.au3>
#include <FontConstants.au3>

Global $tRECT, $hFont, $hOldFont, $hDC

HotKeySet("{ESC}", "_Exit")

$tRECT = DllStructCreate($tagRect)
DllStructSetData($tRECT, "Left", -20)
DllStructSetData($tRECT, "Top", 0)
$iWidth = DllStructSetData($tRECT, "Right", 250)
$iHeight = DllStructSetData($tRECT, "Bottom", 50)
$sTitle = "AutoIt"
$sText = " IT WORKS! "

$hDC = _WinAPI_GetDC(SplashTextOn($sTitle,"", $iWidth-20, $iHeight, -1, -1, 16))
$hFont = _WinAPI_CreateFont(50, 0, 0, 0, 400, False, False, False, $DEFAULT_CHARSET, _
$hOldFont = _WinAPI_SelectObject($hDC, $hFont)

_WinAPI_SetTextColor($hDC, 0x0000FF)
_WinAPI_SetBkColor($hDC, 0x000000)
; comment next line to get black background instead of transparent one
; comment next line and uncomment the one in the while loop to get flashing text (must use a background color to work)
_WinAPI_DrawText($hDC, $sText, $tRECT, $DT_CENTER)
While 1
    ;_WinAPI_DrawText($hDC, $sText, $tRECT, $DT_CENTER)

Func _Exit()
    _WinAPI_SelectObject($hDC, $hOldFont)
    _WinAPI_ReleaseDC(0, $hDC)
    _WinAPI_InvalidateRect(0, 0)
    $tRECT = 0
EndFunc   ;==>_Exit

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.