Welcome to the Harris Geospatial product documentation center. Here you will find reference guides, help documents, and product libraries.


Harris Geospatial / Docs Center / Using IDL / C# Code Sample

IDL

C# Code Sample

C# Code Sample

Within Visual Studio .NET, in the Solution Explorer window, underneath the project that will use the wrapper object, right-click on the References item, then select Add Reference…. This brings up a dialog. Select the COM tab, then Browse, and change the path to the wrapper .dll. This imports the object reference into the project.

Then, within the project that will use the wrapper object, include the following line at the top, outside of the namespace for the class:

using IDLexFooLib;

Initiation Without Parameters in C#


Use the following code to initialize the object with no parameters.

private void button1_Click(...)
{
  IDLexFooClass oFoo = new IDLexFooClass();
   
  try
  {
  oFoo.CreateObject(0, 0, 0);
  }
  catch
  {
  Debug.WriteLine(oFoo.GetLastError());
  return;
  }
   
  // Use object here...
}

Initiation with Parameters in C#


Use the following code to initialize the object with its three parameters (a string, a 32-bit long value, and an array that has two rows and three columns, containing 32- bit long values).

private void button1_Click(...)
{
  const int PARMFLAG_CONST	= 0x0001;
  const int PARMFLAG_CONV_MAJORITY = 0x4000;
   
  IDLexFooClass oFoo = new IDLexFooClass();
   
  string	parmStr = "I am a string parameter";
  int	parmVal = 24;
   
  int[,]	parmArr = {{10, 11, 12}, {20, 21, 22}};
   
  int	argc = 3;
  object[] argval = {parmStr, parmVal, parmArr};
  int[]	argpal = {PARMFLAG_CONST, PARMFLAG_CONST, PARMFLAG_CONST | PARMFLAG_CONV_MAJORITY};
   
  try
  {
  oFoo.CreateObject(argc, argval, argpal);
  }
  catch
  {
  Debug.WriteLine(oFoo.GetLastError());
  return;
  }
   
  // Use object here...
   
}



© 2017 Exelis Visual Information Solutions, Inc. |  Legal
My Account    |    Buy    |    Contact Us