Proper QUuid usage in Qt ? (7-Zip DLL usage problems (QLibrary, QUuid GUID conversion, interfaces))
- by whipsnap
Hi,
I'm trying to write a program that would use 7-Zip DLL for reading files from inside archive files (7z, zip etc).
Here's where I'm so far:
#include QtCore/QCoreApplication
#include QLibrary
#include QUuid
#include iostream
using namespace std;
#include "7z910/CPP/7zip/Archive/IArchive.h"
#include "7z910/CPP/7zip/IStream.h"
#include "MyCom.h"
// {23170F69-40C1-278A-1000-000110070000}
QUuid CLSID_CFormat7z(0x23170F69, 0x40C1, 0x278A, 0x10, 0x00, 0x00, 0x01, 0x10, 0x07, 0x00, 0x00);
typedef int (*CreateObjectFunc)(
const GUID *clsID,
const GUID *interfaceID,
void **outObject);
void readFileInArchive()
{
QLibrary myLib("7z.dll");
CreateObjectFunc myFunction = (CreateObjectFunc)myLib.resolve("CreateObject");
if (myFunction == 0) {
cout outArchive;
myFunction(&CLSID_CFormat7z, &IID_IOutArchive, (void **)&outArchive);
}
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
readFileInArchive();
return a.exec();
}
Trying to build that in Qt Creator will lead to following error:
cannot convert 'QUuid*' to 'const GUID*' in argument passing
How should QUuid be correctly used in this context?
Also, being a C++ and Qt newbie I haven't yet quite grasped templates or interfaces, so overall I'm having trouble getting through these first steps. If someone could give tips or even example code on how for example an image file could be extracted from ZIP file (to be shown in Qt GUI later on*), I would highly appreciate that.
My main goal at the moment is to write a program with GUI for selecting archive files containing image files (PNG, JPG etc) and displaying those files one at a time in the GUI. A Qt based CDisplayEx in short.