Subject:
ERROR: Class not registered (Exception from HRESULT: 0x80040154
(REGDB_E_CLASSNOTREG)) on VISTA 64 bit only.
Date: 2/25/2010
Hi
I'm getting an ERROR:
"Class not registered (Exception from HRESULT: 0x80040154
(REGDB_E_CLASSNOTREG))"
on line
Controls.Add(Tws1);
it works fine on my XP computer. I'm using VISTA ULTIMATE 64 bit and VS2008. How do I
fix it?
private void Form1_Load(object sender, EventArgs e)
{
Tws1 = new AxTWSLib.AxTws();
Tws1.BeginInit();
Tws1.Enabled = true;
Tws1.Location = new System.Drawing.Point(32, 664);
Tws1.Name = "Tws1";
try
{
Controls.Add(Tws1);
}
catch (Exception ex)
{
//listBox1.Items.Add(ex.Message);
}
Tws1.EndInit();
Tws1.connect("127.0.0.1", 7496, 0);
String msg = "Connected to TWS server version " + Tws1.serverVersion + " at " + Tws1.TwsConnectionTime;
// MessageBox.Show(msg);
Tws1.reqMktData(1, "ES", "FUT", "201003", 0, "", "", "GLOBEX", "GLOBEX", "USD","",0);
htSyms.Add(1, "ES Mar 2010");
Tws1.tickPrice+=new AxTWSLib._DTwsEvents_tickPriceEventHandler(this.tickData);
Tws1.tickSize += new xTWSLib._DTwsEvents_tickSizeEventHandler(this.tickSize);
Tws1.tickString += new AxTWSLib._DTwsEvents_tickStringEventHandler(this.tickString);
}
Answer: In VS 2008 goto Project, Properties, Tab Build: Change Platform Target
to x86 |