Jump to content

Overlay text on desktop


Recommended Posts

Hello!

I was wondering if there is any clever and cunning way I can overlay text on the desktop of my computer.

To clarify, I work in an organisation of about 5000 users (im in IT!). We currently use a tool called BGInfo which runs on each startup, and basically takes a background image, pastes some text on it (like their IP address / context etc) and then applies the background as their desktop image.

I wondered if Autoit was capable of doing something similar. I saw demo scripts for using Alpha channels to overlay bitmaps but it's not quite what im after.

Any thoughts would be appreciated.

Thanks,

Simon

P.s. I've got to admit - V3 of Autoit is pretty amazing! We've used it to create heaps of GUI tools for the support guys.

Link to comment
Share on other sites

i paint it directly on the wallpaper

mybe this has some use for you

be carefull , i use a copy of my wallpaper in the "(@WindowsDir & "\Web\Wallpaper"\"

it must be jpg

the jpg stay untouched, it saves a new .bmp wallpaper with text back to the windows dir

and refresh your desktop with the .bmp created wallpaper

#include <Prospeed.au3>

GetDesktopHDC()

$bitmap = CreateExtBmp(300, 500)    
SetText($bitmap, "Text on desktop", 20, 20, 0xFFFFFF, 0x000000, 14, 400, "Arial")

$wallpaper = LoadExtImage(@WindowsDir & "\Web\Wallpaper\WindowsXP15.jpg")
CopyExtBmp($wallpaper,700,10,300,500,$bitmap,0,0,-1)

SaveExtImage($wallpaper, @WindowsDir & "\Web\Wallpaper\WindowsXP15.bmp", 0, 10)
DllCall("User32.dll", "int", "SystemParametersInfo", _
                      "int", 20, _
                      "int", 0, _
                      "string", @WindowsDir & "\Web\Wallpaper\WindowsXP15.bmp", _
                      "int", 0x01)

FreeExtBmp($bitmap) 
FreeExtBmp($wallpaper)

Func SetText($S_Destination, $S_Text, $S_x, $S_y, $S_TextColor, $S_BKColor, $Font_H, $Font_W, $Font_Name)
    $font = DllCall("gdi32.dll", "int", "CreateFontA", _
                                 "int", $Font_H, _
                                 "int", 0, _
                                 "int", 0, _
                                 "int", 0, _
                                 "int", $Font_W, _
                                 "Int", 0, _
                                 "int", 0, _
                                 "int", 0, _
                                 "int", 0, _
                                 "int", 0, _
                                 "int", 0, _
                                 "int", 0, _
                                 "int", 0, _
                                 "str", $Font_Name)
    $oldfont = DllCall("gdi32.dll", "int", "SelectObject", _
                                    "hwnd", $S_Destination, _
                                    "int",  $font[0])   
    DllCall("gdi32.dll", "int",  "SetBkMode", _
                         "hwnd", $S_Destination, _  
                         "int",  "TRANSPARENT")
    DllCall("gdi32.dll", "int",  "SetTextColor", _
                         "hwnd", $S_Destination, _
                         "int",  $S_TextColor)
    DllCall("gdi32.dll", "int",  "SetBkColor", _
                         "hwnd", $S_Destination, _
                         "int",  $S_BKColor)
    DllCall("gdi32.dll", "int",  "TextOutA", _
                         "hwnd", $S_Destination, _
                         "int",  $S_x, _
                         "int",  $S_y, _
                         "str",  $S_Text, _
                         "int",  StringLen($S_Text))    
    DllCall("gdi32.dll", "int",  "selectObject", _
                         "hwnd", $S_Destination, _
                         "int",  $oldfont[0])
    DllCall("gdi32.dll", "int", "DeleteObject", _
                         "hwnd", $font[0])
EndFunc
Edited by jpam
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...