Sign in to follow this  
Followers 0
gerardsweeney

Writing on login/CTRL-ALT-DEL screen

10 posts in this topic

Hello, all..

I am attempting to write a small GUI which runs as a service which displays some extremely basic system information - PC name, IP address etc.

The idea being it will run on the desktop at the bottom middle.

I don't think I can use BGINFO/BackInfo or similar as our Staff have different wallpapers/resolutions and if I start using one of these, then the wallpapers get replaced and I get lynched.

I thought I'd found the answer here: http://home.pacbell.net/nhoize/CNS.html

It's a tiny service which successfully runs on the login/CTRL-ALT-DEL and logged in user desktops.

Unfortunately, it doesn't allow formatting or custom text so I can't overlay a helpdesk phone number as required. The author has stopped developing it and doesn't appear to reply to emails about it.

The GUI isn't the problem - I just used an example here to get a transparent desktop.

Installing it as a service isn't a problem - I am lazy and use ServiceEx.

So it runs as a service, and when a user logs in, it appears. However, I can't get it to act like the CNS utility where it stays visible on all of the desktops (login/CTRL-ALT-DEL/user).

I don't know if it's needed, but here is the very rough 1st draft code I'm using:

#include <GUIConstants.au3>
#include <GUIConstantsEx.au3>
#include<WindowsConstants.au3>
#include<WinAPI.au3>
#include <StaticConstants.au3>

$Desktop = ControlGetHandle("[CLASS:Progman]","","[CLASS:SHELLDLL_DefView]")

$GUI = GUICreate("Desktop",1279, 277, 2, 457,$WS_POPUP,BitOR($WS_EX_LAYERED,$WS_EX_TRANSPARENT))
GUISetBkColor(0xABCDEF)
_WinAPI_SetLayeredWindowAttributes($GUI,0xABCDEF)
_WinAPI_SetParent($GUI,$Desktop)

$Label_CompName = GUICtrlCreateLabel("ComputerName", -8, 0, 1280, 57, $SS_CENTER)
GUICtrlSetFont($Label_CompName, 36, 800, 0, "Trebuchet MS")
GUICtrlSetColor($Label_CompName, 0xFFFFFF)


$Label_Username = GUICtrlCreateLabel("Logged on user: domain\testuser", 4, 58, 1280, 41, $SS_CENTER)
GUICtrlSetFont($Label_Username, 20, 400, 0, "Trebuchet MS")
GUICtrlSetColor($Label_Username, 0xC0C0C0)


GUISetState()
While 1
    Sleep(100)
WEnd

EXIT

Any pointers greatly appreciated.

Kind regards,

Gerard

Share this post


Link to post
Share on other sites



Is the handle to the desktop windo the same when you logout and back in as another user? I haven't tested but it would be interesting to find out.

An alternative is to write a custom version of BGInfo, where you take the current wallpaper and write on it using GDI+, that shouldn't be too hard to do, but it might take some working out. Search the forums for wallpaper switcher, and theres a few examples of using WinAPI to change the wallpaper.

Please do post what you find out, because I think this will be very useful. MAybe if it works using the second method then you'll have a vastly improved version of BGInfo.

Share this post


Link to post
Share on other sites

Is the handle to the desktop windo the same when you logout and back in as another user? I haven't tested but it would be interesting to find out.

That's a very good question.

I suspect I may have got a bit ahead of myself, though. I've found that if I login as someone who doesn't have a user profile on the PC, although the service is still running, the GUI doesn't display properly.

By that, I mean I can see an ugly black block instead of anything vaguely useful. Ho hum.

I'm unsure whether this is to do with AutoIt or the method I've used to run it as a service.

An alternative is to write a custom version of BGInfo, where you take the current wallpaper and write on it using GDI+, that shouldn't be too hard

Actually, I did consider that at one point and I do use another script to generate an alternate logon wallpaper when I'm deploying anything via our Altiris software deployment system.

However - our pupils logging in have it set via group policy to not have any wallpaper... I suppose I could read in the screen mode and generate one with the Windows background colour in their temp folder and then write on that... Hmm.. Food for thought ;)

Thanks for making me look again at one of my original ideas..

I'd still be quite interested to see if anyone can point me in the direction of running a GUI on all 3 desktops..

Share this post


Link to post
Share on other sites

Have you looked at the AutoIt command ToolTip()? It puts a tooltip on the screen that will overlay any other windows, can be multi-line, doesn't require a GUI to run, can have an icon displayed (limited types allowed), and it can be placed anywhere on the screen you'd like


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

Have you looked at the AutoIt command ToolTip()? It puts a tooltip on the screen that will overlay any other windows, can be multi-line, doesn't require a GUI to run, can have an icon displayed (limited types allowed), and it can be placed anywhere on the screen you'd like

I will have to double check, but I believe that it does require a window to run (the fact that it's listed as being a control on MSDN is probably where that idea came from), but uses the AutoIt hidden window instead of a GUI, to give us the ease of use that makes AutoIt so... easy ;)

Share this post


Link to post
Share on other sites

I will have to double check, but I believe that it does require a window to run (the fact that it's listed as being a control on MSDN is probably where that idea came from), but uses the AutoIt hidden window instead of a GUI, to give us the ease of use that makes AutoIt so... easy ;)

Nope, tooltip doesn't require a window to attach to, try this code

While 1
    $array = MouseGetPos()
    ToolTip($array[0] & @LF & $array[1], 20, 20)
    Sleep(500)
WEnd

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

I misread what you meant. I see what you're saying now. Still, the point I was making, which has nothing to do with a hidden window, is that you don't have to make a GUI window to make it work which makes it much easier to use than making a GUI and placing on the screen. Which is what the OP was looking to do.

I can't say for sure it will work for what he's trying to do, but I was pointing out another option.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

I can't say for sure it will work for what he's trying to do, but I was pointing out another option.

Thank you for the suggestions above.

Tool-Tip - so simple - why didn't I think of it before?!

And the result is - Ooh, so close..

It works nicely for each user who logs in (unlike the black block GUI), but it still doesn't appear on the CTRL-ALT-DEL or login screen.

I'm wondering if it's to do with the service installer, but looking through the registry I don't see anything immediately obvious between the service for CNS (the app which does work) and my test exe.

I'm absolutely open to suggestion (erm, keep them clean!)

Regards,

Gerard

Edited by gerardsweeney

Share this post


Link to post
Share on other sites

I'm replying to myself - a sign of madness, perhaps? ;)

In case anyone else suggests it..

I'd been looking at the SourceForge page for CNS and saw it was listed as being "Uptime 2000 inspired".

I had a quick Google search for "Uptime 2000", and lo and behold the author recently brought out a new program since someone had contacted him about adding additional details on the desktop.

http://gusperez.com/wp/software/desktips/

Unfortunately, it's now written in .NET (ggnnn!!) and absolutely hammered my poor laptop when I tried a relatively simple task of adding a new "tip" to show.

Oh, and it also doesn't write on the CTRL-ALT-DEL or login screen.

Heigh-ho.

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  
Followers 0