Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Is there a way to write "Text" on Desktop, above W


  • Please log in to reply
39 replies to this topic
SKAN
  • Administrators
  • 9115 posts
  • Last active:
  • Joined: 26 Dec 2005
I think it would be very cool, if one could write text on desktop, say , a ToDo list, Birthday Reminders or something similar.

I guess there must be some way to do this by calling a Windows API function.

If someone could script a function* it would be great!
*accepting parameters Text, FontName, FontSize, FontStyle, HTML_Color_Code, X_Pos, Y_Pos

Has anybody idea on this?

This is not my top priority in Asking for Help... but I think this might interest many AHK-ites

:)
kWo4Lk1.png

evl
  • Members
  • 1237 posts
  • Last active: Oct 20 2010 11:41 AM
  • Joined: 24 Aug 2005
One possible way is to use the SetParent DllCall and set the desktop as the parent of the gui. A similar example of this is with the script "Taskbar Clock/Calendar with Processor and Memory Load bars" ( http://www.autohotke...opic.php?t=6290 ) and changing the line:

hw_tray := DllCall( "FindWindowEx", "uint",0, "uint",0, "str","Shell_TrayWnd", "uint",0 )


To:

hw_tray := DllCall( "FindWindowEx", "uint",0, "uint",0, "str","Progman", "uint",0 )


Will change it to have the dekstop as the parent instead of the taskbar. (You might need to change the starting position to be able to see it depending on your resolution, as I recall, or try it with the version of the code that I posted in that thread too)

SKAN
  • Administrators
  • 9115 posts
  • Last active:
  • Joined: 26 Dec 2005
evl,
I will check it out :) Thanks
kWo4Lk1.png

segfault
  • Members
  • 12 posts
  • Last active: Jan 29 2006 04:04 PM
  • Joined: 12 Jan 2006
if you have windows xp, it is easiest just to embed html into your desktop.

Just make an html page that looks like what you want, save it to a file somewhere, go to display settings, desktop tab, click customize desktop, next window go to web tab, add new item, the file you made. To update it, just modifiy the file and refresh the desktop. Very handy.

SKAN
  • Administrators
  • 9115 posts
  • Last active:
  • Joined: 26 Dec 2005
@segfault

Oh Yes!, That can be done in Windows 98 also with Active Desktop enabled.
But I have Automatic WallPaper Changer running, which changes Wallpaper every 5th minute.
I want to display some Text (with a fancy font) over it!

Any ideas?.... :)
kWo4Lk1.png

segfault
  • Members
  • 12 posts
  • Last active: Jan 29 2006 04:04 PM
  • Joined: 12 Jan 2006
The embedded document will stay as wallpapers change (at least it does when i change mine manually). Your document will execute javascript, so it should be possible to have it set as background a fraction of the image wallpaper, for blending in like camouflage... Other than that you should most likely try evl's suggestion with a transparent window.

SKAN
  • Administrators
  • 9115 posts
  • Last active:
  • Joined: 26 Dec 2005

Other than that you should most likely try evl's suggestion with a transparent window.


Yes! I will try it and post again .. Thanks :)
kWo4Lk1.png

SKAN
  • Administrators
  • 9115 posts
  • Last active:
  • Joined: 26 Dec 2005

