PRB: Modeless Forms in VB ActiveX DLL's Don't Display in VC++ Clients (247791)
The information in this article applies to:
- Microsoft Visual C++, 32-bit Professional Edition 5.0
- Microsoft Visual C++, 32-bit Professional Edition 6.0
- Microsoft Visual Basic Professional Edition for Windows 5.0
- Microsoft Visual Basic Professional Edition for Windows 6.0
This article was previously published under Q247791 SYMPTOMS
Modeless forms in Visual Basic ActiveX DLLs do not display in a Visual C++ application. Instead, a dialog box comes up informing the user that the client doesn't support Modeless Forms.
CAUSE
In order to work properly, a Visual Basic modeless form requires access to the message loop of the client application. This access is provided by a COM object known as the Component Manager, which is integrated directly into the message loop of the client application. In order to determine if the client supports modeless forms, Visual Basic gets a reference to the message filter for the application, and calls IUnknown::QueryInterface for the Component Manager's primary interface. If this works, modeless forms can be supported. If it fails, the client cannot support modeless forms.
RESOLUTION
To allow in-process components to detect at run time whether a client application supports the display of modeless forms, Visual Basic provides the Boolean NonModalAllowed property of the App object.
An in-process component should test this property before showing a modeless form. If the value is True, the form can be shown vbModeless. If the value is False, showing a modeless form causes run-time error 369. The component should degrade gracefully by showing the form vbModal instead.
For example:
If App.NonModalAllowed Then
Form1.Show vbModeless
Else
Form1.Show vbModal
EndIf
STATUS
This behavior is by design.
REFERENCES
For additional information about Visual Basic Modeless Forms, please click the article number(s) below to view the article(s) in the Microsoft Knowledge Base:
171978 Non-Modal Forms Support in Visual Basic DLLs
Modification Type: | Major | Last Reviewed: | 1/6/2004 |
---|
Keywords: | kbprb KB247791 |
---|
|