Hi,
I try to create a COM Dll in C# 2005 Express that implement a COM
interface (Wealth-Lab real time data adapter API).
I succeeded in creating a dll for the Wealth-Lab COM interface to
implement.
Though, after tlbexp is run with following code, nothing is published
in the tlb file (see it's content below the code) !
What am I missing ?
Thanks in advance for any help.
C# code :
namespace MyAdapter
{
public class Main : IWealthLabRT3
{
public Main ()
{
}
#region IWealthLabRT3 Members
public void ActivateQuotes (IWealthLabQuoteUpdate3 Update)
{
}
public void AddSymbol (string Symbol, int Item)
{
}
public void AssignConnectionStatus (IWealthLabConnection3
conn)
{
}
public void ClearSymbols ()
{
}
public void CloseRequest ()
{
}
public void DeactivateQuotes ()
{
}
public string GetSecurityName (string Symbol)
{
}
public void OpenRequest (string Symbol, int NumBars,
BarIntervalEnum RequestType, int BarInterval, bool FilterMarketHours,
DateTime MarketOpen, DateTime MarketClose, IWealthLabBars3 Bars,
IWealthLabRTUpdate3 UpdateSink)
{
}
public void RemoveSymbol (string Symbol, int Item)
{
}
public bool SupportsQuotes ()
{
return true;
}
public bool SupportsRequest (BarIntervalEnum requestType)
{
return true;
}
#endregion
private void TraceMsg (string msg)
{
Trace.WriteLine (DateTime.Now.ToString ("HH:mm:ss:fff") +
" " + msg);
}
}
}
tlb file :
// Generated .IDL file (by the OLE/COM Object Viewer)
//
// typelib filename: <could not determine filename>
[
uuid(10BB5529-45F1-42DE-9B47-98624AA09F02),
version(1.0)
]
library MyAdapter
{
// TLib : // Forward declare all types defined in this typelib
};
bobahop@gmail.com - 23 Mar 2007 17:56 GMT
I sign my assembly with a strong name and I use regasm like so
regasm MyDllName.dll /tlb /codebase
And I make sure I have all the attributes set for the class and
interface with GUIDS like so
namespace MyNamespace
{
[Guid("blahblahblahX")]
[InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
[ComVisible(true)]
public interface _MyClassName
{
[DispId(1)]
string[] MyFirstMethod(string myparam);
[DispId(2)]
string[] MySecondMethod(string myparam);
}
[Guid("blahblahblahY")]
[ClassInterface(ClassInterfaceType.None)]
[ProgId("MyNameSpace.MyClassName")]
[ComVisible(true)]
public class MyClassName: _MyClassName
{
[ComVisible(true)]
string[] MyFirstMethod(string myparam){ blah;}
[ComVisible(true)]
string[] MySecondMethod(string myparam){ blah;}
}
}
HTH. Bob
ptheate@gmail.com - 24 Mar 2007 13:02 GMT
On 23 mar, 17:56, boba...@gmail.com wrote:
> I sign my assembly with a strong name and I use regasm like so
>
[quoted text clipped - 34 lines]
>
> HTH. Bob
Hi,
Thanks for your quick answer.
Though my class was declared public, I added the attribute
[ComVisible(true)] to the class "Main" and now it works !
Thanks again Bob,