- cominteropwithdotnetsource.zip
- COMInteropWithDOTNET
- COMInteropWithDOTNETSource
- ClassicCOM
- AirlineInformation
- AirlineNotify
- IceCreamParlor
- MyFlyer
- NETThreadDemoClient
- VBAirlineControlTower
- VBIceCreamParlor
- IceCreamMenu.cls
- stdole.dll
- VBIceCreamProject.exp
- VBIceCreamProject.lib
- VBIceCreamProject.vbp
- VBIceCreamProject.vbw
- VBTestClient
- VBWeatherStation
- DOTNET-CSharpFiles
- cominteropwithdotnetdemo.zip
- COMInteropWithDOTNETDemo
- AirlineClient.exe
- AirlineInformation.dll
- AirlineMetadata.dll
- AirlineNotify.exe
- AirlineNotifyClient.exe
- AirlineNotifyMetadata.dll
- ControlTower.exe
- DelegateTest.exe
- Directional.dll
- FlightClient.exe
- HelloDotNet.dll
- HelloWorldDelegate.exe
- IceCreamMenuClient.exe
- IceCreamMenuMetadata.dll
- IceCreamParlor.dll
- MyFlyer.dll
- MyFlyerMetadata.dll
- NETThreadDemoClient.exe
- RegisterAll.bat
- SevenDwarfs.exe
- Temperature.dll
- VBIceCreamProject.dll
- VBTestClient.exe
- VBWeatherStation.exe
- WeatherNotify.dll
- cominterop_demo.zip
- ComInteropDemo
- AirlineCSharpClient
- AirlineInformation
|
using System;
using System.Runtime.InteropServices;
using System.Reflection;
using AIRLINEINFORMATIONLib;
public class CAirlineClient
{
public static void Main()
{
///////////////////////////////////////////////
/// EARLY BINDING EXAMPLE
///////////////////////////////////////////////
String strAirline = "Air Scooby IC 5678";
String strFoodJunkieAirline = "Air Jughead TX 1234";
try
{
AirlineInfo objAirlineInfo;
// Create a new AirlineInfo Object
objAirlineInfo = new AirlineInfo();
// Display the output after calling the GetAirileTiming method
System.Console.WriteLine("Details for Airline {0} --> {1}",
strAirline,objAirlineInfo.GetAirlineTiming(strAirline));
// System.Console.WriteLine("Details for Airline {0} --> {1}",
// strFoodJunkieAirline,objAirlineInfo.GetAirlineTiming(strFoodJunkieAirline));
}//try
catch(COMException e)
{
System.Console.WriteLine("Oops- We encountered an error for Airline {0}. The Error message is : {1}. The Error code is {2}",
strFoodJunkieAirline ,e.Message,e.ErrorCode);
}// catch
///////////////////////////////////////////////
/// QUERY INTERFACE/ RT type Checking
///////////////////////////////////////////////
try
{
AirlineInfo objAirlineInfo;
IAirportFacilitiesInfo objFacilitiesInfo;
// Create a new AirlineInfo object
objAirlineInfo = new AirlineInfo();
// Invoke the GetAirlineTiming method
String strDetails = objAirlineInfo.GetAirlineTiming(strAirline);
// QI for the IAirportFacilitiesInfo interface
objFacilitiesInfo = (IAirportFacilitiesInfo)objAirlineInfo;
//Invoke a method on the IAirportFacilitiesInfo interface
System.Console.WriteLine("{0}",objFacilitiesInfo.GetInternetCafeLocations());
} //try
catch(InvalidCastException eCast)
{
System.Console.WriteLine("We got an InvalidCast Exception - Message is {0}",eCast.Message);
}//catch
///////////////////////////////////////////////
/// LATE BINDING
///////////////////////////////////////////////
try
{
object objAirlineLateBound;
Type objTypeAirline;
object[] arrayInputParams= { "Air Scooby IC 5678" };
objTypeAirline = Type.GetTypeFromProgID
("AirlineInformation.AirlineInfo");
objAirlineLateBound = Activator.CreateInstance(objTypeAirline);
String str = (String)objTypeAirline.InvokeMember("GetAirlineTiming",
BindingFlags.Default |
BindingFlags.InvokeMethod,
null,
objAirlineLateBound,
arrayInputParams);
System.Console.WriteLine("{0}",str);
String strTime = (String)objTypeAirline.InvokeMember("LocalTimeAtOrlando",
BindingFlags.Default | BindingFlags.GetProperty,
null,
objAirlineLateBound,
new object [] {});
Console.WriteLine ("Hi there !. The Local Time at Orlando,Florida is: {0}", strTime);
}//try late binding
catch(COMException e)
{
System.Console.WriteLine("Oops- We encountered an error for Airline {0}. The Error message is : {1}. The Error code is {2}",strFoodJunkieAirline ,e.Message,e.ErrorCode);
}//catch
}// Main
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.