From: goldrake on
I guess #import and CoCreateInstance are an "either... or".
What #import does is creating wrapper classes around the
objects you specify (smart pointers). CoCreateInstance, on
the other hand, lets you access to COM interfaces directly.
Anyway, you don't have to interface to ISoftEHCI. You
have to create an instance of the SoftUSBDevice that's in
you COM dll (simulator). You also need to create an instance
of DSF (framework) It is up to the framework to hot-plug
your "DSFDevice"

"stefanes" <stefanes(a)discussions.microsoft.com> wrote in message
news:0E4536A2-13A1-4BE3-AE93-121AD99B808A(a)microsoft.com...
> Hi!
>
> I'm trying to get a simulated USB device to work using a MFC application,
> with no luck...
>
> I have a simulated USB device in a COM dll, and I want to "plug it in"
using
> my MFC application. What a do have is a working modified VBScript from the
> SoftUSBAudio sample (Test2.0HubWithAudio.wsf), but I don't want to do this
> using a VBScript...
>
> I've tried all different approaches, with no luck. The solution I would
like
> to use is something like this;
>
> #import "progid:SOFTUSB.SoftUSBDevice" no_namespace, no_auto_exclude
> #import "progid:SoftEHCI.SoftEHCI" no_namespace
> #import "progid:MyDevice.MyDevice" no_namespace
>
> ...
>
> ISoftEHCI *m_piEHCI;
>
> HRESULT hr = ::CoCreateInstance(CLSID_SoftEHCI,
> NULL,
> CLSCTX_INPROC_SERVER,
> __uuidof(ISoftEHCI),
> reinterpret_cast<void**>(&m_piEHCI));
>
> ...
>
> Best regards,
> Stefan
>


From: stefanes on
Thanks for your answer!

So i only need to import DSF.DSF and MyDevice.MyDevice?

#import "progid:DSF.DSF"
#import "progid:MobileStation.MobileStationDevice"

When I try to do this and try to do anything with e.g. MyDevice.MyDevice i
get "error C2653: 'MyDevice' : is not a class or namespace name" and "error
C2065: 'IMyDevice' : undeclared identifier"

I can't even instantiate object with e.g. "MyDevice::IMyDevice* pMyDevice;"

I think I'm missing something really fundamental... do you have any example
you could share, on how to get this to work in C++? All I have is this
VBScript, and I don't know anything about VBScripts... :)

Best regards

"goldrake" wrote:

> I guess #import and CoCreateInstance are an "either... or".
> What #import does is creating wrapper classes around the
> objects you specify (smart pointers). CoCreateInstance, on
> the other hand, lets you access to COM interfaces directly.
> Anyway, you don't have to interface to ISoftEHCI. You
> have to create an instance of the SoftUSBDevice that's in
> you COM dll (simulator). You also need to create an instance
> of DSF (framework) It is up to the framework to hot-plug
> your "DSFDevice"
>

From: stefanes on
Again, sorry for the spam! :)

The example code i'm using should of course read

....

#import "progid:DSF.DSF"
#import "progid:MyDevice.MyDevice"

....
From: stefanes on
Sorry, that should read

....

#import "progid:DSF.DSF"
#import "progid:MobileStation.MobileStationDevice"

....
From: goldrake on
I don't use #import in this case. I've only seen #import
used in high level stuff like interfacing to Ado, Excel,
and so on. If you decide to use "CoCreateInstace & Co"
instead, the Soft Loopback source code has plenty of
examples.

My SoftUSBDevice class is embedded into the application.
You're using a COM server instead so what i did is a little
different from what you have to do. CoCreate an instance
of your COM server and get the interface to its DSFDevice
(get_DSFDevice or something like that, if i remember). Also
CoCreate the DSF and call the Hot-Plug method passing the
device interface. You need to get or define the IDs of the objects
you need if you don't use #import. (COM server included)



>Thanks for your answer!
>So i only need to import DSF.DSF and MyDevice.MyDevice?
>#import "progid:DSF.DSF"
>#import "progid:MobileStation.MobileStationDevice"
>When I try to do this and try to do anything with e.g. MyDevice.MyDevice i
>get "error C2653: 'MyDevice' : is not a class or namespace name" and "error
>C2065: 'IMyDevice' : undeclared identifier"
>I can't even instantiate object with e.g. "MyDevice::IMyDevice* pMyDevice;"
>I think I'm missing something really fundamental... do you have any example
>you could share, on how to get this to work in C++? All I have is this
>VBScript, and I don't know anything about VBScripts... :)


"goldrake" <pl(a)net.earth> wrote in message
news:45de0a96$0$10624$4fafbaef(a)reader2.news.tin.it...
> I guess #import and CoCreateInstance are an "either... or".
> What #import does is creating wrapper classes around the
> objects you specify (smart pointers). CoCreateInstance, on
> the other hand, lets you access to COM interfaces directly.
> Anyway, you don't have to interface to ISoftEHCI. You
> have to create an instance of the SoftUSBDevice that's in
> you COM dll (simulator). You also need to create an instance
> of DSF (framework) It is up to the framework to hot-plug
> your "DSFDevice"
>
> "stefanes" <stefanes(a)discussions.microsoft.com> wrote in message
> news:0E4536A2-13A1-4BE3-AE93-121AD99B808A(a)microsoft.com...
> > Hi!
> >
> > I'm trying to get a simulated USB device to work using a MFC
application,
> > with no luck...
> >
> > I have a simulated USB device in a COM dll, and I want to "plug it in"
> using
> > my MFC application. What a do have is a working modified VBScript from
the
> > SoftUSBAudio sample (Test2.0HubWithAudio.wsf), but I don't want to do
this
> > using a VBScript...
> >
> > I've tried all different approaches, with no luck. The solution I would
> like
> > to use is something like this;
> >
> > #import "progid:SOFTUSB.SoftUSBDevice" no_namespace, no_auto_exclude
> > #import "progid:SoftEHCI.SoftEHCI" no_namespace
> > #import "progid:MyDevice.MyDevice" no_namespace
> >
> > ...
> >
> > ISoftEHCI *m_piEHCI;
> >
> > HRESULT hr = ::CoCreateInstance(CLSID_SoftEHCI,
> > NULL,
> > CLSCTX_INPROC_SERVER,
> > __uuidof(ISoftEHCI),
> > reinterpret_cast<void**>(&m_piEHCI));
> >
> > ...
> >
> > Best regards,
> > Stefan
> >
>
>


First  |  Prev  |  Next  |  Last
Pages: 1 2 3
Prev: already has a body
Next: problem in using ksevent