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

[amibroker] Re: Using External DLL from AFL | Solution



PureBytes Links

Trading Reference Links

--- In amibroker@xxxxxxxxxxxxxxx, "cstrader" <cstrader232@xxx> wrote:
>
> Hi Hanon:
> 
> OK, what about going the other way?  Is it possible to call the 
> Broker.Application COM functions from a vs.net program?  I can't
load the AB 
> .dll files into my solution.  Is this because they are unmanaged code?
> 
> thanks again,
> 
> chuck
> 
> 
> ----- Original Message ----- 
> From: "hanan.harush" <hanan.harush@xxx>
> To: <amibroker@xxxxxxxxxxxxxxx>
> Sent: Saturday, April 21, 2007 3:26 PM
> Subject: [amibroker] Re: Using External DLL from AFL | Solution
> 
> 
> >I have succeeded.
> >
> > Here are my understandings:
> > 1. Description:
> > You don't build ActiveX DLLs in .net.  You build .net assembly DLLs.
> > If you wish to use a .net assembly in COM you can compile the project
> > with the setting to make it COM Callable by means of the "Register for
> > COM interop" checkbox inside the project's properties page.  Once the
> > ..net assembly is created you can use the RegASM tool to register the
> > assembly in the way you would use regsvr32.
> >
> > # How to: Register a Component for COM Interop
> > http://msdn2.microsoft.com/en-us/library/w29wacsy(vs.80).aspx
> >
> > # Assembly Registration Tool
> > http://msdn2.microsoft.com/en-us/library/tzat5yw6(vs.71).aspx
> >
> > The steps are:
> > 1. Create a Class library project using VS .Net
> > 2. set the VS project Build property to "Register for COM interop".
> > 3. set the VS project Application Assembly Information property to
> > "make assembly COM-accessible"
> > 4. Compile it
> > 5. Register the Assembly using RegASM ( located at my PC
> > "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\RegAsm.exe" )
> > 6. Create your class object from AFL ( using CreateObject() )
> > 7. Enjoy :)
> >
> > If any of you still have questions do not hesitate to contact me.
> >
> > Cheers
> > Hanan
> >
> >
> >
> >
> >
> > --- In amibroker@xxxxxxxxxxxxxxx, "hanan.harush" <hanan.harush@>
wrote:
> >>
> >> --- In amibroker@xxxxxxxxxxxxxxx, "Tomasz Janeczko" <groups@> wrote:
> >> >
> >> > Hello,
> >> >
> >> > Detailed step-by-step instruction is (surprise!) in the manual:
> >> > http://www.amibroker.com/guide/a_aflcom.html
> >> >
> >> > Best regards,
> >> > Tomasz Janeczko
> >> > amibroker.com
> >> > ----- Original Message ----- 
> >> > From: "cstrader" <cstrader232@>
> >> > To: <amibroker@xxxxxxxxxxxxxxx>
> >> > Sent: Friday, April 20, 2007 7:04 PM
> >> > Subject: Re: [amibroker] Using External DLL from AFL
> >> >
> >> >
> >> > > OK, I'd really like to know if you have success with this because
> >> I've tried
> >> > > for months and never succeeded in getting an activex control to
> >> run from AB.
> >> > > I became convinced it was not possible.
> >> > >
> >> > > I have vb studio 2005
> >> > >
> >> > > I create the assembly  classlibrary1.dll
> >> > > it has a class:  class1
> >> > > which has a method:  test
> >> > >
> >> > > Public Class Class1
> >> > > Public Function test() As Integer
> >> > >
> >> > > Return 1
> >> > >
> >> > > End Function
> >> > >
> >> > > End Class
> >> > >
> >> > > I check the "make assembly com visible" checkbox (should
> > register it)
> >> > >
> >> > > I get no error from the following AFL:  But nor does the function
> >> test
> >> > > return any value other than "EMPTY".
> >> > >
> >> > > myobj = CreateObject("ClassLibrary1.Class1");
> >> > >
> >> > > test = myobj.test;
> >> > >
> >> > > printf ("ZZ" + test);
> >> > >
> >> > > What am I doing wrong?
> >> > >
> >> > > How to debug?
> >> > >
> >> > > Thanks
> >> > >
> >> > >
> >> > > ----- Original Message ----- 
> >> > > From: "Tomasz Janeczko" <groups@>
> >> > > To: <amibroker@xxxxxxxxxxxxxxx>
> >> > > Sent: Friday, April 20, 2007 12:24 PM
> >> > > Subject: Re: [amibroker] Using External DLL from AFL
> >> > >
> >> > >
> >> > >> Hello,
> >> > >>
> >> > >> Visual BASIC does not create PLUGINS. So it does not need to
be put
> >> > >> inside plugins directory.
> >> > >>
> >> > >> What you have created is ActiveX and to use it you need to
> >> > >> REGISTER it (There is an appropriate option in Visual Basic).
> >> > >>
> >> > >> If you move the activex to another computer you need to
register it
> >> > >> using regsvr32.exe <nameofyourdll>
> >> > >>
> >> > >> Best regards,
> >> > >> Tomasz Janeczko
> >> > >> amibroker.com
> >> > >> ----- Original Message ----- 
> >> > >> From: "hanan.harush" <hanan.harush@>
> >> > >> To: <amibroker@xxxxxxxxxxxxxxx>
> >> > >> Sent: Friday, April 20, 2007 2:20 PM
> >> > >> Subject: [amibroker] Using External DLL from AFL
> >> > >>
> >> > >>
> >> > >>> Hi All,
> >> > >>>
> >> > >>> 1. I have created a simple DLL  and tried to call a basic
function
> >> > >>> from the DLL with zero success:
> >> > >>> 2. I put the MYDLL.dll file in AB Plugins directory ( as
> > required ).
> >> > >>>
> >> > >>> Any idea why i CreateObject() fails ?
> >> > >>>
> >> > >>> Regards,
> >> > >>> Hanan Harush
> >> > >>>
> >> > >>> # here is my code
> >> > >>> Public Class MYDLL
> >> > >>>    Private _VERSION As Integer
> >> > >>>    Public Sub New()
> >> > >>> _VERSION  = 56
> >> > >>>    End Sub
> >> > >>>
> >> > >>>    Public Function getVersion() As integer
> >> > >>>        Return  _VERSION
> >> > >>>    End Function
> >> > >>>
> >> > >>> End Class
> >> > >>>
> >> > >>> # and my AFL code:
> >> > >>> myobj = CreateObject("MYDLL");
> >> > >>>
> >> > >>> if (myobj)
> >> > >>> {
> >> > >>> ver=myobj.getVersion();
> >> > >>>
> >> > >>> _TRACE("SUCCESS" + ver);
> >> > >>>
> >> > >>> }
> >> > >>>
> >> > >>> else
> >> > >>> {
> >> > >>>
> >> > >>> _TRACE("FAILED " );
> >> > >>> }
> >> > >>> Buy = 5;
> >> > >>> Sell =10;
> >> > >>> Plot(Close,"Price",colorBlack,styleBar);
> >> > >>>
> >> > >>>
> >> > >>>
> >> > >>>
> >> > >>> 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 NEW RELEASE ANNOUNCEMENTS and other news always check
DEVLOG:
> >> > >>> http://www.amibroker.com/devlog/
> >> > >>>
> >> > >>> 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 NEW RELEASE ANNOUNCEMENTS and other news always check
DEVLOG:
> >> > >> http://www.amibroker.com/devlog/
> >> > >>
> >> > >> 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 NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
> >> > > http://www.amibroker.com/devlog/
> >> > >
> >> > > For other support material please check also:
> >> > > http://www.amibroker.com/support.html
> >> > >
> >> > > Yahoo! Groups Links
> >> > >
> >> > >
> >> > >
> >> > >
> >> > >
> >> >
> >> I think the updated question should be:
> >> is it still possible to make an ActiveX DLL with VB .NET ?
> >>
> >> Is anyone can assist ?
> >>
> >> Hanan
> >>
> >
> >
> >
> >
> > 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 NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
> > http://www.amibroker.com/devlog/
> >
> > For other support material please check also:
> > http://www.amibroker.com/support.html
> >
> > Yahoo! Groups Links
> >
> >
> >
>

Hi chuck,

Why would you want to to call the Broker.Application COM functions
from a vs.net ? 
To my knowledge you can write a plugin using AB ADK, this way you can
interact with AFL functions/varibales etc.
Not sure you can do it using .NET.

Hanan 



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 NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

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/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> 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/