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

Re: [amibroker] Re: 2 Instances of Quotetracker with AB?



PureBytes Links

Trading Reference Links

Hello,

There are two completely unrelated questions:

Original question regarding QuoteTracker:

Q1. Is it possible to run 2 QuoteTrackers and 2 AmiBrokers and set them up so
that 1st AB instance talks to 1st QT instance and 2nd AB instance talks to 2nd QT instance.

A1. Yes it is possible. AmiBroker's QT uses TCP/IP link (not automation) and allows
each instance to talk on DIFFERENT ports to each instance of QT.
See this post: http://finance.groups.yahoo.com/group/amibroker/message/74186
for very nice example of how to do this in practice.

(note that there is NO automation involved at all)

===========

Second question is actually completely unrelated to original QuoteTracker question
but somehow people tend to mix different things.

So second question is about automation:

Q2. Is it possible to access more than one instance using CreateObject Microsoft OLE API

A2:

There is no simple YES or NO answer.

>From technical standpoint it is possible, but it does not mean that it is easy.

Please read the Microsoft documentation on Microsoft's CreateObject:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vblr7/html/vafctCreateObject.asp

As you can see depending how the object is registered CreateObject function creates
single or more instances. It is Windows-wide standard that "application" objects are
registered so one application is launched, while other objects like "document" can be
instantiated multiple times. 

Changing this standard behaviour is not straightforward but of course possible.
There are two ways to do this:
- add secondary registration in the Windows registry with different class ID and different path to outproc server
- modify class factory setup code in the application itself 

Why it is not recommended to do so? Simply CreateObject() would then create new instance with each
call which would lead to serious problems like not being able to update quotes in currently running AmiBroker
via AmiQuote, not being able to run scripts embedded in AFL referring to AB application object itself
(via new ActiveXObject/ CreateObject), and other similar problems. 

Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message ----- 
From: "groups" <groups@xxxxxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Wednesday, November 24, 2004 9:47 PM
Subject: Re: [amibroker] Re: 2 Instances of Quotetracker with AB?


>
> Fred wrote:
>> TJ,
>>
>> Did I miss something ?  Are you suggesting that OLE automation can
>> some how be run multiple times simultaneously on the same machine
>> talking to two different instances of AmiBroker ?
>
> I asked the same question a long time ago and the answer was: NO.
>
> regards,
> BM
>
>
>
> Check AmiBroker web page at:
> http://www.amibroker.com/
>
> Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html
> Yahoo! Groups Links
>
>
>
>
>
>
>
> 



------------------------ Yahoo! Groups Sponsor --------------------~--> 
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

Check AmiBroker web page at:
http://www.amibroker.com/

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.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/