473,403 Members | 2,183 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

How to Produce MousePreview Effect (like KeyPreview)

I have asked a similar question to this before, but have not found a
satisfactory answer yet, so I thought I would ask it in another way.

KeyPreview, for a form, handily allows keys to be intercepted at form level,
and pre-processed and/or filtered. In the absence of a MousePreview setting,
is there a way to do the same thing for mouse movements and clicks?

TIA

Charles
Nov 20 '05 #1
9 8256
hi Charles

can u be more clear. That is what actually is ur requirement. whether you wanted to do something on your mouse move or stuffs like that

With regards

Sadha Sivam S
Nov 20 '05 #2
AFAIK, the only way to do a mousepreview kind of stuff is to use a System Hook.

This KB may help http://support.microsoft.com/default...;EN-US;Q319524

Rgds,
Anand
VB.NET MVP
http://www.dotnetindia.com

"Charles Law" wrote:
I have asked a similar question to this before, but have not found a
satisfactory answer yet, so I thought I would ask it in another way.

KeyPreview, for a form, handily allows keys to be intercepted at form level,
and pre-processed and/or filtered. In the absence of a MousePreview setting,
is there a way to do the same thing for mouse movements and clicks?

TIA

Charles

Nov 20 '05 #3
Hi Sadha

I want to handle mouse move events and clicks in a user control, so that
they do not reach any of the controls placed on the user control. So,
suppose I have a user control with a button on it, if the user clicks where
the button is I want to be able to intercept the click and use it to draw a
selection border around the button, rather than call the button's click
event.

Charles
"sadha sivam" <sa************@yahoo.com> wrote in message
news:E7**********************************@microsof t.com...
hi Charles,

can u be more clear. That is what actually is ur requirement. whether you wanted to do something on your mouse move or stuffs like that.
With regards,

Sadha Sivam S

Nov 20 '05 #4
Hi Anand

Thanks for the link. It looks like it will do just what I want.

Cheers

Charles
"Anand[MVP}" <An******@discussions.microsoft.com> wrote in message
news:DE**********************************@microsof t.com...
AFAIK, the only way to do a mousepreview kind of stuff is to use a System Hook.
This KB may help http://support.microsoft.com/default...;EN-US;Q319524
Rgds,
Anand
VB.NET MVP
http://www.dotnetindia.com

"Charles Law" wrote:
I have asked a similar question to this before, but have not found a
satisfactory answer yet, so I thought I would ask it in another way.

KeyPreview, for a form, handily allows keys to be intercepted at form level, and pre-processed and/or filtered. In the absence of a MousePreview setting, is there a way to do the same thing for mouse movements and clicks?

TIA

Charles

Nov 20 '05 #5
Hi Anand

I've now had chance to try using a system hook, as described in the article,
but there is a problem. When I insert a hook for an MDI child form, the hook
applies for the entire application, and not just for the child form. I am
effectively getting a preview of mouse events for all forms, and not just
the current form. In this way the effect is different from KeyPreview, which
operates at form level.

Any thoughts?

Charles
"Anand[MVP}" <An******@discussions.microsoft.com> wrote in message
news:DE**********************************@microsof t.com...
AFAIK, the only way to do a mousepreview kind of stuff is to use a System Hook.
This KB may help http://support.microsoft.com/default...;EN-US;Q319524
Rgds,
Anand
VB.NET MVP
http://www.dotnetindia.com

"Charles Law" wrote:
I have asked a similar question to this before, but have not found a
satisfactory answer yet, so I thought I would ask it in another way.

KeyPreview, for a form, handily allows keys to be intercepted at form level, and pre-processed and/or filtered. In the absence of a MousePreview setting, is there a way to do the same thing for mouse movements and clicks?

TIA

Charles

Nov 20 '05 #6
AFAIK a hook is specific to a single thread not a window. One thing you can see if look at the hwnd you recieve and handle events that are specific to your window only. Or if each windows is in a seperate thread, then you can hook into events of that thread alone.

Rgds,
Anand
VB.NET MVP
http://www.dotnetindia.com

"Charles Law" wrote:
Hi Anand

I've now had chance to try using a system hook, as described in the article,
but there is a problem. When I insert a hook for an MDI child form, the hook
applies for the entire application, and not just for the child form. I am
effectively getting a preview of mouse events for all forms, and not just
the current form. In this way the effect is different from KeyPreview, which
operates at form level.

