?
Solved

How to get the cursor to hide and show as in Windows Media Player?

Posted on 2003-02-26
7
Medium Priority
?
235 Views
Last Modified: 2010-04-04
Hi...

I want to know how it's possible to hide the cursor, show it when the mouse is moved for 3 seconds and then hide it again. Exactly as in the Windows Media Player Full screen mode...

thanks in advance,
Kees van Bemmel.
0
Comment
Question by:wim11
[X]
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
7 Comments
 
LVL 4

Accepted Solution

by:
cjm30305 earned 300 total points
ID: 8027990
Create a form with a button on it.  Do not name anything and copy this code into your Unit file.  The single button will inherit the default property when you click the enter key.  Cheers mate.

// Begin code..
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure FormShow(Sender: TObject);
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
    Mouse: TCursor;
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.FormShow(Sender: TObject);
begin
  Form1.WindowState := wsMaximized;
  Mouse := Screen.Cursor;
  Screen.Cursor := crNone;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  Screen.Cursor := Mouse;
end;

end.
// EOF
0
 
LVL 1

Expert Comment

by:keashF
ID: 8028037
use the Windows API function

showcursor( show : boolean )

to show or hide the mouse cursor.

what you do next depends on where you want to track the mouse cursor:

*) on one of your forms you can use the onmousemove event and use gettickcount (returns the number of milliseconds the computer is running) to save the time. perhaps a timer will also do it...

*) if you ant to capture the mouse input systemwide you'll have to install a mouse hook using SetWindowsHookEx there are already threads about how to do this...

cu
keashF
0
 
LVL 4

Expert Comment

by:cjm30305
ID: 8028039
Sorry here you go mate.  Add a timer instead of a button.

// Begin code...
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, ExtCtrls;

type
  TForm1 = class(TForm)
    Timer1: TTimer;
    procedure FormShow(Sender: TObject);
    procedure FormMouseMove(Sender: TObject; Shift: TShiftState; X,
      Y: Integer);
    procedure Timer1Timer(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
    Mouse: TCursor;
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.FormShow(Sender: TObject);
begin
  Form1.WindowState := wsMaximized;
  Mouse := Screen.Cursor;
  Screen.Cursor := crNone;
end;

procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
begin
  Screen.Cursor := Mouse;
  Timer1.Interval := 3000;
  Timer1.Enabled := True;
end;

procedure TForm1.Timer1Timer(Sender: TObject);
begin
  Timer1.Enabled := False;
  Screen.Cursor := crNone;
end;

end.

// EOF

0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Expert Comment

by:luisseixas
ID: 8028712
 Place a timer on your form.
  Every time the mouse moves, make time=0 and cursor:=YourCursor;
  When times=3000 (means your mouse doesn't move for 3 seconds), make cursor:=crNone;
0
 

Expert Comment

by:CleanupPing
ID: 9317050
wim11:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0
 
LVL 10

Expert Comment

by:kacor
ID: 9981542
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area for this question:
       to accept cjm30305's answer
Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

Some days and here is the Christmas Time. I wish good luck and good health for you all and for your loved ones

kacor
EE Cleanup Volunteer
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Suggested Courses
Course of the Month12 days, left to enroll

752 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