Form Subclassing question...I don't want a form to get focus
I have 2 forms.
I do not want one form to get focus.
This can be done by disabling the form...but I don't want to do this and more to the point, I can't do this. I have my reasons.
I am subclassing the form and somehow how have to trap for the "get focus" event.
I think if I ignore this message the form won't get focus...I think
What event is it I'm looking for here? Is there such thing as I a "get focus" event on a form...Hmmmm...It's late and I'm tired.
Re: Form Subclassing question...I don't want a form to get focus
Hmmmmm...not sure.
I am tired and should have explained exactly what I wanted to do sorry, my bad
I have a form, form1...and I have a picture box on this form.
I am using the SetParent API command to place form2 inside the picturebox on form1. Standard stuff, we've all seen it before.
What I would like...and I am not sure if this is possible, but I would like a control on form2 to get focus but I would form1 to keep focus.
Re: Form Subclassing question...I don't want a form to get focus
Originally Posted by Wokawidget
... Am I taking rubbish ...
I don't think so ...
I recently noticed kind of weird SourceSafe behaviour: while running project in IDE main form looses focus but all controls are accessible but you'll need to single click twice on each to set focus ... So maybe you want incorporate SS in your exe, eh ...
But seriously, I'm afraid you're taking a little too far though.
Re: Form Subclassing question...I don't want a form to get focus
I would like a control on form2 to get focus but I would form1 to keep focus
Do you really mean focus? Only one Window/Control can have focus at a time.
Are you saying you want all mouse and keyboard input to go to two things at once?
Re: Form Subclassing question...I don't want a form to get focus
You do nothing more that passing focus back to Form1 - that is what I suggested in my very first reply ...
What you are after, Woka, requires system wide hook and not just simple subclassing.
I recommend you to visit vbaccelerator and download what Steve Mac calls journal - some serious sample project that requires lots of attention. I don't want to describe what is does but you'll figure it out.
Re: Form Subclassing question...I don't want a form to get focus
Yea...I added in SetFocus after your post
Ahhh poo sticks
That's what I was afraid of.
I suppose I could code round the controls issue...they were't in my agenda anyways. It was just that if you click form2 fast then u can see a flciker when form1 loses focus. That's what I want to get rid of...but I can't disable the form.
Re: Form Subclassing question...I don't want a form to get focus
I am going to combine it with my "multithreading" code and produce a usercontrol that runs entirely in another "thread"...including the graphix rendering. Regardless of what your UI is doing the usercontrol will ALWAYS refresh itself...unless IT crashes that is
So the form in the pic box will be a form in another process.
Re: Form Subclassing question...I don't want a form to get focus
I'm not sure what a system-wide Journal hook is going to do for you.
You can, however, set a thread-specific CBT hook which processes HCBT_SETFOCUS messages. You can prevent the focus from changing to another control on your form, by returning a non-zero value when this message is received.