Any thoughts?

Charles
"Anand[MVP}" <An******@discussions.microsoft.com> wrote in message
news:DE**********************************@microsof t.com...
AFAIK, the only way to do a mousepreview kind of stuff is to use a System

Hook.

This KB may help

http://support.microsoft.com/default...;EN-US;Q319524

Rgds,
Anand
VB.NET MVP
http://www.dotnetindia.com

"Charles Law" wrote:
I have asked a similar question to this before, but have not found a
satisfactory answer yet, so I thought I would ask it in another way.

KeyPreview, for a form, handily allows keys to be intercepted at form level, and pre-processed and/or filtered. In the absence of a MousePreview setting, is there a way to do the same thing for mouse movements and clicks?

TIA

Charles


Nov 20 '05 #7
Thanks for the ideas Anand.

Do you know if, having hooked the mouse messages, I can change the message
or redirect it to another window? I can't see anywhere where it says whether
I can modify the MOUSEHOOKSTRUCT structure.

Charles
"Anand[MVP}" <An******@discussions.microsoft.com> wrote in message
news:96**********************************@microsof t.com...
AFAIK a hook is specific to a single thread not a window. One thing you can see if look at the hwnd you recieve and handle events that are specific
to your window only. Or if each windows is in a seperate thread, then you
can hook into events of that thread alone.
Rgds,
Anand
VB.NET MVP
http://www.dotnetindia.com

"Charles Law" wrote:
Hi Anand

I've now had chance to try using a system hook, as described in the article, but there is a problem. When I insert a hook for an MDI child form, the hook applies for the entire application, and not just for the child form. I am effectively getting a preview of mouse events for all forms, and not just the current form. In this way the effect is different from KeyPreview, which operates at form level.

Any thoughts?

Charles
"Anand[MVP}" <An******@discussions.microsoft.com> wrote in message
news:DE**********************************@microsof t.com...
AFAIK, the only way to do a mousepreview kind of stuff is to use a
System Hook.

This KB may help

http://support.microsoft.com/default...;EN-US;Q319524

Rgds,
Anand
VB.NET MVP
http://www.dotnetindia.com

"Charles Law" wrote:

> I have asked a similar question to this before, but have not found a
> satisfactory answer yet, so I thought I would ask it in another way.
>
> KeyPreview, for a form, handily allows keys to be intercepted at
form level,
> and pre-processed and/or filtered. In the absence of a MousePreview

setting,
> is there a way to do the same thing for mouse movements and clicks?
>
> TIA
>
> Charles
>
>
>


Nov 20 '05 #8
I am not sure if you can do that.. You can supress calling the next in chain, due to which that message can be supressed. But I am not sure if you can chage the data, but you can always try..

Rgds,
Anand
VB.NET MVP
http://www.dotnetindia.com

"Charles Law" wrote:
Thanks for the ideas Anand.

Do you know if, having hooked the mouse messages, I can change the message
or redirect it to another window? I can't see anywhere where it says whether
I can modify the MOUSEHOOKSTRUCT structure.

Charles
"Anand[MVP}" <An******@discussions.microsoft.com> wrote in message
news:96**********************************@microsof t.com...
AFAIK a hook is specific to a single thread not a window. One thing you

can see if look at the hwnd you recieve and handle events that are specific
to your window only. Or if each windows is in a seperate thread, then you
can hook into events of that thread alone.

Rgds,
Anand
VB.NET MVP
http://www.dotnetindia.com

"Charles Law" wrote:
Hi Anand

I've now had chance to try using a system hook, as described in the article, but there is a problem. When I insert a hook for an MDI child form, the hook applies for the entire application, and not just for the child form. I am effectively getting a preview of mouse events for all forms, and not just the current form. In this way the effect is different from KeyPreview, which operates at form level.

Any thoughts?

Charles
"Anand[MVP}" <An******@discussions.microsoft.com> wrote in message
news:DE**********************************@microsof t.com...
> AFAIK, the only way to do a mousepreview kind of stuff is to use a System Hook.
>
> This KB may help
http://support.microsoft.com/default...;EN-US;Q319524
>
> Rgds,
> Anand
> VB.NET MVP
> http://www.dotnetindia.com
>
> "Charles Law" wrote:
>
> > I have asked a similar question to this before, but have not found a
> > satisfactory answer yet, so I thought I would ask it in another way.
> >
> > KeyPreview, for a form, handily allows keys to be intercepted at form level,
> > and pre-processed and/or filtered. In the absence of a MousePreview
setting,
> > is there a way to do the same thing for mouse movements and clicks?
> >
> > TIA
> >
> > Charles
> >
> >
> >


