MozNET:  (02/17/2012)
.Click() is coming!
Starting with R19.3, MozDomElement and derivatives will support their own .Click() method!


MozNET:  (12/17/2011)
MozNET R19.2 is available! Recommended update.
Incremental bug fixes and enhanced inline CSS access on elements.
New Software:   
Win7Lib is the newest member of the Se7en Soft title line-up. This programming library gives you access to some of Windows 7's most secret of secrets!
New Software:  
Note Magic has just been released. Enhance your Windows 7 Sticky Notes experience!
MozNET:  
New MozNET tutorial posted!
Use MosStringBundleService to localize your applications.
 
Follow Se7en Soft On Twitter:
     Twitter.com/Se7enSoft

Did You Know...
... If you could drive to the sun at a speed of 88.5 km/h (55 mp/h) it would take around 193 years?
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
ASPCA.org
Visitor IP: 38.107.179.210
Copyright (c) 2009 - 2011 Se7en Soft   :  All Rights Reserved  |  Privacy Statement