Results 1 to 3 of 3

Thread: 7-Zip DLL usage problems (QLibrary, QUuid GUID conversion, interfaces)

  1. #1
    Join Date
    Apr 2010
    Posts
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default 7-Zip DLL usage problems (QLibrary, QUuid GUID conversion, interfaces)

    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:

    Qt Code:
    1. #include <QtCore/QCoreApplication>
    2. #include <QLibrary>
    3. #include <QUuid>
    4. #include <iostream>
    5.  
    6. using namespace std;
    7.  
    8. #include "7z910/CPP/7zip/Archive/IArchive.h"
    9. #include "7z910/CPP/7zip/IStream.h"
    10. #include "MyCom.h"
    11.  
    12. // {23170F69-40C1-278A-1000-000110070000}
    13. QUuid CLSID_CFormat7z(0x23170F69, 0x40C1, 0x278A, 0x10, 0x00, 0x00, 0x01, 0x10, 0x07, 0x00, 0x00);
    14.  
    15.  
    16. typedef int (*CreateObjectFunc)(
    17. const GUID *clsID,
    18. const GUID *interfaceID,
    19. void **outObject);
    20.  
    21. void readFileInArchive()
    22. {
    23. QLibrary myLib("7z.dll");
    24.  
    25. CreateObjectFunc myFunction = (CreateObjectFunc)myLib.resolve("CreateObject");
    26. if (myFunction == 0) {
    27. cout << "CreateObject resolve failed!";
    28. return;
    29. }
    30. else {
    31. cout << "CreateObject resolved";
    32. }
    33.  
    34. CMyComPtr<IOutArchive> outArchive;
    35. myFunction(&CLSID_CFormat7z, &IID_IOutArchive, (void **)&outArchive);
    36. }
    37.  
    38.  
    39.  
    40. int main(int argc, char *argv[])
    41. {
    42. QCoreApplication a(argc, argv);
    43.  
    44. readFileInArchive();
    45.  
    46. return a.exec();
    47. }
    To copy to clipboard, switch view to plain text mode 

    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.

  2. #2
    Join Date
    Apr 2010
    Posts
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: 7-Zip DLL usage problems (QLibrary, QUuid GUID conversion, interfaces)

    user chalup from Stackoverflow.com:

    You have to explicitly cast QUuid to GUID:

    Qt Code:
    1. QUuid boo;
    2. GUID uid = static_cast<GUID>(boo);
    To copy to clipboard, switch view to plain text mode 
    This worked! Thanks to chalup for the answer.

  3. #3
    Join Date
    Jul 2009
    Posts
    3
    Qt products
    Qt4

    Default Re: 7-Zip DLL usage problems (QLibrary, QUuid GUID conversion, interfaces)

    Hi,

    can you extract files from the zip-file with use the 7-zip DLL? If you can do this, can you share you source?

    Thanks.

Similar Threads

  1. QLibrary in PyQt
    By Urthas in forum Qt Programming
    Replies: 0
    Last Post: 30th October 2009, 18:46
  2. Apparent error in QtCore/quuid.h
    By cwp500 in forum Qt Programming
    Replies: 11
    Last Post: 18th December 2008, 20:51
  3. Showing GUID keys in Standart View Classes
    By Rus in forum Qt Programming
    Replies: 7
    Last Post: 18th April 2008, 15:35
  4. The problem with QLibrary, help me!
    By dungsivn in forum Qt Programming
    Replies: 4
    Last Post: 17th January 2008, 14:03
  5. Qlibrary
    By rianquinn in forum Qt Programming
    Replies: 5
    Last Post: 4th February 2006, 12:23

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.