-- In [email protected], "murthysuresh" <mo...@...> wrote:
>
> 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 equivalent 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 [email protected], "murthysuresh" <mo...@...> wrote:
>
> can you clarify what object type is ComParent in the code ?
> 
> --- In [email protected], "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 [email protected], "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 [email protected], "angeld_1985" <angeld@> wrote:
> > > >
> > > > I'm trying to write Amibroker COM wrapper in .net, and i stuck in 
> > > > implementation of Quotations.Retrieve method. 
> > > >
> > >
> >
>


Reply via email to