Re: AxHost and ActiveX initialization
- From: "Raj Wall" <metanalogy@xxxxxxxxxxxxx>
- Date: Wed, 26 Apr 2006 14:49:37 -0500
Peter, hi,
Thanks for the response, and sorry for the confusion. What I need a copy of
the ActiveX component for each account. Each copy will manage a connection
to the server. If I just create an instance of the component, however, the
component is not initialized properly. That gives me the
InvalidActiveXStateException with the first call to thecomponent.
If instead I only use the object generated by VS from pretending the
component is visible (placing it on a form), I have no problem.
Finally, if I pursue option One (simply create instances of the component as
I need them) and then duplicate the code VS uses to initialize, I again get
the InvalidActiveXStateException error.
So my question is, what am I missing in my initialization? I'll include my
code at the end of this message. What is the "secret sauce" VS is performing
to initialize a "visible" component that I need to do on an "invisible"
component? In particular, I don't understand what the correct syntax for the
resources.GetObject("MytwsObj.OcxState")
should be.
Thanks for your help!
Regards,
Raj
Here is my initialization code "copied" from similar code generated by VS:
private AxTWSLib.AxTws MytwsObj;
MytwsObj = new AxTWSLib.AxTws();
System.ComponentModel.ComponentResourceManager resources = new
System.ComponentModel.ComponentResourceManager(typeof(TWSInterface));
((System.ComponentModel.ISupportInitialize)(MytwsObj)).BeginInit();
MytwsObj.Enabled = true;
MytwsObj.Name = "axTws0" + account;
MytwsObj.OcxState =
((System.Windows.Forms.AxHost.State)(resources.GetObject("MytwsObj.OcxState")));
""Peter Huang" [MSFT]" <v-phuang@xxxxxxxxxxxxxxxxxxxx> wrote in message
news:K3TwC0NaGHA.880@xxxxxxxxxxxxxxxxxxxxxxxx
Hi
Do you mean you just want one instance of the ActiveX class in memory in
the lifetime of the form1?
If so, we can delare the object in the form level but not in certian
method.
e.g.
class Form1
{
IABCObj o = new ABCObjClass();
Form1()
{
}
....
}
Also we can create more than one form1 instance.
e.g.
In certian method, we can call.
Form1 fm = new Form1();
fm.Show();
So that another form1 will show in addition to the original one.
"Or is there a way to "drop" multiple copies of the component onto a
running form? "
I did not understand the question. Do you mean you want to drop more than
one ActiveX component onto form1 and run Form1?
If so, we just need to drag&drop more than one onto the form.
Best regards,
Peter Huang
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no
rights.
.
- Follow-Ups:
- Re: AxHost and ActiveX initialization
- From: Christian Fröschlin
- Re: AxHost and ActiveX initialization
- From: "Peter Huang" [MSFT]
- Re: AxHost and ActiveX initialization
- References:
- AxHost and ActiveX initialization
- From: Raj Wall
- RE: AxHost and ActiveX initialization
- From: "Peter Huang" [MSFT]
- Re: AxHost and ActiveX initialization
- From: Raj Wall
- Re: AxHost and ActiveX initialization
- From: "Peter Huang" [MSFT]
- Re: AxHost and ActiveX initialization
- From: Raj Wall
- Re: AxHost and ActiveX initialization
- From: "Peter Huang" [MSFT]
- AxHost and ActiveX initialization
- Prev by Date: Callback not being called
- Next by Date: Get the CCW class factory return an existing instance
- Previous by thread: Re: AxHost and ActiveX initialization
- Next by thread: Re: AxHost and ActiveX initialization
- Index(es):
Relevant Pages
|