Solved

screensaver

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

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
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 …
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

770 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