filename of DLL
must start with "np" (not "ns") and ends with ".dll" (I wasted hours on this - repeatedly)
reflects the data type handled by the plugin. this is how webpages invoke your plugin. should either be like "application/x-vnd-yourorganization-yourfiletype" or be officially registered with IANA (unlikely) or be a standard type (e.g. if you want to play MPEG files).
reflects the data type handled by the plugin, esp. when loaded from local disk on Windows.
Create a new project in Visual Studio for a Win32 GUI library (DLL) (in .NET 2003: Win32 template, then switch to DLL in Application Settings in the following dialog, export symbols too?)(in Visual Studio 2008, it is Visualc++|Win32|Win32 Project, then check DLL in the wizard).
If a wizard gives you a checkbox to create an empty project, then check it. Otherwise you'll delete files later.
Again note that the resulting DLL filename must start with "np", so either call your project like this or rename the file later
Delete the .cpp and .h and ReadMe files from the project and disk (if you did not create an empty project)
Add the NPAPI SDK include path (example : C:\npapi-sdk\headers) to Project Properties|(all configurations)|C++|General|Additional Include Directories. Note: If your project is still empty, the C++ tree might not be visible. So, add some files first.
Add the following preprocessor definitions to Project Properties|(all configurations)|C++|Preprocessor|Preprocessor Definitions:WIN32;_WINDOWS;XP_WIN32;XP_WIN;_X86_;NPSIMPLE_EXPORTS
Disable precompiled headers using Project Properties|(all configurations)|C++|Precompiled headers|Create/Use precompiled header. They may be already disabled.
Define the function exports by adding the .def filename (e.g. nprt.def) to Project Properties|(all configurations)|Linker|Input|Module Definition File. It could be either the full path or the path relative to the project directory.
Optional: Open the above .def file and change "NPRT" to the filename of your dll as VS sees it (without "np", if you decided to rename later)
Optional: Edit the .rc file and and the top of npp_gate.cpp for the description, mimetype, file extension etc. to reflect your plugin
Remove the function NPP_GetJavaClass from npp_gate.cpp
Rename the resulting DLL so that the filename starts with "np" and ends with ".dll" (or "32.dll"? 8.3?) and copy it in Mozilla's "plugins" folder
Start Mozilla and open about:plugins to verify the plugin is detected
Open the file "test.html" and begin testing. Make sure the mimetypes of your html embed tags match the mimetype specified in your nprt.rc file and the top of your npp_gate.cpp file
If VC++ compiler throws you error C2664 on 'DrawText' function call, you may replace it by 'DrawTextA'. In fact, all win32 API functions dealing with character strings can be added an 'A' to the end to avoid unicode cast errors.
Visual C++ 2008 Express don't support C99 standard about int32_t, uint32_t. You have to add #include "nptypes.h" in top of plugin.h file.
Feel free to append here your issues fixes if the above guide helped you.
Thanks! Please check your inbox to confirm your subscription.
If you haven’t previously confirmed a subscription to a Mozilla-related newsletter you may have to do so. Please check your inbox or your spam filter for an email from us.
Why does MDN look different?
MDN is changing to focus just on documenting web technologies. All the same great content is still here; we’re just changing some visual elements and navigation, to help you more quickly find the web technology docs you’re looking for.
But don’t worry, MDN and Mozilla are still together! In fact, we're updating MDN’s look to reflect Mozilla's new logo and colors.