Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Interop / March 2007

Tip: Looking for answers? Try searching our database.

nothing published to COM after tlbexp

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
ptheate@gmail.com - 23 Mar 2007 17:08 GMT
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,

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.