Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: VB4/32,VB5,VB6
Expertise: Advanced
Jun 26, 1999

Undocumented dialog box to change screen saver's password

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:

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:


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 
Marco Bellinaso
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date