MFC Screen Savers and Password Protection

I am trying to convert one of my old Windows 3.1 screen savers to MFC. I am using MS Visual C/C++ Developer Studio v4.0 and understand the sample screen saver "SAVER" provided with the CD.

My question is this: What do I need to do to make it password protected? I would like a simple piece of code showing me how to add the code to handle passwords in an MFC Windows 95 screen saver.
PalmerjAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

AVaulinCommented:
You don't need to write anywhat to enable password protection because Windows enables/diables it by itself (Control Panel / Display / Screen Saver / Paasword Protected).

But if you want you can add WM_CLOSE message handler to CSaverWnd
class of Saver sample. I can show how to do it if first answer part don't acceptable to you.
PalmerjAuthor Commented:
I compiled the sample MFC screen saver (SAVER.SCR) provided with Visual C/C++ v4.0 - When clicking on the "Change Password" button, the change password dialog never appears. Even when the "password protected" check box is checked, the screen saver is not password protected. Other screen savers function as expected. Obviously, additional code must be inserted in order to enable password protection.

I don't think processing the CLOSE message is enough, since two functions are required; Allowing the password change dialog to show up, an allowing the password entry dialog before shutting down.

Thanks.
davmarcCommented:
Palmerj,
I must agree with AVaulin. Password protection is handled automatically by Windows, not by the screen saver code.
Whatever screen saver you install, you'll configure passwords always the same way.

This is confirmed by the fact that there are not any entry points regarding password protection in the whole screen saver SDK documentation.

Davide Marcato.
Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

PalmerjAuthor Commented:
Please, compile the sample MFC screen saver (SAVER) and see  for yourself. Maybe the sample provided with Visual C/C++ v4.0 has a bug?

If you have the source code for an MFC screen saver that functions with password protection, I would really appreciate it. If you wish, I can send you the source code for SAVER.SCR.

Thank-you for your response.
davmarcCommented:
I think you'll find very useful info about screen saver programming at this site: http://classic.physiol.cam.ac.uk/scr.

In particular, read the paragraphs dedicated to password protection at: http://classic.physiol.cam.ac.uk/scr/SCRB_TEC.HTM#pwdchangepassword
They don't only clearly state that password management is not a problem of the screen saver developer, they also describe which functions do what and which DLL they are contained in.

Have you tried that screen saver on another computer?
If you can't, send me the compiled code at the address davmarc@ashnet.it and I'll try on mine (I don't have VC++ installed on the computer from which I am writing right now).

Davide Marcato.
davmarcCommented:
I tried saver.scr on my PC with Win95 and behaves like yours.
I cannot reply extensively by E-Mail because you didn't write me with a valid From: field in the message! What's your address?

Davide Marcato.
chensuCommented:
davmarc has answered the question. I just would like to make it clearer.

http://classic.physiol.cam.ac.uk/scr/SCRB_TEC.HTM says:
When your screen saver is required to pop up a change-password dialog, it will be invoked in the form
xxx.scr /a
for a dialog as a child of the current foreground window, or
xxx.scr /a ####
for a dialog that's a child of the window whose HWND (in decimal) is given by ####.

Saver does not implement it.

PalmerjAuthor Commented:
I would like to say that I really appreciate all your suggestions. The /a parameter is passed to the screen saver when the "Change password" button is pressed. The sample screen saver SAVER which comes with Microsoft Visual C++ does not handle this, nor does it present a password entry dialog before closing.

In the following url:

http://classic.physiol.cam.ac.uk/scr/SCRB_GEN.HTM#version

It is stated at the very end, (and I quote:)

Security. Windows NT manages all password stuff itself. If the user clicks on the Password button in the display properties control panel, the system manages the change of password itself. When the saver kicks in, it is executed on a different desktop. (This means that your saver will not be able to draw over the top of the user's desktop). (Under Win'95, the saver has to manage all of these things itself. ScrPlus does this all for
you).

End Quote.

Of particular interest is tha last sentence. It is precisely a sample of this necessary logic that I'm looking for.

Thank-you.
davmarcCommented:
Conclusions in brief.
As described in detail in this site dedicated to screen saver programmers:
http://classic.physiol.cam.ac.uk/scr
under Windows NT the system takes care of showing the password protection dialog, instead under Windows 95 it's a developer's responsibility.
More details and samples at the address above.

Davide Marcato.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
PalmerjAuthor Commented:
Although a bit difficult to locate, this site does contain source code sample for implementing password protection on screen savers developed using MFC.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Development

From novice to tech pro — start learning today.