Solved

MFC Screen Savers and Password Protection

Posted on 1997-08-01
10
333 Views
Last Modified: 2013-12-03
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.
0
Comment
Question by:Palmerj
10 Comments
 
LVL 4

Expert Comment

by:AVaulin
ID: 1402737
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.
0
 

Author Comment

by:Palmerj
ID: 1402738
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.
0
 
LVL 4

Expert Comment

by:davmarc
ID: 1402739
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.
0
Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

 

Author Comment

by:Palmerj
ID: 1402740
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.
0
 
LVL 4

Expert Comment

by:davmarc
ID: 1402741
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.
0
 
LVL 4

Expert Comment

by:davmarc
ID: 1402742
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.
0
 
LVL 23

Expert Comment

by:chensu
ID: 1402743
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.

0
 

Author Comment

by:Palmerj
ID: 1402744
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.
0
 
LVL 4

Accepted Solution

by:
davmarc earned 100 total points
ID: 1402745
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.
0
 

Author Comment

by:Palmerj
ID: 1402746
Although a bit difficult to locate, this site does contain source code sample for implementing password protection on screen savers developed using MFC.
0

Featured Post

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows a few slightly more advanced techniques for Windows 7 gadget programming, including how to save and restore user settings for your gadget and how to populate the "details" panel that is displayed in the Windows 7 gadget gallery.  …
As more and more people are shifting to the latest .Net frameworks, the windows presentation framework is gaining importance by the day. Many people are now turning to WPF controls to provide a rich user experience. I have been using WPF controls fo…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question