Atlanta Custom Software Development 

 
   Search        Code/Page
 

User Login
Email

Password

 

Forgot the Password?
Services
» Web Development
» Maintenance
» Data Integration/BI
» Information Management
Programming
  Database
Automation
OS/Networking
Graphics
Links
Tools
» Regular Expr Tester
» Free Tools

Undocumented dialog box to change screen saver's password
[ All Languages » VB »  Windows]

Total Hit ( 2004)

Rate this article:     Poor     Excellent 

 Submit Your Question/Comment about this article

Rating


 


When you write a screen saver in C and SDK you can use a static library (SCRNSAVE.LIB) that allows you to create custom dialogs to change and request the password. In VB you can't access this library, but if you don't want to create your forms to replace the custom dialogs, you can use a couple of undocumented functions. Unfortunately, these are only available only Windows 95 and 98, but not under Windows NT:

Click here to copy the following block
Declare Sub PwdChangePassword Lib "mpr.dll" Alias "PwdChangePasswordA" (ByVal _
  lpcRegkeyname As String, ByVal hwnd As Long, ByVal uiReserved1 As Long, _
  ByVal uiReserved2 As Long)
Declare Function VerifyScreenSavePwd Lib "password.cpl" (ByVal hwnd As Long) As _
  Boolean

PwdChangePassword is in MPR.DLL, the Multiple Provider Router. It does all the password management associated with Regkeyname, including popping up a dialog box (as a child of the window referred to by the hWnd handle). The two reserved arguments should be zero.
VerifyScreenSavePwd is in PASSWORD.CPL. It pops up a dialog box (as child of hWnd) that prompts for the screen saver's password. If the user enters a wrong password, it prints a message saying so and prompts for it again. If the user presses OK then it returns True; if the user presses Cancel, then it returns False. This is an example of their use:

Click here to copy the following block
Private Sub cmdChange_Click()
   PwdChangePassword "SCRSAVE", Me.hwnd, 0, 0
End Sub

Private Sub cmdTest_Click()
   Dim bRes As Boolean
   bRes = VerifyScreenSavePwd(Me.hwnd)
   MsgBox bRes
End Sub


Submitted By : Nayan Patel  (Member Since : 5/26/2004 12:23:06 PM)

Job Description : He is the moderator of this site and currently working as an independent consultant. He works with VB.net/ASP.net, SQL Server and other MS technologies. He is MCSD.net, MCDBA and MCSE. In his free time he likes to watch funny movies and doing oil painting.
View all (893) submissions by this author  (Birth Date : 7/14/1981 )


Home   |  Comment   |  Contact Us   |  Privacy Policy   |  Terms & Conditions   |  BlogsZappySys

© 2008 BinaryWorld LLC. All rights reserved.