Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Making a VB-Form Modal to a known hWnd ?

229 views
Skip to first unread message

Marlon Chen

unread,
Apr 11, 2006, 10:04:59 AM4/11/06
to
I have the same problem, too. I have a project at work that needs to
make owner and parent window of a VB6 form to a known HWND.

I have tried to call Win32 API SetParent, then send a WM_CHANGEUISTATE
message to the new parent, but the parent of the VB6 form remains NULL.

Has anyone been successful doing that?

Marlon


Magnus Lindström wrote:
> I have made a function in a Visual C++ DLL which shows a modified
> Common Dialog (Save File) with an additional button.
> When this button is pressed I call a VB function which looks something
> like this:
>
> Public Sub CallbackSaveFileDlg(hWnd As Long)
> 'hWnd is the hWnd of the common dialog which still is visible
> frmOptions.Show vbModal 'TODO add [OwnerForm]
> End Sub
>
> I sure would like to put something derived from hWnd as the [OwnerForm].
>
> Any ideas ?
> Anyone tried to change a common dialog in pure VB ?
>
> --
> Magnus Lindstrom

Juergen Thuemmler

unread,
Apr 11, 2006, 2:10:42 PM4/11/06
to

Marlon Chen

unread,
Apr 12, 2006, 10:23:14 AM4/12/06
to
Thanks a lot, Dr. Thuemmler. DSModal is really amazing!

I still have some questions. When I use Spy++ to look up the
properties of the sample dialog (after I click "Make me modal to
Notepad" button), the parent window of it is NULL and owner is
ThunderRT5Main (the VB5 runtime window).

I am not sure if it is possible or pratical to change the owner window.
I am wondering if we can change the parent.

I didn't want to make my question lengthy at first, but I guess I
misled you. We have an ActiveX document application written in C++,
which has an add-in framework to load DLLs at run-time. Among those
add-ins, some are writen in C++, some are in VB6. Now we have a
problem with some modal dialog boxes. The problem is when opening the
ActiveX document app in IE, some modal dialogs can appear behind the
browser. (like the upgrade window in Adobe Arobat reader).

What we have found out is IE cannot manage modal behavior very well
without the parent of modal dialog being set to IE - the container.

I found IE handles following dialog boxes OK:
- CDialog::DoModal()
- AfxMessageBox(...)

While it doesn't handle modal behavor well with all VB modal forms.

Any ideas?

Juergen Thuemmler

unread,
Apr 12, 2006, 11:12:56 AM4/12/06
to
> problem with some modal dialog boxes. The problem is when opening the
> ActiveX document app in IE, some modal dialogs can appear behind the
> browser. (like the upgrade window in Adobe Arobat reader).
>
> What we have found out is IE cannot manage modal behavior very well
> without the parent of modal dialog being set to IE - the container.
>
> Any ideas?

Did you try
Call SetWindowLong(hwndOwned, GWL_HWNDPARENT, hwndOwner)
which makes an ownership between both of the windows which also causes the
owned window to be on top of the owner and to disappear/appear when the
owner will be minimized/restored?

Juergen.


Marlon Chen

unread,
Apr 13, 2006, 11:31:36 AM4/13/06
to
Thanks a lot. That is exactly what I was looking for.

Cobalt

unread,
Apr 24, 2006, 2:54:10 AM4/24/06
to
Thank you so much.
The same question has already puzzled me for a long time.It's done just in
such a easy way.
Thanks again.

--
────────────────────────
Bridge Eng.,Tongji Univ.,Shanghai,PRC
Cobalt
E-mail:xiaoso...@263.net
────────────────────────
"Juergen Thuemmler" <th...@removethisgmx.de> 写入消息新闻:%23sdYOPk...@TK2MSFTNGP03.phx.gbl...

0 new messages