Solved

MFC Screen Savers and Password Protection

Posted on 1997-08-01
10
332 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
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 

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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

zlib is a free compression library (a DLL) on which the popular gzip utility is built.  In this article, we'll see how to use the zlib functions to compress and decompress data in memory; that is, without needing to use a temporary file.  We'll be c…
What my article will show is if you ever had to do processing to a listbox without being able to just select all the items in it. My software Visual Studio 2008 crystal report v11 My issue was I wanted to add crystal report to a form and show…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
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…

777 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