Solved

screensaver

Posted on 1997-11-19
3
227 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

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…
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 video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

864 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

18 Experts available now in Live!

Get 1:1 Help Now