BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Detect double click on open desktop

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Native API)
View previous topic :: View next topic  
Author Message
DeKayA@bellsouth.net
Guest





PostPosted: Wed Aug 24, 2005 1:05 pm    Post subject: Detect double click on open desktop Reply with quote



Is it possible to detect where on the open desktop a user double
clicks and if there is NO Icon under it?

I think there is some sort of list of desktop items, but I also need
to know their parameters (Top Left, Bottom Right of associated Icon
AREA) To make sure I am in the clear when I double click.

I wish to do something when the user double clicks on a clear area of
the desktop, but do nothing when they activate a valid icon.

I know this is a relatively simple one for all you experienced
windows programmers, but any kind of example would be appreciated.

Thanks
Dekaya
Back to top
tinyabs
Guest





PostPosted: Wed Aug 24, 2005 4:35 pm    Post subject: Re: Detect double click on open desktop Reply with quote



Desktop has a handle of 0 (GetDC() == 0). You can install hooks to capture
events.


Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Wed Aug 24, 2005 5:11 pm    Post subject: Re: Detect double click on open desktop Reply with quote




"tinyabs" <nospam (AT) me (DOT) com> wrote


Quote:
Desktop has a handle of 0

No, it does not. It has its own handle like any other window. The Win32
API has a GetDesktopWindow() function to retreive that handle.

Quote:
(GetDC() == 0).

That is a Device Context (aka canvas), not a window handle.


Gambit



Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Wed Aug 24, 2005 5:13 pm    Post subject: Re: Detect double click on open desktop Reply with quote


<DeKayA (AT) bellsouth (DOT) net> wrote


Quote:
Is it possible to detect where on the open desktop a
user double clicks and if there is NO Icon under it?

You need to use a global mouse hook via SetWindowsHookEx() in order to do
that. Global hooks must be placed in a DLL. The hook can use
WindowFromPoint() to detect when the mouse is not over any window other than
the Desktop. Using the GetDestktopWindow() function to get the Desktop's
window handle, you can then issue standard ListView messages to it in order
to get the hit-test and icon information as needed.


Gambit



Back to top
tinyabs
Guest





PostPosted: Thu Aug 25, 2005 5:55 am    Post subject: Re: Detect double click on open desktop Reply with quote

Sorry my mistake. What window has handle (0)?


Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Thu Aug 25, 2005 6:23 am    Post subject: Re: Detect double click on open desktop Reply with quote


"tinyabs" <nospam (AT) me (DOT) com> wrote


Quote:
What window has handle (0)?

None. 0 is the same as a NULL handle, ie no window at all.


Gambit



Back to top
tinyabs
Guest





PostPosted: Thu Aug 25, 2005 8:28 am    Post subject: Re: Detect double click on open desktop Reply with quote

Found this in MSDN. GetDC(0) is a special case.

HDC GetDC(HWND hWnd );
hWnd
[in] Handle to the window whose DC is to be retrieved. If this value is
NULL, GetDC retrieves the DC for the entire screen.

"Remy Lebeau (TeamB)" <no.spam (AT) no (DOT) spam.com> wrote

Quote:

"tinyabs" <nospam (AT) me (DOT) com> wrote in message
news:430d5d5b (AT) newsgroups (DOT) borland.com...

What window has handle (0)?

None. 0 is the same as a NULL handle, ie no window at all.


Gambit





Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Native API) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.