Solved

screensaver

Posted on 1997-11-19
3
226 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
Comment Utility
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
Comment Utility
What is about the variable "ParmHandle" ??
Where did you get it from ??

0
 
LVL 2

Accepted Solution

by:
rigansen earned 20 total points
Comment Utility
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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

762 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now