interop >> Windowless ActiveX controls are not supported

by Ricardo Ferreira » Mon, 23 May 2005 18:49:55 GMT

Hi!

I'm integrating an ActiveX control, developed in VB, in a c# WindowsForm
application.
In the development machine everything works fine but in some other machines
I got a System.InvalidOperationException exception:

Unable to get the window handle for the 'AxMyControl' control. Windowless
ActiveX controls are not supported.
Error Source: System.Windows.Forms
Error Context: at System.Windows.Forms.AxHost.EnsureWindowPresent()
at System.Windows.Forms.AxHost.InPlaceActivate()
at System.Windows.Forms.AxHost.TransitionUpTo(Int32 state)
at System.Windows.Forms.AxHost.CreateHandle()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.AxHost.EndInit()

Does anyone have an idea why it works fine in the development machine and in
some other machines it throws this exception?

Both machines are running Win2k SP4 with .Net Framework 1.1.4322 SP1.

Any hint is appreciated.

Ricardo Ferreira



interop >> Windowless ActiveX controls are not supported

by QWxmcmVkbyBEZWxnYWRpbGxv » Wed, 17 May 2006 04:07:02 GMT


Hi everybody,

I using VS.NET 2005 Pro to develop win form application and I need include
an activex control to show information, this works good In developing time
but after deploy doesn't work it, I try to running in a clean machine with
framework 2.0 installed

I found this error 'Unable to get the window handle for the 'AxMyActivex'
control. Windowless ActiveX controls are not supported.' when I tray to show
the form with actvex control.

Please, could you someone help me?.

Regards,
Alfredo

interop >> Windowless ActiveX controls are not supported

by Christian Frchlin » Wed, 17 May 2006 16:43:22 GMT


Wild shot, but the one time I encountered something like this
it was related to some enhanced virus protection feature of
the CPU (Data Execution Prevention / DEP), in which case it
could be prevented using NoExecute=AlwaysOff in boot.ini.

http://support.microsoft.com/kb/875352

interop >> Windowless ActiveX controls are not supported

by QWxmcmVkbyBEZWxnYWRpbGxv » Wed, 17 May 2006 22:22:01 GMT

This solution doesn't work for me, this error continues being shown.

I try this options:

1) I set Data Execution Prevention in Advanced properties of my machine to
second option 'Turn on DEP fo all programs and services except I select', and
I add my application, it doesn't work.

2) I was modified boot.ini file changing /noexecute value from
/noexecute=optin to /noexecute=AllwaysOff, it doesn't work too.

do you have any other recomendation?

interop >> Windowless ActiveX controls are not supported

by The Real Andy » Thu, 18 May 2006 17:17:00 GMT

On Tue, 16 May 2006 13:07:02 -0700, Alfredo Delgadillo



I reckon you might be having some threading issues. Try putting all
your calls in a try catch block and see if you get any exceptions.

interop >> Windowless ActiveX controls are not supported

by QWxmcmVkbyBEZWxnYWRpbGxv » Thu, 18 May 2006 20:36:02 GMT

Hi Andy, this the error detail

|--->Error Type: InvalidOperationException
|--->Rutine: EnsureWindowPresent
|--->Description: Unable to get the window handle for the
'AxctrProject' control. Windowless ActiveX controls are not supported.

Stack Trace:
at System.Windows.Forms.AxHost.EnsureWindowPresent()
at System.Windows.Forms.AxHost.InPlaceActivate()
at System.Windows.Forms.AxHost.TransitionUpTo(Int32 state)
at System.Windows.Forms.AxHost.CreateHandle()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.AxHost.EndInit()
at Name.Detail.TS20.frmForm1.InitializeComponent()
at Name.Detail.TS20.frmForm1..ctor(Boolean blnAll)
at Name.Detail.TS20.frmMain.ExecuteAction(String key, Boolean blnExe)

Each block has a try and cach exception.

interop >> Windowless ActiveX controls are not supported

by The Real Andy » Fri, 19 May 2006 16:46:41 GMT

On Thu, 18 May 2006 05:36:02 -0700, Alfredo Delgadillo



Without seeing the code, its hard to know what you are doing.

You need to remmeber that the active x control will run on a seperate
thread, and to allow access to the winform thread you need to provide
some kind of thread safe access, typically through invoke.

CAn you get access to VS2003? I beleive the cross threading stuff was
less strictly enforced in 2003.

interop >> Windowless ActiveX controls are not supported

by Willy Denoyette [MVP] » Fri, 19 May 2006 21:57:26 GMT


| On Thu, 18 May 2006 05:36:02 -0700, Alfredo Delgadillo

