If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Threaded View

Losing control on SetParented form.

Good Day All -

In an attempt to avoid having to use VB6 UserControls embedded into our top
level form, we are using Forms which are loaded into a UserControl called
PRFormContainer.uclFormContainer. Behind the scenes, this control takes the
form reference, and uses the hWnd property to:

* Set the WS_CHILD style on the form so that it becomes a child window (this
means that the top level form does not lose focus when you set focus onto
the contained form).

* SetParent the form to the top level form (ensuring you save the old form's
parent).

* SetWindowPos the form so that it completely fills the UserControl.

This has been working quite nicely up to now, but recently a focus issue
has come up:

After using F1 context help on a text box in the contained form, the help
app appears, but when you go back to the original application, the focus
is now on the first control on the top level window. You have to click once
on the control to activate the top window app, and click once more to get
the control's focus.