Back to index

lightning-sunbird  0.9+nobinonly
Classes | Defines | Functions
TestCOM.cpp File Reference
#include <windows.h>
#include <unknwn.h>
#include <stdio.h>
#include "nsISupports.h"
#include "nsIFactory.h"

Go to the source code of this file.

Classes

class  nsITestCom
class  nsTestCom
class  nsTestComFactory

Defines

#define NS_ITEST_COM_IID

Functions

int main (int argc, char *argv[])

Define Documentation

Value:
{ 0x5846ba30, 0xb856, 0x11d1, \
  { 0xa9, 0x8a, 0x0, 0x80, 0x5f, 0x8a, 0x7a, 0xc4 } }

Definition at line 49 of file TestCOM.cpp.


Function Documentation

int main ( int  argc,
char *  argv[] 
)

Definition at line 152 of file TestCOM.cpp.

{
  nsTestComFactory *inst = new nsTestComFactory();
  IClassFactory *iFactory;
  inst->QueryInterface(NS_GET_IID(nsIFactory), (void **) &iFactory);

  IUnknown *iUnknown;  
  nsITestCom *iTestCom;

  nsresult res;
  iFactory->LockServer(TRUE);
  res = iFactory->CreateInstance(NULL,
                             IID_IUnknown, 
                             (void **) &iUnknown);
  iFactory->LockServer(FALSE);

  GUID testGUID = NS_ITEST_COM_IID;
  HRESULT hres;
  hres= iUnknown->QueryInterface(testGUID, 
                             (void **) &iTestCom);

  iTestCom->Test();

  iUnknown->Release();
  iTestCom->Release();
  iFactory->Release();

  return 0;
}