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, 0End Sub Private Sub cmdTest_Click()     Dim bRes As Boolean     bRes = VerifyScreenSavePwd(Me.hwnd)     MsgBox bResEnd Sub 

Share the Post:
Share on facebook
Share on twitter
Share on linkedin


The Latest

microsoft careers

Top Careers at Microsoft

Microsoft has gained its position as one of the top companies in the world, and Microsoft careers are flourishing. This multinational company is efficiently developing popular software and computers with other consumer electronics. It is a dream come true for so many people to acquire a high paid, high-prestige job

your company's audio

4 Areas of Your Company Where Your Audio Really Matters

Your company probably relies on audio more than you realize. Whether you’re creating a spoken text message to a colleague or giving a speech, you want your audio to shine. Otherwise, you could cause avoidable friction points and potentially hurt your brand reputation. For example, let’s say you create a

chrome os developer mode

How to Turn on Chrome OS Developer Mode

Google’s Chrome OS is a popular operating system that is widely used on Chromebooks and other devices. While it is designed to be simple and user-friendly, there are times when users may want to access additional features and functionality. One way to do this is by turning on Chrome OS