Nov 20 '05 #9
Good thinking. I had concluded that I could not change the window handle as
initial attempts proved fruitless.

Thanks.

Charles
"Whatshisname" <an*******@discussions.microsoft.com> wrote in message
news:BA**********************************@microsof t.com...
Charles, you can redirect a message to another window and change it if you like. Use the API's SendMessage or PostMessage. You can just ignore the
caught message and then create your own message and send it to the window of
your choice.
----- Charles Law wrote: -----

Thanks for the ideas Anand.

Do you know if, having hooked the mouse messages, I can change the message or redirect it to another window? I can't see anywhere where it says whether I can modify the MOUSEHOOKSTRUCT structure.

Charles
"Anand[MVP}" <An******@discussions.microsoft.com> wrote in message
news:96**********************************@microsof t.com...
> AFAIK a hook is specific to a single thread not a window. One thing you
can see if look at the hwnd you recieve and handle events that are specific to your window only. Or if each windows is in a seperate thread, then you can hook into events of that thread alone. >> Rgds, > Anand
> VB.NET MVP
> http://www.dotnetindia.com
>> "Charles Law" wrote:
>>> Hi Anand
>>>> I've now had chance to try using a system hook, as described in the article,
>> but there is a problem. When I insert a hook for an MDI child
form, the
hook >> applies for the entire application, and not just for the child
form. I
am >> effectively getting a preview of mouse events for all forms, and
not
just >> the current form. In this way the effect is different from
KeyPreview,
which >> operates at form level.
>>>> Any thoughts?
>>>> Charles
>>>>>> "Anand[MVP}" <An******@discussions.microsoft.com> wrote in
message >> news:DE**********************************@microsof t.com...
>>> AFAIK, the only way to do a mousepreview kind of stuff is to use a
System >> Hook.
>>>>>> This KB may help
>> http://support.microsoft.com/default...;EN-US;Q319524
>>>>>> Rgds,
>>> Anand
>>> VB.NET MVP
>>> http://www.dotnetindia.com
>>>>>> "Charles Law" wrote:
>>>>>>> I have asked a similar question to this before, but have not
found a >>>> satisfactory answer yet, so I thought I would ask it in another way. >>>>>>>> KeyPreview, for a form, handily allows keys to be intercepted at
form >> level,
>>>> and pre-processed and/or filtered. In the absence of a

MousePreview >> setting,
>>>> is there a way to do the same thing for mouse movements and clicks? >>>>>>>> TIA
>>>>>>>> Charles
>>>>>>>>>>>>>>>>>>

Nov 20 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Erik | last post by:
Hi, I want to make an effect like in excel when you fix colums and then you can scroll the rest colums behind the fixed. But I won't or can't do this with frames, so has anybody seen a...
18
by: Luke Skywalker | last post by:
Hi guys, I have to simulate the removing of a file in Windows with Javascript: in other words I drag an image above a layer and the image disappears (like the recycle bin). I know (or better I...
1
by: Bob Alston | last post by:
I need to produce a report like this Color: # % ------ --- --- White 10 20 Black 25 50 other 15 30 ---- ---- Total 50 100
1
by: dgs | last post by:
How to produce a tooltip ? Like one we have in VB as elements attribute. Is there any function for it ?
1
by: Maximiliano | last post by:
Is there any way to handle a fade effect like script.aculo.us but on the server side?. I mean a call a fade effect and i want to know when it finished to raise another server method? I need this...
2
by: AndrewC | last post by:
I am using the Scriptaculous/Prototype libraries to build a project and I really want to have an effect like the mootools download page (http://www.mootools.net/download) where when you mouse over...
1
by: | last post by:
Hi, I would like to have effect like this on my page: When I click the button, the div is showing up and growing to his size (barging other elements). When I click the button second time, div...
4
grandong
by: grandong | last post by:
i want to create custom start menu, i use win7, currently i stuck with create form that look like right side of start menu (also like taskbar, or form caption, something with glass effect), and...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.