"tropictroop" <tr****************@mail.codecomments.com> wrote:
__interface IObject1 : IDispatch
{
HRESULT COMTry([in]HDEVINFO DeviceInfoSet,[in]MYSTRUCT *ptr,[in]BSTR
*bstr);
};
error MIDL2139 : type of the parameter cannot derive from void or void
* : [ Type 'HDEVINFO' ( Parameter 'DeviceInfoSet' ) ]
Actually DeviceInfoSet is a variable of type HDEVINFO(HDEVINFO defined
as PVOID in SetUpAPI.h). Any help would be appreciated.
According to
http://msdn.microsoft.com/library/de...ler_errors.asp :
"MIDL2139: type of the parameter cannot derive from void or void*
MIDL is a strongly typed language. All parameters transmitted over the
network must be derived from one of the MIDL base types. MIDL does not
support void as a base type. You must change the declaration to a valid MIDL
type."
In short, you can't pass HDEVINFO objects to an MIDL interface, because
they're not typesafe. Instead, use SetupDiEnumDeviceInfo to get access to
the device's instance ID DevInst, pass this through the MIDL interface, and
use SetupDiOpenDeviceInfo to regain access to it on the other side. I
haven't tried this - you might have to pass other information from
PSP_DEVINFO_DATA as well and/or use other device info functions.
More generally, whenever you have to pass an object which is not
MIDL-compliant, try instead to obtain a unique identifier for that object in
the form of an integer or string that you can use to find it again in the
called function. I hope this helps.
--
Derrick Coetzee, Microsoft Speech Server developer
This posting is provided "AS IS" with no warranties, and confers no rights.