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

ActiveX OCX cannot be open form non-modal.

0 views
Skip to first unread message

Marcem

unread,
Apr 11, 2003, 5:18:36 PM4/11/03
to
Hello Guys, do you fine?

Well, i have a problem with an ActiveX OCX.

I have an OCX and this open a form non-modal on the Internet Explorer, and
the app generate an strange error:

Non-modal forms cannot be displayed in this host application from an
ActiveX DLL (Error 406)

I need open this form in non-modal model, but i dont want this control
compiled in ActiveX Exe.

Any solution?

Regards and sorry for my bad english.

Flávio

Ken Halter

unread,
Apr 11, 2003, 5:48:54 PM4/11/03
to
You'll need to replace any calls to VBs Show method with calls to the ShowWindow API
instead.

Add this to the form you want to show (you can drop in a bas module if you want but it's
convenient to have it in the form itself)
'=======================Form2 here
Option Explicit

Public Enum ShowWinStates
SW_HIDE = 0
SW_SHOWNORMAL = 1
SW_NORMAL = 1
SW_SHOWMINIMIZED = 2
SW_SHOWMAXIMIZED = 3
SW_MAXIMIZE = 3
SW_SHOWNOACTIVATE = 4
SW_SHOW = 5
SW_MINIMIZE = 6
SW_SHOWMINNOACTIVE = 7
SW_SHOWNA = 8
SW_RESTORE = 9
SW_SHOWDEFAULT = 10
SW_FORCEMINIMIZE = 11
SW_MAX = 11
End Enum

Private Declare Function ShowWindow Lib "user32" _
(ByVal hWnd As Long, ByVal nCmdShow As Long) As Long

Public Sub ShowForm(State As ShowWinStates)
Call ShowWindow(Me.hWnd, State)
End Sub
'=======================

...and then, to use it, do something like....
'=========
Private Sub Command1_Click()
Call Form2.ShowForm(SW_SHOWMAXIMIZED)
End Sub
'=========

--
Ken Halter - MS-MVP-VB - http://www.mvps.org/vbsight - Please keep it in the groups..


"Marcem" <mont...@terra.com.br> wrote in message
news:u5c#t$GADHA...@TK2MSFTNGP10.phx.gbl...

Ken Halter

unread,
Apr 11, 2003, 5:59:15 PM4/11/03
to
I guess I could've posted a link to some info on why it doesn't work..... The title's
misleading but the "Cause" section is valid.

PRB: Modeless Forms in VB ActiveX DLL's Don't Display in VC++ Clients
http://support.microsoft.com/default.aspx?scid=kb;en-us;247791

Marcem

unread,
Apr 11, 2003, 6:50:40 PM4/11/03
to
Thank you very much Ken

It works. You'll go to heaven.

I hope, you can understand what I mean.

Thanks Thanks Thanks


"Ken Halter" <Ken_Halter@Use_Sparingly_Hotmail.com> escreveu na mensagem
news:ODqKZWHA...@TK2MSFTNGP12.phx.gbl...

Ken Halter

unread,
Apr 14, 2003, 2:23:57 PM4/14/03
to
"Marcem" <mont...@terra.com.br> wrote in message
news:O1xzIzHA...@TK2MSFTNGP10.phx.gbl...

> Thank you very much Ken
>
> It works. You'll go to heaven.

Whew!.... That's a load off of my mind. I was starting to get worried ;-)

> I hope, you can understand what I mean.

Just kidding <g>

> Thanks Thanks Thanks

You're welcome! :-)

0 new messages