Microsoft KB Archive/318706

= FIX: Cannot Implement Office Add-in IDTExtensibility2 Interface =

Article ID: 318706

Article Last Modified on 4/3/2002

-

APPLIES TO


 * Microsoft Visual FoxPro 7.0 Professional Edition

-



This article was previously published under Q318706



SYMPTOMS
When you try to create a single-threaded dynamic-link library (DLL) or multi-threaded DLL that implements the Office Add-in IDTExtensibility2 Interface, the resulting .dll file or .exe file does not contain the IDTExtensibility2 interface.



RESOLUTION
To resolve this problem, obtain the latest service pack for Visual FoxPro for Windows 7.0. For additional information, click the following article number to view the article in the Microsoft Knowledge Base:

316964 How to Obtain the Latest Visual FoxPro for Windows 7.0 Service Pack



STATUS
Microsoft has confirmed that this is a problem in Microsoft Visual FoxPro for Windows 7.0.

This problem was first corrected in Visual FoxPro for Windows 7.0 Service Pack 1.



Steps to Reproduce the Behavior
On a computer with Visual FoxPro 7.0 and Microsoft Office 2000 or later installed, follow these steps:  On the Tools menu, click Object Browser. In the Object Browser, click Options, and then click to select all of the options under Display Options. Close the Object Browser.  Paste the following code in a program (.prg) file named Test, and then run the program from the Command window:

NOTE: Change the path to include Msaddndr.dll file if necessary. RELEASE ALL CLEAR ALL DELETE FILE testxx.*

CREATE PROJECT testxx NOWAIT TEXT TO lcText NOSHOW x = NEWOBJECT(&quot;myclass&quot;)

DEFINE CLASS myclass AS session OLEPUBLIC

IMPLEMENTS IDTExtensibility2 IN &quot;C:\program files\common files\designer\msaddndr.dll&quot;

PROCEDURE IDTExtensibility2_OnConnection(_Application AS VARIANT, ConnectMode AS VARIANT, AddInInst AS VARIANT, custom AS VARIANT) AS VOID * Add user code here. ENDPROC

PROCEDURE IDTExtensibility2_OnDisconnection(RemoveMode AS VARIANT, custom AS VARIANT) AS VOID * Add user code here. ENDPROC

PROCEDURE IDTExtensibility2_OnAddInsUpdate(custom AS VARIANT) AS VOID * Add user code here. ENDPROC

PROCEDURE IDTExtensibility2_OnStartupComplete(custom AS VARIANT) AS VOID * Add user code here. ENDPROC

PROCEDURE IDTExtensibility2_OnBeginShutdown(custom AS VARIANT) AS VOID * Add user code here. ENDPROC ENDDEFINE ENDTEXT

STRTOFILE(lcText,'testxx.prg',0) _VFP.ACTIVEPROJECT.FILES.ADD('testxx.prg') _VFP.ACTIVEPROJECT.BUILD('testxx.dll',4) _VFP.ACTIVEPROJECT.CLOSE

DO (_OBJECTBROWSER) _oobjectbrowser.loadtypelib(SET(&quot;Default&quot;)+CURDIR+'testxx.dll')

RETURN 

If you run the example code in Visual FoxPro 7.0, you receive the following error message:

An error occured loading the requested type library!

The selected file is either invalid or not a type library.

If you try to manually build the project by using the Project Manager or by using the BUILD command, you receive the following error message:

Unknown error

If you run the code in Visual FoxPro 7.0 Service Pack 1, no error occurs.

To view the IDTExtensibility2 interface in Visual FoxPro 7.0 Service Pack 1, follow these steps:
 * 1) Expand the Classes node in the left pane of the Object Browser.
 * 2) Select myclass, and observe that the IDTExtensibility2 interface appears in the right pane under Interfaces.

To clean up the registry entries for the .dll that is created in this reproduction, follow these steps:  From Visual FoxPro, use the change directory (CD) command to change to the directory that contains Testxx.dll.</li>  Paste the following code in a .prg file, and then run the program from the Command window: DECLARE INTEGER DllUnregisterServer IN TESTXX.DLL ? DLLUnregisterServer CLEAR DLLS A 0 appears, indicating that the registry entries for the DLL have been removed. </li></ol>

Keywords: kbbug kbfix kbvfp700sp1fix kbcodesnippet KB318706

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.