Jump to content
timmy2

Is it possible to display a message on the login screen?

Recommended Posts

I found this post that includes a demo of how the $MB_SERVICE_NOTIFICATION works.

; http://msdn.microsoft.com/en-us/library/windows/desktop/ms645505(v=vs.85).aspx
; Community Additions: MB_SERVICE_NOTIFICATION is ignored on Vista
$MB_SERVICE_NOTIFICATION = 2097152; 0x00200000
DllCall('user32.dll', 'int', 'LockWorkStation')
Sleep(3000)
MsgBox($MB_SERVICE_NOTIFICATION, "$MB_SERVICE_NOTIFICATION Test", "Some message... will not work on Vista+")

The above demo code works in Windows 7 in that it displays a message over the login screen, but the workstation is locked instead of logged out. I want to know if the message box will display when no user is logged in.  So I changed the demo code to this:

#include <MsgBoxConstants.au3>
#include <AutoItConstants.au3>

;lock workstation
;DllCall('user32.dll', 'int', 'LockWorkStation')

;logout
Shutdown ($SD_LOGOFF)

Sleep(4000)

MsgBox($MB_SERVICE_NOTIFICATION, "$MB_SERVICE_NOTIFICATION Test", "Some message... will not work on Vista+")

Now I can test $MB_SERVICE_NOTIFICATION when the workstation is locked versus when the user is logged out.  And what I'm seeing is that when the user is logged out $MB_SERVICE_NOTIFICATION does not enable messages to be displayed. 

Is there any method for displaying a message on the login screen when no user is logged in?  My goal, BTW, is to run a script at night while the user is away from the computer and leave a message on the login screen for the user to see upon returning to work the next day.

 

Edited by timmy2
clarification

Share this post


Link to post
Share on other sites

If you log off, anything you're running will shut down. You'd probably need to run it as a scheduled task to test it that way.


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

Thank you to both BrewManNH and JohnOne.  I must've been editing my post while you were replying. 

I am running my script from Task Scheduler, at midnight.  The script runs fine; it's just that messages are not displayed if the user happens to logout before going home. I thought maybe  $MB_SERVICE_NOTIFICATION would enable those messages to appear regardless of whether the user is logged in or not.

Edited by timmy2

Share this post


Link to post
Share on other sites

Share this post


Link to post
Share on other sites

From reading the MSDN page that flag is used for an interactive service that needs to display a message, it probably won't work as a normal task.


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

From reading the MSDN page that flag is used for an interactive service that needs to display a message, it probably won't work as a normal task.

Thank you for that.

Share this post


Link to post
Share on other sites

You might want to try a program called http://www.kixtart.org/

 


All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

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

  • Similar Content

    • By lee321987
      Sometimes when I call several MsgBox's they start popping up under other windows, which the requires ALT + TAB or click the taskbar icon.
      I just wanted to share this workaround:
      Just add a simple GUI in your program:
      #include <GUIConstantsEx.au3> $Form1 = GUICreate("Form1", 1, 1, 0, 0) GUISetState(@SW_SHOW) The GUI window size here is 1x1 so it will be nearly invisible, and at the top-left of your screen.
      It seems as long as that GUI is there all MsgBox's appear on top!
      I only tend to create several MsgBox's in a row when I'm actually writing and testing scripts, so the GUI being there is no big deal (I just remove/comment the GUI creation right before I build the .EXE).
      Have a great day!!!
       
       
    • By Simpel
      Hi,
      I wanted to use _GetLogonTime() by guinness (https://www.autoitscript.com/forum/topic/19370-autoit-wrappers/?do=findComment&comment=942069).
      #include <Date.au3> #include <Array.au3> ConsoleWrite(_GetLogonTime() & @LF) Func _GetLogonTime($sUserName = @UserName, $sComputerName = @ComputerName) ; Idea by trancexx: http://www.autoitscript.com/forum/topic/113611-if-isadmin-not-detected-as-admin/ Local $aRet = DllCall("netapi32.dll", "long", "NetUserGetInfo", "wstr", $sComputerName, "wstr", $sUserName, "dword", 11, "ptr*", 0) _ArrayDisplay($aRet) If @error Or $aRet[0] Then Return SetError(1, 0, False) Local $sHours = DllStructGetData(DllStructCreate("ptr;ptr;ptr;ptr;dword;dword;dword;ptr;ptr;dword;dword;dword;dword;ptr;dword;ptr;dword;dword;byte;dword", $aRet[4]), 18) DllCall("netapi32.dll", "long", "NetApiBufferFree", "ptr", $aRet[4]) Return _DateAdd("h", "-" & $sHours, _NowCalc()) EndFunc ;==>_GetLogonTime It always returns false.
      I displayed $aRet:
      [0]|2221
      [1]|mycomputer
      [2]|myuser
      [3]|11
      [4]|0x0000000000000000
      $aRet[4] shouldn't be 0x0000000000000000 right? Any help?
      Regards, Conrad
       
    • By Lourens
      Hi,
      I am looking for a way to automate login to a Internet Banking website (https://bank.tymedigital.co.za/) and all of the examples that I could found still do not solve my issue with this website.
      In order to Login, the user need to enter their Identity Number and Password the click the Login button.
      Inspecting the Elements in Chrome are as follow;
      Identity Number
      <input autocomplete="username" placeholder="Please enter your South African ID number" maxlength="13" type="tel" class="form-control" value=""> Password
      <input autocomplete="current-password" placeholder="Enter password" type="password" class="form-control" value=""> Button
      <button type="button" class="btn btn-yellow btn-block">Login</button> Any assistance or directing me to a solution will be appreciated.
      Thank you,
      Lourens
    • By editcheck
      Hi, after years of use autoit i am tired to type all time:
      msgbox('','','Hi')
      So, wanna mod the function for set default values... or some more changes.
      where is the function?
      or there are another modes for debug messages that i do not knowed ? XD [just wanna like alert('text')]
      And is there any place for all integrates functions ?
      Thank. Sry my english =E
    • By Ackerz
      Hi guys,
      So I am trying to automate a task and this task has an input box with an already set character "9". 
      I have just decided that I don't really need the input as an option but it's good to leave however for this instance I would like it to run past this point automatically. I've tried numerous ways to try and automate the use of the "OK" button using ControlClick and various other options. I just can't seem to see where this point in the script is. Scoured the forums for anything similar but didn't have any luck finding anything. Sorry to be a pain and I hope someone can help, if I haven't explained in enough detail please don't hesitate to ask for more.
      Many thanks,
      Ackerz
       
      Local $len Local $n Local $buff Local $aMyDate $Len = InputBox("Test",$msgPrompt,"9") $len = StringStripWS($len,$STR_STRIPALL) ;Check that user has entered a vaild password length if not StringIsDigit($len) or $len = 0 Then MsgBox(48,"Error","Invaild Integer was entered" & @CRLF & "Program will now exit.") Exit EndIf ;This creates the random password. for $i = 1 to $Len ;Pick a random char between 1 and the pwsMask Length $n = int(random(1,StringLen($pwsMask))) ;Concat each char that has been picked out of pwsMask to $buff $buff = $Buff & StringMid($pwsmask,$n,1) Next  
×
×
  • Create New...