MozNET:  
MozNET R19.4 has just been turned loose! This is the first release to target .NET framework 3.5.

MozNET:  
The first, official, MozNET addon has been released! Be on the lookout for H/F Bridge!
MozNET:  
The MozNET AIO Builder has been updated. Login in and check out the 'My Account' to pick up the new bits!
MozNET:  
MozNET Source+ is now available!
New Software:  
JackHammer, the newest member of the Se7en Soft software lineup, is available! Details here.
MozNET:  
New MozNET tutorial posted!
Use MosStringBundleService to localize your applications.
 
Follow Se7en Soft On Twitter:
     Twitter.com/Se7enSoft

Did You Know...
... gatophobia is the fear of cats?
MozNET Tutorial - Native XPCOM Component

I'm not going to delve very deep into the subject of native XPCom components because, well.. The main component we're talking about here is written in a managed lanaguage and that's what most of us develop with. But, since it is fully possible to use custom, native, components I will at least provide you with a basic project that you can use either as a template to create your own component or just something to screw around with.

Crack Open VC++

Compiling a native component is not as straight-forward as we would like it and I'm no C/C++ guru so I'm not going to try to explain how to set anything up. I will, however, tell you that if you develop primarily (or only) with Visual Studio 2010 you're going to need to install VC++ 2008 (the Express edition won't work for this!). Native components need to target the VC9 runtime and VS 2010 can't target that runtime without VS 2008 being installed.
Yeah, I know. Stupid. But, that's how Microsoft does things.
Let's get started...

A Component Skeleton

Now you need a base, something to start building your component from. Below you'll find a link to a skeletal component that you can use as a template for building your own XPCOM component.
  Native Component Source Project



Well, I know it's not simple but, that's about as easy as I can make it for you. If you get stuck registering your component just refer to the Javascript component tutorial for help. If you get really stuck - not beginner stuck either - you can post on the forum and I'll try to help you if I can but, I'm not going to hold your hand with this. smile

As for how to define and access your component from your application.. That's pretty easy too. Define (redefine in this case) your interface as a managed version, inside your application (do it just like you would if you were extending MozNET or GeckoFX), now create an instance of your interface just like any other interface: eg.

nsIMyInterface myInterfaceInstance =
    XPCom.CreateInstance<nsIMyInterface>("@mysite.com/my-component;1");


Now you can use the myInterfaceInstance to call on properties and methods of your component.

If someone wants to pick up the ball and run with this, be my guest. If you come up with a better tutorial for everyone I'll replace this one with yours.



SSL Logo
open drive
ASPCA.org
Visitor IP: 38.107.179.212
Copyright (c) 2009 - 2011 Se7en Soft   :  All Rights Reserved  |  Privacy Statement