April 2002
Intermediate to advanced
1024 pages
23h 26m
English
It is possible to avoid using tlbimp if you are willing to give up some performance and use late binding. To use late binding, your component must implement IDispatch and preferably IProvideClassInfo to provide type information about your COM methods and properties. Listing 8.7 shows a simple example of using late binding. The full source to this sample is available in the LateBinding directory.
String progId = "COMTypes.TypeTest"; Type t = Type.GetTypeFromProgID(progId); Object o = Activator.CreateInstance(t); t.InvokeMember("Name", BindingFlags.SetProperty | BindingFlags.Public | BindingFlags.Instance, null, o, new Object[] {"Testing"} , null, null, null); Object ... |