Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Windows Logon Popup Message 1

Status
Not open for further replies.

Weilerdo

IS-IT--Management
Nov 28, 2000
4
US
I need to have a popup window or application that starts BEFORE the windows logon prompt. I have written a VB appl. that has everything I need in it I'm just not sure if I can have it display before the login prompt or do i have to do a script of some type. HELP HELP HELP.........
 
Check the FAQ area here for ways to modify the registry using VB. The following keys can be used to create a dialog box that will appear prior to logon.

With Win9x:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Winlogon

With NT:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon

Change the data of "LegalNoticeCaption" to whatever caption you want on the dialog box. If the value doesn't exist you'll have to create it.

Change the data in "LegalNoticeText" to whatever message you want the dialoge to convey. The text is limited to 256 characters. NT service pack 6 allows up to 1024 characters.

The changes will require a system reboot.

As always, you are discouraged from modifying the registry by code, especially if it involves somebody else's computer and most certainly if you are not practiced at doing so. Make provisions to restore the registry to its original state when your software is uninstalled.
VCA.gif

Alt255@Vorpalcom.Intranets.com
 
Unfortunetly My boss wants more then the 256K and the message needs to display bullet points which I can't do in the LegalNotice Window. Thats why I wrote a VB app that has it the way she wants it, but I can't figure out how to have it start before the login. But Thanks for the though
 
I hate to be the one to tell you this but modifying the Winlogon key is the best way to pop up a message prior to logon in Windows.

Your only other option (after starting Windows) would be a bit more complex and, possibly, a little dangerous. Place the following code at the module level:
[tt]
Declare Function RegisterServiceProcess Lib "kernel32" (ByVal dwProcessID As Long, ByVal dwType As Long) As Long
Declare Function GetCurrentProcessId Lib "kernel32" () As Long

Sub Main()
Dim Gcpi As Long
Dim RetL As Long
Gcpi = GetCurrentProcessId()
RetL = RegisterServiceProcess(Gcpi, 1)
End Sub
[/tt]

Set the "StartUpPosition" for Form1 to CenterOwner and then write some code to add a value to this registry key:
[tt]HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunServices[/tt]
Add a string value called "MyApp" and set its value to your application path (ie: "C:\MyAppPath\MyApp.exe").

The application will pop up before the network logon dialog but not before the "legal notice" dialog I pointed you toward.

Good luck. I hope you've done this sort of thing before!
VCA.gif

Alt255@Vorpalcom.Intranets.com
 
Oops. Left something out. You'll need to load your StartUp form (my reference to Form1) from SubMain.

You'll have to make sure your app is very stable and that you unload every object before you allow termination. The app won't appear on the task list and you won't be able to shut it down if it becomes unruly.
VCA.gif

Alt255@Vorpalcom.Intranets.com
 
Thanks Alt255 It worked and is working perfectly, thats just what I wanted....
 
Glad I could be of assistance.

VCA.gif

Alt255@Vorpalcom.Intranets.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top