Microsoft KB Archive/117777

{|
 * width="100%"|

Determine Whether VBX Support Is Enabled at Run Time

 * }

Q117777

1.00 1.50 WINDOWS kbprg -- The information in this article applies to: - The Microsoft Foundation Classes (MFC) included with: - Microsoft Visual C++ for Windows, versions 1.0 and 1.5 -- SUMMARY ======= The MFC class library provides support for using VBX controls in a 16-bit Windows-based application. You can call CWinApp::EnableVBX to enable use of VBX controls. You can also determine whether VBX support has been enabled in an MFC program as it is running. This article presents two possible methods of determining whether VBX support has been enabled in applications on MFC, versions 2.0 and 2.5. NOTE: Both of these methods rely on the use of implementation-specific details of MFC, versions 2.0 and 2.5. The techniques presented here are not guaranteed to function correctly in future versions of MFC. MORE INFORMATION ================ Use one of the following methods to determine whether VBX support has been loaded: - Check whether the proxy window class associated with VBX controls has been registered. You can do this by writing a global function that attempts to locate the window class, such as the following: BOOL IsVBXEnabled { WNDCLASS ClsInfo; memset(&ClsInfo,0,sizeof(WNDCLASS)); return ::GetClassInfo(AfxGetInstanceHandle,"VBControl", &ClsInfo); } -or- - Check your class derived from CWinApp to see whether m_lpfnCleanupVBXFiles is non-NULL. If this member is non-NULL, VBX support has been enabled; otherwise, the member is NULL. For example, suppose that CMyApp is the name of your class that is derived from CWinApp. The following member function can be added to check for VBX support: BOOL CMyApp::IsVBXEnabled { return m_lpfnCleanupVBXFiles != NULL; } This function can be called in any part of your program by including the header file for your CWinApp-derived class and using the following: ((CMyApp*)AfxGetApp)->IsVBXEnabled; Additional reference words: kbinf 1.00 1.50 2.00 2.50 EnableVBX KBCategory: kbprg KBSubcategory: MfcVBX

Keywords : kb16bitonly

Issue type :

Technology : kbAudDeveloper kbMFC