Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Prevent mousemove Focus on my app

Status
Not open for further replies.

mikemcginty

Programmer
Jul 11, 2002
184
0
0
AU
Hi

My trouble is that on my forms I am using mousemove on frame areas to shift focus. The reason I do this is that as my cursor moves over a button I give it focus and as it shifts off the button onto the frame area, I shift focus off the button. This gives the appearance of a live button.

However my application shells out to start other apps (eg Notepad)

What happens is when I move the cusror over my app to get to the shelled app, my app gets focus again and the shelled app goes behind it. I then have to minimise my app to get to the shelled app.

Is there any way I can disable the mousemove sense on my app once it loses focus to another app but get focus back when I click on it? (note: as there are many frame objects in the code I am not keen to start individually disabling them all)

Thanks in return

Mike
When you call out for help in the darkness, and you hear a voice in return, you're probably just talking to yourself again!
 

Depending upon how you shell out the other program you could minimize yourself until that program is shut down. Once you detect this you would then restore yourself.

Check out ShellExecuteEx API and search this site for "shell wait".

Good Luck

 
Thanks

Not quite the solution I'm after because I can't control how long the user may wait before moving the mouse across my app to get to the shelled app.

I was hoping to somehow disable my programs mousemove until the user clicks on it again to activate it

Mike When you call out for help in the darkness, and you hear a voice in return, you're probably just talking to yourself again!
 
I find SetCapture is very useful for a lot of things dealing with mousemoves. When you shell to another app you could SetCapture SomeInVisibleObject.Hwnd, so that object would suck up all the mousemove events over your form. Seems to me that using this along with some simple logic would solve your problem. Hope that helps...

-thibault
 

You could still use the shell and wait option and use a public boolean variable and check it in your mouse move events...

Set Variable
Shell and wait for program
Program done
ReSet Variable

Good Luck

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top