Articles   Members Online:
-Article/Tip Search
-News Group Search over 21 Million news group articles.
-Delphi/Pascal
-CBuilder/C++
-C#Builder/C#
-JBuilder/Java
-Kylix
Member Area
-Home
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Login/Logout
-Become a Member
-Why sign up!
-Newsletter
-Chat Online!
-Indexes NEW!!
Employment
-Build your resume
-Find a job
-Post a job
-Resume Search
Contacts
-Contacts
-Feedbacks
-Link to us
-Privacy/Disclaimer
Embarcadero
Visit Embarcadero
Embarcadero Community
JEDI
Links
How to trap mouse clicks on the Desktop Turn on/off line numbers in source code. Switch to Orginial background IDE or DSP color Comment or reply to this aritlce/tip for discussion. Bookmark this article to my favorite article(s). Print this article
03-Oct-02
Category
System
Language
Delphi 2.x
Views
114
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Jonas Bilinkevicius 

I wonder if anyone can help me. I am trying to capture when the mouse button is 
pressed on the desktop wallpaper (excluding icons if possible).

Answer:

This returns the same handle:

1   function GetDesktopListViewHandle: THandle;
2   var
3     S: string;
4   begin
5     Result := FindWindow('ProgMan', nil);
6     Result := GetWindow(Result, GW_CHILD);
7     Result := GetWindow(Result, GW_CHILD);
8     SetLength(S, 40);
9     GetClassName(Result, PChar(S), 39);
10    if PChar(S) <> 'SysListView32' then
11      Result := 0;
12  end;
13  
14  procedure TForm1.Timer1Timer(Sender: TObject);
15  var
16    CursorPos: TPoint;
17    h: THandle;
18  begin
19    GetCursorPos(CursorPos);
20    h := WindowFromPoint(CursorPos);
21    Label1.Caption := IntToStr(h);
22  end;
23  
24  procedure TForm1.FormShow(Sender: TObject);
25  begin
26    Label2.Caption := IntToStr(GetDesktopListViewHandle); { GetDeskTopWindow); }
27    Timer1.Enabled := True;
28  end;


			
Vote: How useful do you find this Article/Tip?
Bad Excellent
1 2 3 4 5 6 7 8 9 10

 

Advertisement
Share this page
Advertisement
Download from Google

Copyright © Mendozi Enterprises LLC