Visio Drawing Control on x64 initialization error
-
Wednesday, July 14, 2010 8:17 PM
I have an an application that uses the Visio Drawing Control as the foundation for a diagramatic engineering design modeling
language that is an addin to a 3D CAD program. It is added to the CAD program's interface indirectly as an ActiveX control
(a control on a Form within a control).
It has been running under Visio 2003 for the last five years and I've recently ported successfully to Visio 2010 32 bit.
I have just created an x64 version of my app. With the exception of Visio, the rest of the substantial application runs just fine.
My 64 bit build parallels the 32 bit version but fails trying to initialize the Visio Drawing Control with the error:
"System.InvalidOperationException: Unable to get the window handle for the 'AxDrawingControl' control. Windowless ActiveX
controls are not supported.
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 ApprenticeNET.APVisioControl.InitializeComponent() at ApprenticeNET.APVisioControl..ctor(String sHostID)
at ApprenticeNET.Mentor.LoadMentorDrawingCreateUI(FileObject oaFile, Boolean bShow)
at ApprenticeNET.Mentor.DisplaySessionEditors(WorkFile oWorkFile, Workspace oSpace, VoidDocManagerControl oControl)
at ApprenticeNET.Server.StartApplication(WorkFile oaFile, Boolean& bCancel)
at ApprenticeNET.MentorServer.StartApplication(WorkFile oaFile)
at ApprenticeNET.MentorServer.OpenProject()
at GenusSoftware.Power2KnowledgeEditorControl.KnowledgeEditorControl.MenuFileOpen_Click(Object sender, EventArgs eArgs)
in C:\\Apps\\Power2\\Power2KnowledgeEditorControl\\KnowledgeEditorControl.cs:line 337"Other information:
- Only the Cad program's 64 bit version runs on a 64 bit OS. Since my application is an addin to the CAD program, it runs in-process so must also be 64 bit.
- When I drop the 64 bit Visio Drawing Control directly into the 64 bit CAD program, it initializes just fine, so I have to conclude that neither the Visio Drawing Control, nor the interop, nor the VISOCX.DLL by themselves are the problem.
Working version (32 bit):
OS: Windows XP SP3 32 bit
Visio: Visio 2010 32 bit
Target Platform: .Net 3.5, Any CPU
Interop: AxInterop.Microsoft.Office.VisOcx.dll
Visio Drawing Control: VISOCX.DLL 32 bit
CAD program: SolidWorks 2010 32 bit
IDE: Visual Studio 2010 Professional
COM Registration: Visual Studio default 32 bitNot working version (64 bit):
OS: Windows 7 64 bit
Visio: Visio 2010 64 bit
Target Platform: .Net 3.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)
CAD program: SolidWorks 2010 64 bit
IDE: Visual Studio 2010 Professional
COM Registration: Post build event 64 bitExcept for the differences listed above, the code identical.
Does anyone have any experience with this issue?
Thanks.
All Replies
-
Friday, July 16, 2010 3:57 PMModerator
There is an article that discusses the challenge of incorporating a Visio 2010 64-bit control in applications, and provides steps on how to port form 32-bit to 64-bit. You could review it to see if there are steps that still need to be performed:
KB article 980533 / You cannot add the Microsoft Visio 14.0 drawing control to a Windows Form application in Visual Studio if you have the 64-bit version of Visio 2010 installedAlso, since all of the sample apps and add-ins that come packaged with the Visio 2010 SDK are set up for 32-bit systems, there is a detailed read me document on how to transport these to 64-bit systems. The file is located in the SDK folder:
\VisSDK\Samples\Readme Samples 64bit.htmPlease review the steps relating to porting the Office Plan sample from 32-bit to 64-bit, to ensure that the process works for your application as well. If you tried to perform some of the tasks, and they aren't working in your solution, let me know.
Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. Regards, Barb Way MCTS, MCSE, MCDBA Microsoft Online Community Support- Marked As Answer by Sally TangModerator Tuesday, July 20, 2010 4:34 AM
- Unmarked As Answer by Barb [MSFT]Microsoft Employee, Moderator Tuesday, August 03, 2010 3:24 PM
-
Tuesday, August 03, 2010 2:29 PM
Barb,
I was already adding the Visio drawing control to a form on my 32 bit machine and letting Visual Studio generate the code. I then moved these files, including AxInterop.Microsoft.Office.Interop.VisOcx.dll, to my 64 bit machine per KB article 980533.
It took me a while to get all the supporting .dlls, but I was finally able to compile to the x64 platform (instead of Any CPU) per the recommendations that came with the Visio sample code.
I was already registering ActiveX controls for COM interop using post-build events.
I don't use Visual Studio to create the install, so this is not an issue.
The problem persists. It crashes in the same place.
SolidWorks 2011 Beta allowed me to drop my control (that has the Visio 2010 drawing control embedded) as a .Net control instead of an ActiveX control. This changed nothing.
I have stepped through this code in the debugger on both the 32 bit machine and the 64 bit machine and they are identical down to the data in the data structures (except for machine default colors and the size of the Handle) until the point where the 64 bit version crashes (in .EndInit()).
I have exhausted all my ideas. This is becoming an emergency as more of my customers are buying computers with x64 Windows.
Any more ideas?
-
Tuesday, August 03, 2010 3:27 PMModerator
Thank you for the update, you appear to have completed the conversion steps that we have documented. It seems like the issue is deeper than we can resolve through this medium, and requires a more in-depth level of support.
For direct support options, please visit the below link to see the various paid support options that are available to better meet your needs. http://support.microsoft.com/default.aspx?id=fh;en-us;offerprophone
Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. Regards, Barb Way MCTS,MCSE,MCDBA Microsoft Online Community Support- Marked As Answer by Sally TangModerator Tuesday, August 17, 2010 5:52 AM
-
Friday, April 13, 2012 12:33 PMDid you manage to find a solution for this problem? On my developement machine I get 9 crashes at exactly the same line of code in 10 tries when I run my code (on a 64 bit machine but with a x86 target system).
-
Friday, April 13, 2012 2:04 PM
Yes.
Setting the HostID property on the Visio Drawing Control will cause Visio to hang or crash.
Microsoft now recognizes this to be a bug and has committed to fixing it.
In the meantime, DO NOT set the HostID property or bad things happen.
This applies (at a minimum) to version 14.0.6112.5000. I have this problem on both 32 and 64 bit versions of Visio.
- Tim

