Notes for making Firefox Plugin

Source: Internet
Author: User
Production
Firefox
Notes for plugin

1)
The DLL file must start
Start with NP (case-insensitive). It is best to follow
8.3 format (current
Firefox does not have this restriction). For example
Npnul32.dll.

2)

When creating a project, it is best to create an empty
DLL project. Otherwise, you must manually delete them and modify them.
Some VC settings are troublesome and not recommended. The project name is recommended
NP headers, removing the need to modify and generate
NP Headers
All settings of the DLL file.

3)

You must add

 
Mozilla_strict_api

 
Xp_win

 
Xp_win32

Three macros.

4) if you use
* If the. Def file defines interface functions
Library item. The Library name must be the same as the final
The DLL file name is consistent, for example
Npnul32. The general format is as follows:

Library
Npnul32

 

Exports


Np_getentrypoints
@ 1


Np_initialize
@ 2


Np_shutdown
@ 3

 

5)

Resource file creation.

A) must be added
Mimetype, for example:
Value
"Mimetype", "application/X-Java-applet ".

B) It is best to add
Fileextents, for example
Value
"Fileextents", "pdf ".

C) the best language is English. If it is Chinese
DLL is very large.

D)
All fileflagsmask items can be considered
Enabled to avoid unnecessary troubles, such
Fileflagsmask
0x3fl

E) In resource files, do not use
Afxres. H, used
Replace winresrc. h; otherwise, it is possible to generate
DLL
Firefox does not know.

The following is
RC file (I manually changed the standard
Produced by vc2005
In the version file, some annotations are not modified, so they may be incorrect, for example,"
Chinese (P. R. C.) Resources "). For more information, see.

// Microsoft Visual C ++
Generated resource script.

//

# Include
"Resource. H"

 

# Define
Apstudio_readonly_symbols

//////////////////////////////////////// /////////////////////////////////////

//

// Generated from
Textinclude 2 resource.

//

# Include
"Winresrc. H"

 

//////////////////////////////////////// /////////////////////////////////////

# UNDEF
Apstudio_readonly_symbols

 

//////////////////////////////////////// /////////////////////////////////////

// Chinese (P. R. C.) Resources

 

# If
! Defined (afx_resource_dll) | defined (afx_targ_chs)

# Ifdef _ Win32

Language lang_english,
Sublang_english_us

# Pragma code_page (1252)

# Endif // _ Win32

 

# Ifdef apstudio_invoked

//////////////////////////////////////// /////////////////////////////////////

//

// Textinclude

//

 

1 textinclude

Begin


"Resource. h/0"

End

 

2 textinclude

Begin


"# Include
"" Winresrc. H ""/R/N"


"/0"

End

 

3 textinclude

Begin


"/R/N"


"/0"

End

 

# Endif
// Apstudio_invoked

 

 

//////////////////////////////////////// /////////////////////////////////////

//

// Version

//

 

Vs_version_info versioninfo

 
Fileversion

 
Productversion

 
Fileflagsmask 0x3fl

# Ifdef _ debug

 
Fileflags 0x1l

# Else

 
Fileflags 0x0l

# Endif

 
Fileos 0x40004l

 
Filetype 0x2l

 
Filesubtype 0x0l

Begin


Block "stringfileinfo"


Begin


Block "040904e4"


Begin


Value
"Filedescription", "npwyq dynamic link library"


Value "fileextents ",
"HTML | htm"


Value "fileopenname ",
"Npwyq"


Value "fileversion ",
"1, 0, 0, 1"


Value "internalname ",
"Npwyq"


Value "legalcopyright ",
& Quot; Copyright (c) 2009 & quot"


Value "mimetype ",
"Application/X-wyq-plugin"


Value
"Originalfilename", "npwyq. dll"


Value "productname ",
"Npwyq"


Value "productversion ",
"1, 0, 0, 1"


End


End


Block "varfileinfo"


Begin


Value "Translation", 0x409,
1252


End

End

 

# Endif
// Chinese (P. R. C.) Resources

//////////////////////////////////////// /////////////////////////////////////

 

 

 

# Ifndef apstudio_invoked

//////////////////////////////////////// /////////////////////////////////////

//

// Generated from
Textinclude 3 resource.

//

 

 

//////////////////////////////////////// /////////////////////////////////////

# Endif
// Not apstudio_invoked

 

6)
DLL file, copy it
Firefox
In the Plugins directory.
* Copy the. xpt file
In components. If
DLL depends on other third-party
DLL files, copy them
Go to the same level directory of firefox.exe. Close all Firefox browsers and open them again. Enter about: Plugins in the address bar to check whether your plugin has been registered successfully.

 

If you are interested in other details, refer:
Https://developer.mozilla.org/en/Compiling_The_npruntime_Sample_Plugin_in_Visual_Studio

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.