|
| >Hi Andy, this the error detail
| >
| > |--->Error Type: InvalidOperationException
| > |--->Rutine: EnsureWindowPresent
| > |--->Description: Unable to get the window handle for the
| >'AxctrProject' control. Windowless ActiveX controls are not supported.
| >
| >Stack Trace:
| > at System.Windows.Forms.AxHost.EnsureWindowPresent()
| > at System.Windows.Forms.AxHost.InPlaceActivate()
| > at System.Windows.Forms.AxHost.TransitionUpTo(Int32 state)
| > at System.Windows.Forms.AxHost.CreateHandle()
| > at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
| > at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
| > at System.Windows.Forms.AxHost.EndInit()
| > at Name.Detail.TS20.frmForm1.InitializeComponent()
| > at Name.Detail.TS20.frmForm1..ctor(Boolean blnAll)
| > at Name.Detail.TS20.frmMain.ExecuteAction(String key, Boolean blnExe)
| >
| >Each block has a try and cach exception.
| >
|
| Without seeing the code, its hard to know what you are doing.
|
| You need to remmeber that the active x control will run on a seperate
| thread, and to allow access to the winform thread you need to provide
| some kind of thread safe access, typically through invoke.

Hold on, ActiveX controls must be marked as ThreadingModel= Apartment in the
registry, that is they must run in a STA, assumed that the Form runs in an
STA, the Control also runs in the same STA (same thread).
To the OP, check your controls' apartment requirements.

Willy.

Similar Threads

1. "Windowless ActiveX controls are not supported" error on Vista using VS2008 Pro RTM - .Net Framework

2. Windowless ActiveX Controls not supported

When I install my .NET app on a "fresh" installed machine with the
.NET installer

I get this...

Windowless ActiveX Controls not supported

Well, Okay, I understand that...it seems pretty self-explinority, but
it works on my build machine so why not on another machine?   And even
stranger when I make a build using Installshield it works perfect, but
when I make a build using the .NET Installer I get that error.

I walked through all the components and it seems that both installers
have the same components.

Any suggestions as to why my .NET version of the install does not
work?

3. PROBLEM: Windowless ActiveX controls

4. Unable to get the window handle for the 'AxActiveX' control. Windowless ActiveX controls are not supported.

Hello...
I have an MFC ActiveX that I use inside a .NET 2.0 WinForms
application.
The problem that I have is that if I change the screen resolution to
800x600, I get an exception "Unable to get the window handle for the
'AxActiveX' control. Windowless ActiveX controls are not supported."
when loading the ActiveX - at EndInit() method. On other resolution
the ActiveX is loaded.
The size of the ActiveX is (656, 343).

Any ideas?
Thanks...

5. Unable to get the window handle for the 'AxWebBrowser' control. Windowless ActiveX controls are not supported. - Microsoft .NET Framework

6. Unable to get the window handle ... Windowless ActiveX controls are not supported

Hello,

This exception :

System.InvalidOperationException was caught
  Message="Unable to get the window handle for the 'AxMOSServer' control. 
Windowless ActiveX controls are not supported."
  Source="System.Windows.Forms"
  StackTrace:
       at System.Windows.Forms.AxHost.EnsureWindowPresent()
       at System.Windows.Forms.AxHost.InPlaceActivate()
       at System.Windows.Forms.AxHost.TransitionUpTo(Int32 state)
       at System.Windows.Forms.AxHost.CreateHandle()
       at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
       at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
       at System.Windows.Forms.AxHost.EndInit()
       at Omnibus.G3.Automation.TX.MOS.MOSAXProxy.SetupMosActiveX() in 
C:\CCViews\dev_1.3_MOS\G3Automation\TX\MOS\MOSLink\MOSAXProxy.cs:line 62
       at Omnibus.G3.Automation.TX.MOS.MOSAXProxy..ctor() in 
C:\CCViews\dev_1.3_MOS\G3Automation\TX\MOS\MOSLink\MOSAXProxy.cs:line 33
       at Omnibus.G3.Automation.TX.MOS.MOSLink.InitMosActiveX() in 
C:\CCViews\dev_1.3_MOS\G3Automation\TX\MOS\MOSLink\MOSLink.cs:line 168
       at Omnibus.G3.Automation.TX.MOS.MOSLink..ctor(String channelName) in 
C:\CCViews\dev_1.3_MOS\G3Automation\TX\MOS\MOSLink\MOSLink.cs:line 45
       at Omnibus.G3.Automation.TX.MOS.frmMOSLink..ctor(String channelName) 
in C:\CCViews\dev_1.3_MOS\G3Automation\TX\MOS\MOSLink\frmMOSLink.cs:line 55
       at Omnibus.G3.Automation.TX.MOS.Program.Main(String[] args) in 
C:\CCViews\dev_1.3_MOS\G3Automation\TX\MOS\MOSLink\Program.cs:line 41
  InnerException:

has appeared on my system. The ActiveX was built aeons ago using VB6, I 
believe. It has not been touched since. The app that uses it builds OK 
(VS2008), the Active X registers OK but I get the above runtime error on 
startup.

The app and ActiveX in question have run quite happily for a while on XP and 
may even have run OK on x64 OS's (not sure on that.) Anyway, just upgraded 
my machine to Win 7 x64 and the ActiveX registered just fine, ran the app up 
and I get this. I've tried using EditBin /NXCOMPAT:No to no avail.

I'm totally out of ideas. Does anyone know the answer? If you do will you 
let me know please :-)

Thanks,

Adam.

-- 

-----------------------------------
Adam Benson
 XXXX@XXXXX.COM  


7. Windowless ActiveX dispose exception

8. Does CF 2 Support ActiveX control ?

thanks.