Reputation: 31
I am extending the compatibility of my application from visio 32-bit to visio 64 bit. I am using visio 2013 on win7(64) machine. I am getting exception of windowless ActiveX control is not supported. I have tried both KB 980533 and Readme sample file provided with Visi SDK for buidling solution for 64-bit system on this location \VisSDK\Samples\Readme Samples 64bit.htm. I have tried DEP solution but not working.
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()
{"Unable to get the window handle for the 'AxDrawingControl' control. Windowless ActiveX controls are not supported."}
System Info:
OS: Windows 7 64 bit Visio: Visio 2013 64 bit Target Platform:.Net 4.5, Any CPU Interop: AxInterop.Microsoft.Office.VisOcx.dll (created on the 32 bit machine) Visio Drawing Control: VISOCX.DLL 64 bit (yes, it's registered) IDE: Visual Studio 2013 Professional
Upvotes: 2
Views: 2743
Reputation: 3352
I finally got our solution to work using 64-bit.
The magic was that I realized that I didn't actually need the control in the XAML; so what I ended up doing was removing the control from the XAML page, and instantiating it from the constructor of the .xaml.cs code.
So: follow the instructions in this link to build a custom control. I think you have to build using the 64-bit version of MSBuild.exe as noted in the link you provided. This is apparently only required when you are creating the custom control; I was able to build the solution directly from VS (but it also worked correctly when built by MSBuild, so it works in automated builds, as well).
public
and refactor:rename it from axDrawingControl1
to AxVisioControl
(most importantly, don't forget this.AxVisioControl.Name = "AxVisioControl";
)For your x86/32-bit solution, copy & reference both VisioAxControl.dll
and AxMicrosoft.Office.Interop.VisOcx.dll
into a folder somewhere in the solution.
Save, copy/move, and open the custom control project in a build environment with 64-bit Visio installed
MSBuild_Path\MSBuild.exe /p:Configuration=Release /p:Platform=x64 your_project_file_name
(for me, MSBuild_Path is C:\Windows\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe) to build the custom control project to create the WPF control DLL for use in the final x64 solution build/bin/Release/VisioAxControl.dll
and /obj/Release/AxMicrosoft.Office.Interop.VisOcx.dll
.<WindowsFormsHost name="MyWindowsFormsHost"></WindowsFormsHost>
control.In the code-behind of the XAML, in the constructor:
using VisioAxControl;
public DesignView()
{
InitializeComponent();
var avc = new VisioAxControl() { Name = "vControl" };
this.MyWindowsFormsHost.Child = avc;
this._avc = avc.AxVisioControl; // for later reference, such as adding shapes
}
Upvotes: 2