PureBytes Links
Trading Reference Links
|
> can you clarify what object type is ComParent in the code ?
Actually I've yet to use it but AFAIK, the ComParent object type is just that - an object of type "object" .
eg. In this example objApp is the ComParent.
private void btnGetDatabasePath_Click(object sender, EventArgs e)
{
object objApp;
object objDatabasePath;
object objStocks;
try
{
// Get the class type
Type objClassType; objClassType = Type.GetTypeFromProgID("Broker.Application");
// Instantiate AmiBroker
objApp = Activator.CreateInstance(objClassType);
// Get the database path
// Remember to add a "using" at the top for "System.Reflection" or else use "System.Reflection.BindingFlags" below.
objDatabasePath = objApp.GetType().InvokeMember("DatabasePath", BindingFlags.GetProperty, null, objApp, null);
// Set the window text box to the database path.
// As the database path is an object we must convert it to a string.
txtDatabasePath.Text = Convert.ToString(objDatabasePath);
// get stocks object
objStocks = objApp.GetType().InvokeMember("Stocks", BindingFlags.GetProperty, null, objApp, null);
stocksTextBox.Text = Convert.ToString(objStocks);
}
regards
--- In amibroker@xxxxxxxxxxxxxxx, "murthysuresh" <money@xxx> wrote:
>
> can you clarify what object type is ComParent in the code ?
>
> --- In amibroker@xxxxxxxxxxxxxxx, "justinwonono" <justinwonono@> wrote:
> >
> > <hope my code helps someone else>
> >
> > Sure has...just been starting to work out how to do the same...will use it to play around with watchlists.
> >
> > thanks heaps
> > ..
> >
> >
> > -- In amibroker@xxxxxxxxxxxxxxx, "angeld_1985" <angeld@> wrote:
> > >
> > > So I found the solution, hope my code helps someone else.
> > >
> > > ----- C# CODE -----
> > >
> > > public int Retrieve(int Count,
> > > ref DateTime[] Date,
> > > ref float[] Open,
> > > ref float[] High,
> > > ref float[] Low,
> > > ref float[] Close,
> > > ref int[] Volume,
> > > ref int[] OpenInt)
> > > {
> > > object[] ParamArray = new object[8];
> > > ParamArray[0] = (long)Count;
> > > ParamArray[1] = new VariantWrapper(Date);
> > > ParamArray[2] = new VariantWrapper(Open);
> > > ParamArray[3] = new VariantWrapper(High);
> > > ParamArray[4] = new VariantWrapper(Low);
> > > ParamArray[5] = new VariantWrapper(Close);
> > > ParamArray[6] = new VariantWrapper(Volume);
> > > ParamArray[7] = new VariantWrapper(OpenInt);
> > >
> > > //throw new NotImplementedException();
> > > ParameterModifier p = new ParameterModifier(8);
> > >
> > > // Pass the first and third parameters by reference.
> > > p[0] = false;
> > > p[1] = true;
> > > p[2] = true;
> > > p[3] = true;
> > > p[4] = true;
> > > p[5] = true;
> > > p[6] = true;
> > > p[7] = true;
> > > ParameterModifier[] mods = { p };
> > >
> > > int cnt = (int)ComParent.GetType().InvokeMember("Retrieve", BindingFlags.Default | BindingFlags.InvokeMethod,
> > > null,
> > > ComParent,
> > > ParamArray, mods, null, null);
> > >
> > > Date = (DateTime[])ParamArray[1];
> > > Open = (float[])ParamArray[2];
> > > High = (float[])ParamArray[3];
> > > Low = (float[])ParamArray[4];
> > > Close = (float[])ParamArray[5];
> > > Volume = (int[])ParamArray[6];
> > > OpenInt = (int[])ParamArray[7];
> > >
> > > return cnt;
> > > }
> > >
> > > ------ END CODE ----
> > >
> > > --- In amibroker@xxxxxxxxxxxxxxx, "angeld_1985" <angeld@> wrote:
> > > >
> > > > I'm trying to write Amibroker COM wrapper in .net, and i stuck in
> > > > implementation of Quotations.Retrieve method.
> > > >
> > >
> >
>
------------------------------------
**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.
TO GET TECHNICAL SUPPORT send an e-mail directly to
SUPPORT {at} amibroker.com
TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)
For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/
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/
|