Microsoft KB Archive/293100

= PRB: Plug-in Fails to Load in Internet Explorer If It Is Compiled with UNICODE Flag =

Article ID: 293100

Article Last Modified on 11/5/2003

-

APPLIES TO


 * Microsoft Internet Explorer 5.5

-



This article was previously published under Q293100



SYMPTOMS
When you use the Netscape Plug-in Software Development Kit (SDK) to implement a plug-in, if you compile the plug-in with the _UNICODE flag for globalization purposes, you receive the following error message in Internet Explorer:

An error occurred in this plugin.

This problem does not occur when you compile the plug-in normally (or with the _MBCS flag).



CAUSE
The sample plug-in code that Netscape provides does not use the CallWindowProc function to call the default WNDPROC for the plug-in window; the sample code just calls the function pointer that the SetWindowLong function returns directly. This causes an exception (which Internet Explorer handles) because, in a Unicode build, SetWindowLong does not return a function pointer but returns a special handle that CallWindowProc translates into a WNDPROC address.

This is a bug in the Netscape Plug-in SDK sample code.



RESOLUTION
The following code is incorrect in the Plug-in WNDPROC code: This->fDefaultWindowProc(hWnd, Msg, wParam, lParam); To resolve this problem, modify the code as follows: CallWindowProc(This->fDefaultWindowProc, hWnd, Msg, wParam, lParam); This problem may not apply to all versions of the samples from Netscape. Because the sample is from a third-party Web site, it may change, and you may encounter problems that this article does not resolve. The sample inside winNPSDK.zip (2.25MB, last modified October 21, 1997) does not exhibit this problem.



Steps to Reproduce Behavior
 Download the Netscape SDK zipped files from the following Netscape Web site:

http://home.netscape.com/comprod/development_partners/plugin_api/index.html

 Unzip the files, and open Simple.mdp in the PluginSDK\Examples\Simple\Windows folder. In Visual C++ version 6.0 or later, convert the project into .dsw format. Delete the following files from the Source folder:  Npsimple.c Stubs.c</li> Npwin.cpp</li></ul>

</li> Add the following files to the Source folder: <ul> Npsimple.c (from PluginSDK\Examples\Simple\Source)</li> Stubs.c (from PluginSDK\Examples\Simple\Source)</li> Npwin.cpp (from PluginSDK\Examples\Common)</li></ul>

</li> In the project settings, insert the _UNICODE flag into preprocessor definitions.</li> From the Build menu, click Rebuild all to rebuild all the components.</li> Put the compiled DLL into the Plug-in directory of the Program Files\Internet Explorer\Plugins folder.</li> Open the HTML file in PluginSDK\Examples\Simple\Testing to load the plug-in. After the page loads, you receive the above-mentioned error message.</li></ol>

NOTE: Plug-ins draw (and do everything else) by calling SetWindowLong to subclass the HWND that they are passed through the NPP_SetWindow function.

The third-party products that are discussed in this article are manufactured by companies that are independent of Microsoft. Microsoft makes no warranty, implied or otherwise, regarding the performance or reliability of these products.

Microsoft provides third-party contact information to help you find technical support. This contact information may change without notice. Microsoft does not guarantee the accuracy of this third-party contact information.

Keywords: kbprb KB293100

-

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

© Microsoft Corporation. All rights reserved.