Hello, all.
After trying to wade through a great deal of undocumented and
uncommented code in order to speed up a frame capture rate, I've
decided that, for my sanity and that of my boss and any coders to
follow me, I should start over and write it myself.
I reuse a great deal of the old code, but I can't really get much
further until I get the passthrough working (Passthrough is the 'live'
video feed captured by the camera and card).
Even though the old version I'm basing this project off works first
time, every time, I can't get the ActiveX control to work without
taking action in the debugger.
First, I have this control, axDTAOLFG1. I've made sure the references
for it exist (Removed them, recompiled, re-added the refs, recompiled
again), declared it, assigned it, made it load into a picture box.
But it doesn't work, and I've traced the values for the control from
the old code and the new code, and found where the new code fails.
InitializeComponent().
In this function, axDTAOLFG1 gets the following treatment:
+++++
this.axDTAOLFG1 = new AxDTAOLFGLib.AxDTAOLFG();
this.tabControl1.SuspendLayout();
this.tabPage3.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.a xDTAOLFG1)).BeginInit();
this.SuspendLayout();
//GUI stuff here...
this.axDTAOLFG1.Anchor =
((System.Windows.Forms.AnchorStyles)((System.Windo ws.Forms.AnchorStyles.Top
| System.Windows.Forms.AnchorStyles.Right)));
this.axDTAOLFG1.ContainingControl = this;
this.axDTAOLFG1.Enabled = true;
this.axDTAOLFG1.Location = new System.Drawing.Point(4238, 8);
this.axDTAOLFG1.Name = "axDTAOLFG1";
this.axDTAOLFG1.OcxState =
((System.Windows.Forms.AxHost.State)(resources.Get Object("axDTAOLFG1.OcxState")));
this.axDTAOLFG1.Size = new System.Drawing.Size(240, 240);
//Some other GUI stuff here...
this.tabControl1.ResumeLayout(false);
this.tabPage3.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.a xDTAOLFG1)).EndInit();
//Breakpoint on this line.
this.ResumeLayout(false);
+++++
I put a breakpoint on the .EndInit() line, and found out something very
strange.
In the old code, just prior to this line, many fields of the axDTAOLFG1
control (in the debugger) were filled with:
<error: an exception of type:
{System.Windows.Forms.AxHost.InvalidActiveXStateEx ception} occurred>
And after, the activeX state exceptions were gone, replaced by:
{System.Runtime.InteropServices.COMException} System.Runtime.InteropServices.COMException
Which would allow the frame capture to run.
For the new code, I could not get this to happen unless I was looking
at (expanded the tree) a particular part of the axDTAOLFG1 values in
the debugger.
The parts I must have open is
axDTAOLFG1
->System.Windows.Forms.AxHost
->System.Windows.Forms.Control
Anything less than the .Control, and it doesn't work.
This is clearly unacceptable behavior for an application. Would someone
please help me fix this problem/explain what the debugger is doing so I
can replicate it and get this part working 'magically'? (Yes, I know
that handwaving and relying on inexplicable things to accomplish a goal
are horrible...)
Thanks in advance!