Allocating memory for a windows structure
I am trying to allocate memory for a SP_DEVICE_INTERFACE_DATA structure.
In a Windows based program using VS2008 I successfully used this:
Code:
#include <windows.h>
#include <winbase.h>
...
SP_DEVICE_INTERFACE_DATA deviceinterface;
SecureZeroMemory(&deviceinterface, sizeof(SP_DEVICE_INTERFACE_DATA));
...
In QT 4 using netbeans 7.2.1 I am trying to use:
Code:
#include <windows.h>
#include <winbase.h>
...
SP_DEVICE_INTERFACE_DATA devInterfaceInfo;
devInterfaceInfo =
(SP_DEVICE_INTERFACE_DATA)malloc(sizeof(SP_DEVICE_INTERFACE_DATA));
...
In QT 4 I get the following error:
Quote:
QEnumerator.cpp:57: error: no matching function for call to '_SP_DEVICE_INTERFACE_DATA::_SP_DEVICE_INTERFACE_D ATA(void*)'
c:\qtsdk\mingw\bin\../lib/gcc/mingw32/4.4.0/../../../../include/setupapi.h:722: note: candidates are: _SP_DEVICE_INTERFACE_DATA::_SP_DEVICE_INTERFACE_DA TA()
c:\qtsdk\mingw\bin\../lib/gcc/mingw32/4.4.0/../../../../include/setupapi.h:722: note: _SP_DEVICE_INTERFACE_DATA::_SP_DEVICE_INTERFACE_DA TA(const _SP_DEVICE_INTERFACE_DATA&)
I have successfully used the malloc() function in QT 4 for other structures and devtypes.
Any help would be appreciated.
Thanks
DCM
Re: Allocating memory for a windows structure
This is not a Qt problem but the gcc problem. Qt is only C++ library.
Re: Allocating memory for a windows structure
Thanks, Lesiok. I will look elsewhere.
DCM