[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Re: Amibroker Automation Object Model and C# in Visual Studio 2005



PureBytes Links

Trading Reference Links

OK - Great - and thanks! Now - how do I do latebinding of the Object 
Model in C# using createObject. So what do I need to type to get the 
example:

----------------------------
Broker.Application ab = new Broker.Application();
string currentPath = ab.DatabasePath;
----------------------------

to work - and what "using" statements etc. will provide the type 
interface/suggestions/methods "lookup" when typing code? I've been 
at it for almost a week now with no luck, probably mostly due to the 
fact that I'm a newbee at using "foreign" COM objects in C# - so it 
might be something very simple I'm not getting...

Thanks
Jens Tiedemann


--- In amibroker@xxxxxxxxxxxxxxx, "Tomasz Janeczko" <amibroker@xxx> 
wrote:
>
> Hello,
> 
> Late binding (via CreateObject()) is the only recommended way 
since interface may change
> and all .tlb dependent programs may need recompilation. With Late 
binding your code will
> be backward and forward compatible with any AB version.
> 
> Best regards,
> Tomasz Janeczko
> amibroker.com
> ----- Original Message ----- 
> From: "William Peters" <william@xxx>
> To: "tiedemj" <amibroker@xxxxxxxxxxxxxxx>
> Sent: Monday, February 06, 2006 6:27 PM
> Subject: Re: [amibroker] Amibroker Automation Object Model and C# 
in Visual Studio 2005
> 
> 
> > 
> > The same error occurs in VB 2005. After spending a week 
researching
> > the issue I gave up and now use late binding.
> > 
> > 
> > 
> > Regards,
> > William Peters
> > http://www.amitools.com
> > 
> > 
> > 
> > 
> > Monday, February 6, 2006, 11:58:05 AM, you wrote:
> > t>    Hi there. 
> > 
> > t>  Anybody having an example of the Object Model being used in 
C# from
> > t>  Visual Studio? I can't get the following to work (after 
reference to
> > t>  broker.dll made from broker.tlb using imptlb.exe)...
> > 
> > t>  The following c# code:
> > t>  ----------------------
> > t>  using Broker
> > t>  Broker.Application ab = new Broker.Application();
> > t>  string currentPath = ab.DatabasePath;
> > t>  ----------------------
> > 
> > t>  throws the following exeption:
> > 
> > t>  System.InvalidCastException was unhandled
> > t>  Message="Unable to cast COM object of
> > t>  type 'Broker.ApplicationClass' to interface
> > t>  type 'Broker.IApplication'. This operation failed because the
> > t>  QueryInterface call on the COM component for the interface 
with
> > t>  IID '{2DCDD57B-9CC9-11D3-BF72-00C0DFE30718}' failed due to 
the
> > t>  following error: No such interface supported (Exception from
> > t>  HRESULT: 0x80004002 (E_NOINTERFACE))."
> > 
> > 
> > t>  What am I doing wrong? Also, would like to use late binding -
 but 
> > t>  think using broker.tlb means early binding - or?
> > 
> > 
> > 
> > 
> >    
> >  
> > 
> > 
> > 
> > 
> > 
> > Please note that this group is for discussion between users only.
> > 
> > To get support from AmiBroker please send an e-mail directly to 
> > SUPPORT {at} amibroker.com
> > 
> > For other support material please check also:
> > http://www.amibroker.com/support.html
> > 
> > 
> > Yahoo! Groups Links
> > 
> > 
> > 
> > 
> > 
> > 
> >
>






------------------------ Yahoo! Groups Sponsor --------------------~--> 
Try Online Currency Trading with GFT. Free 50K Demo. Trade 
24 Hours. Commission-Free. 
http://us.click.yahoo.com/RvFikB/9M2KAA/U1CZAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com

For other support material please check also:
http://www.amibroker.com/support.html

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/