Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

screensaver

Posted on 1997-11-19
3
229 Views
Last Modified: 2010-04-04
I have written a screensaver in delphi3. It works well, but I have a question.
In the screensaver-configuration-menu under WIN95/NT4.0 is shown a small monitor. How can I show a picture there while my screensaver is configured ?
0
Comment
Question by:titz
  • 2
3 Comments
 
LVL 2

Expert Comment

by:rigansen
ID: 1350999
Are you running out of points ??  :)

I wrote a screensaver in delphi 2.0 which I think should work fine using Delphi3. As there's a general procedure that is called every time you need to deal with the password, there's is one for handling the preview window : ExecPreview.

this code is not exactly mine, can't remember where I took it from...

//This executes the preview window,and goes into a message loop to keep it running
procedure ExecPreview;
var PreviewCanvas:TCanvas;
    WndClass:TWndClass;
    Atom:TAtom;
    DC:hDC;
    MyWnd:hWnd;
    Msg:TMsg;
begin //create a new window class
  PreviewMode:=True;
  with WndClass do begin
    style:=CS_PARENTDC;
    lpfnWndProc:=@MyWndProc;
    cbClsExtra:=0;
    cbWndExtra:=0;
    hIcon:=0;
    hCursor:=0;
    hbrBackground:=0;
    lpszMenuName:=NIL;
    lpszClassName:='Delphi2ScreenSaverPreview';
  end;
  WndClass.hInstance:=hInstance;
  Atom:=Windows.RegisterClass(WndClass);
  //get some info on parent window
  GetWindowRect(ParamHandle, PrevRect);
  PrevRect.Right:=PrevRect.Right-PrevRect.Left;
  PrevRect.Bottom:=PrevRect.Bottom-PrevRect.Top;
  PrevRect.Left:=0;
  PrevRect.Top:=0;
  //and now create the window as child of the window given in ParamHandle
  MyWnd:=CreateWindow('Delphi2ScreenSaverPreview','FunSaver',WS_CHILD or
     WS_DISABLED or WS_VISIBLE,0,0,PrevRect.Right,PrevRect.Bottom,
     ParamHandle,0,hInstance,nil);
  //get the DC for the new created window
  DC:=GetDC(MyWnd);
  PreviewCanvas:=TCanvas.Create;
  PreviewCanvas.Handle:=DC;
  MyThread:=TSaverThread.Create(PreviewCanvas,PrevRect);
  //and now do the message loop, I think I can't use any predifined loop here
  while GetMessage(Msg,0,0,0) do begin
    TranslateMessage(Msg);
    DispatchMessage(Msg);
  end;
  MyThread.Terminate; //I don't care about other resources here, as my app
  PreviewCanvas.Free; //terminates immediately and NT/Win95 cleans up
end;


hope this shows you the way to go...

regards, rigansen.

0
 
LVL 1

Author Comment

by:titz
ID: 1351000
What is about the variable "ParmHandle" ??
Where did you get it from ??

0
 
LVL 2

Accepted Solution

by:
rigansen earned 20 total points
ID: 1351001
I think you should better try this:

http://sunsite.icm.edu.pl/delphi/ftp/d20free/ssav95.zip
http://sunsite.icm.edu.pl/delphi/ftp/d20share/d97saver.zip


hope this helps you out!!

regards, rigansen.
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

Suggested Solutions

Title # Comments Views Activity
Working this component WebCopy with proxy, help 3 92
How to call a form that is in a DLL  from an application? 13 82
update joined tables 2 55
shape, triangle, dbctrlgrid 3 17
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

828 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