1. Install and register a 32bit version of the OCX in Program Files(x86)\ourcompany\myControl\ (32 bit version of the OCX)
2. Install and register a 64bit version of the OCX in System32 (64 bit version of the OCX)
3. Create a new windows forms project in VS2012, VB personality
4. Make sure both platform and target are set for "any cpu"
4. Drag the controls onto a form and create a small sample program. This creates the assemblies.
{"Access violation at address 0000000000737967 in module 'MyControl.ocx'. Read of address 0000000046DB4898"}
So "MyControl.Control1" is the assembly call to a method that returns a message (event) back from the API.
System.Runtime.InteropServices.COMException was unhandled
ErrorCode=-2147418113
HResult=-2147418113
Message=Access violation at address 0000000000737967 in module 'MyControl.ocx'. Read of address 000000006EAB4898
Source=myControl.Control1
StackTrace:
at MyControl.IControl1.Send()
at AxMyControl.Control1.Sendl()
at WindowsApplication1.Form1.Button1_Click(Object sender, EventArgs e) in C:\Users\Fred\AppData\Local\Temporary Projects\WindowsApplication1\Form1.vb:line 12
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
at WindowsApplication1.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
Do I need to manually create 64bit assemblies for the OCX? If so, where do I put them? Why doesn't Visual Studio generate the correct ones? How can I debug into the process to see which line inside the ActiveX or the interop assemblies is causing
the problem? Thank you.