PureBytes Links
Trading Reference Links
|
Thanks Tomasz...!
You might consider the "Shared assembly" approach - as it (if I get
it right) seems to offer the best of two (binding) worlds: Version
independence - but preserving the integrity of the automation code,
as well as providing Intellisense features giving clues to correct
calls to methods and properties. If interested, I would be happy to
e-mail you a few (scanned) pages on the topic i found in "Visual C#
2005" book (Wrox) You can get me at jens@xxxxxxxxxxxx
I did try the example you gave (very simple - new windows project -
add a button, copy/paste the code - and add the "using
System.Reflection;" statement in the top - now run/debug... But only
to get "Exception has been thrown by the target of an invocation." -
so i'm really not having a lot of luck... (yes, have office
installed... all applications running...)
Is there nobody else than Tomasz (who really should not spend his
time teaching a newbee like me about general COM bindings) who's
using the object model in C# - and can give me the code lines
(including any "using" statements and other necessary preparations)
for
---------------------------------
Broker.Application ab = new Broker.Application();
string currentPath = ab.DatabasePath;
---------------------------------
or any other example showing how to exploit the AmiBroker object
model in C#???
Thanks and regards
Jens Tiedemann
--- In amibroker@xxxxxxxxxxxxxxx, "Tomasz Janeczko" <amibroker@xxx>
wrote:
>
> Hello,
>
> No you don't need all that. There are plenty of documents on
Microsoft site
> that explain how to use late binding in C# .NET
> for example:
> http://support.microsoft.com/kb/302902/
>
> (all documents that cover "how to link to
Excel/Access/Word/Powerpoint"
> apply to any other out-proc OLE server, including AmiBroker)
>
> Best regards,
> Tomasz Janeczko
> amibroker.com
> ----- Original Message -----
> From: "tiedemj" <home@xxx>
> To: <amibroker@xxxxxxxxxxxxxxx>
> Sent: Monday, February 06, 2006 9:44 PM
> Subject: [amibroker] Re: Amibroker Automation Object Model and C#
in Visual Studio 2005
>
>
> > still digging... for broker.tlb (dll) to be usable for all
visual
> > studio programming languages, it seems it needs to be provided
as
> > a "shared assembly". A shared assembly needs "Strong names" -
that
> > is, the dll needs to be signed with a public/private key. This
can
> > be done once in Visual Studio 2005, by
> >
> > 1. generating a key with the "sn" utility
> > 2. signing the broker project using the signing tab in project
> > properties(only Tomasz would be able to do this)
> > 3. once recompiled, the (signed) assembly can now be made
universaly
> > available through the global assembly cache by copy to
> > windows\assembly (XP)
> >
> > OR - am I digging in the wrong direction - and there is a much
> > simpler solution to use the amibroker object model in C#/Visual
> > Studio with late binding that just escapes me?
> >
> > regards
> > Jens Tiedemann
> >
> > --- In amibroker@xxxxxxxxxxxxxxx, "tiedemj" <home@> wrote:
> >>
> >> 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@>
> >> 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@>
> >> > 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
> >> > >
> >> > >
> >> > >
> >> > >
> >> > >
> >> > >
> >> > >
> >> >
> >>
> >
> >
> >
> >
> >
> >
> >
> > 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/
|