| View previous topic :: View next topic |
| Author |
Message |
DeKayA@bellsouth.net Guest
|
Posted: Wed Aug 24, 2005 1:05 pm Post subject: Detect double click on open desktop |
|
|
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
|
Posted: Wed Aug 24, 2005 4:35 pm Post subject: Re: Detect double click on open desktop |
|
|
Desktop has a handle of 0 (GetDC() == 0). You can install hooks to capture
events.
|
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Wed Aug 24, 2005 5:11 pm Post subject: Re: Detect double click on open desktop |
|
|
"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.
That is a Device Context (aka canvas), not a window handle.
Gambit
|
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Wed Aug 24, 2005 5:13 pm Post subject: Re: Detect double click on open desktop |
|
|
<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
|
Posted: Thu Aug 25, 2005 5:55 am Post subject: Re: Detect double click on open desktop |
|
|
Sorry my mistake. What window has handle (0)?
|
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Thu Aug 25, 2005 6:23 am Post subject: Re: Detect double click on open desktop |
|
|
"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
|
Posted: Thu Aug 25, 2005 8:28 am Post subject: Re: Detect double click on open desktop |
|
|
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 |
|
 |
|