One possible way is to use the SetParent DllCall and set the desktop as the parent of the gui. A similar example of this is with the script "Taskbar Clock/Calendar with Processor and Memory Load bars" ( http://www.autohotke...opic.php?t=6290 ) and changing the line:

hw_tray := DllCall( "FindWindowEx", "uint",0, "uint",0, "str","Shell_TrayWnd", "uint",0 )



To:

hw_tray := DllCall( "FindWindowEx", "uint",0, "uint",0, "str","Progman", "uint",0 )


Will change it to have the dekstop as the parent instead of the taskbar. (You might need to change the starting position to be able to see it depending on your resolution, as I recall, or try it with the version of the code that I posted in that thread too)


I'm unable to make this work! I will be grateful if you/somebody can write an example for me,

like a transparent text "Hello World" in the Top-Left of the Desktop

Please help
kWo4Lk1.png

Serenity
  • Members
  • 1271 posts
  • Last active:
  • Joined: 07 Nov 2004
Here's a working example:

#singleinstance force
; #notrayicon

process, exist
pid = %errorlevel%

gui, color, FF00FF
gui, font, s14 cFFFFFF, arial bold

; 0x02000000 = WS_CLIPCHILDREN, prevents parent window from redrawing over child window
gui, -caption +toolwindow +0x02000000 ; toolwindow stops flicker of icon in taskbar

gui, add, text, x0 y0, Hello World!

winminimizeall

gui, show, x20 y20
winset, transcolor, FF00FF, ahk_pid %pid%

; dock to desktop:
winget, hw_gui, ID, ahk_pid %pid%
winget, hw_desktop, ID, ahk_class Progman
DllCall("SetParent", "uint", hw_gui, "uint", hw_desktop)

return

"Anything worth doing is worth doing slowly." - Mae West
Posted Image

toralf
  • Moderators
  • 4035 posts
  • Last active: Aug 20 2014 04:23 PM
  • Joined: 31 Jan 2005
Why don't you use a transparent GUI? Without Border and Titlebar you can specify all the Text you want. With all the parameters you have specified in your first post. Set it to Bottom. I think you can even click Icons behind the transparent GUI, If they are not covered with text.

Edit: I was typing while Serenity already got the code together. Well done.
Ciao
toralf
 
I use the latest AHK version (1.1.15+)
Please ask questions in forum on ahkscript.org. Why?
For online reference please use these Docs.

SKAN
  • Administrators
  • 9115 posts
  • Last active:
  • Joined: 26 Dec 2005
@Serenity: Thanks a lot :) , I was messing with this SetParent & was unable to get it work!. Thanks Again for the code.

But winset, transcolor does not work in Win98, I guess I have to settle with a black background.

Why don't you use a transparent GUI? Without Border and Titlebar you can specify all the Text you want. With all the parameters you have specified in your first post. Set it to Bottom. I think you can even click Icons behind the transparent GUI, If they are not covered with text.


@toralf: Because, I knew I cannot use a transparent GUI in Win 98.

What I had in my mind was that, able to add a text with
Gui,Add,Text,x20 y20 BackgroundTrans,Hello World
to the desktop instead of a GUI

Is there a way to call some Dll function like
GDI32.DLL\TextOut
GDI32.DLL\SetTextColor
User32\DrawText
User32\DrawTextExto do this?
kWo4Lk1.png

SKAN
  • Administrators
  • 9115 posts
  • Last active:
  • Joined: 26 Dec 2005
Dear Serenity,

Thanks a Lot :D :D :D

I use your example for sticking images on desktop & add g-label to it
This is simply great.. Thanks for the code again!
kWo4Lk1.png

toralf
  • Moderators
  • 4035 posts
  • Last active: Aug 20 2014 04:23 PM
  • Joined: 31 Jan 2005

@toralf: Because, I knew I cannot use a transparent GUI in Win 98.

How were we supposed to know that you need it for Win98?
Ciao
toralf
 
I use the latest AHK version (1.1.15+)
Please ask questions in forum on ahkscript.org. Why?
For online reference please use these Docs.

SKAN
  • Administrators
  • 9115 posts
  • Last active:
  • Joined: 26 Dec 2005
I am Sorry toralf :(. My future posts will be distinct.
Thanks!
kWo4Lk1.png

Akize
  • Members
  • 32 posts
  • Last active: Jun 30 2008 02:57 PM
  • Joined: 16 Jan 2006
Thanks for the code Serenity! I'm trying to turn this into a function but I'm unable to draw multiple lines within the same script:

printscreen::
drawtodesktop(a_now,20,20)
drawtodesktop(a_now,50,50)
soundplay *64
return

drawtodesktop(text,x=0,y=0,font="",font_size=8,font_color="")
{
	if (font="")
	  font=arial

	if (font_color="")
	  font_color=ffffff
	process exist
	pid=%errorlevel%

	gui color,ff00ff
	gui font,s%font_size% c%font_color%,%font%

	;0x02000000=WS_CLIPCHILDREN,prevents parent window from redrawing over child window
	gui -caption +toolwindow +0x02000000 ;toolwindow stops flicker of icon in taskbar

	gui add,text,x0 y0,%text%
	gui show,x%x% y%y%
	winset transcolor,ff00ff,ahk_pid %pid%

	;dock to desktop
	winget hw_gui,ID,ahk_pid %pid%
	winget hw_desktop,ID,ahk_class Progman
	DllCall("SetParent","uint",hw_gui,"uint",hw_desktop)
}

Only the line at 50,50 will display. Is there any way around this?