Hi everyone,

I'm going to have a hard time explaining my issue here... please bare
with me and ask questions where I'm unclear.  I'm new to mixing C# and
COM.

I'm trying to write a C# app that interfaces with a piece of hardware
via COM.  The hardware included some sample software, sample code (MFC
C++), and apparently a COM control for interfacing with it
(several .ocx files that appear in the "COM" tab under "Add Reference"
in Visual Studio).  I was able to take the sample MFC C++ app and run
it through the Visual Studio .NET Upgrade Wizard, compile it, and run
it successfully.  It connects to the device and works as I would
expect it to.

After messing around for a while, I was able to add the reference to
the COM ocx in my C# app, instantiate it, and use it to successfully
initialize the device.  The next step, according to the sample C++ MFC
code, is to create an instance of a JobType class that includes
information on what kind of data I'm going to be sending to the
hardware, then pass it to the COM object.  Unfortunately, I don't see
this JobType object anywhere in the Object Browser of the C# app.  In
the C++ MFC app, the JobType class appears to live entirely in one of
the .h files for the sample app, NOT anywhere in the COM objects,
which might explain why I'm not seeing it.  In the C++ application, it
appears to be instantiating this JobType object (which is defined
entirely in a .h file), setting some job parameters, then casting it
to a VARIANT* before passing it to the SetJobType function of the COM
object.  The C# equivalent method SetJobType on the COM object is
asking for a "ref object".

Basically I can't get past this point, because I can't figure out what
to pass SetJobType.  The company that created the COM control told me
at one point that you can use C#, but they're not helping me at all
with this and are not providing any documentation beyond the sample
MFC app.  Any ideas on what to try next would be appreciated.

Thanks,

Tom

Reply via email to