Results 1 to 5 of 5

Thread: mixing qt and mfc

  1. #1
    Join Date
    Feb 2011
    Posts
    31
    Thanks
    23
    Qt products
    Qt4
    Platforms
    Windows

    Unhappy mixing qt and mfc

    hi there
    i 'd like to use the cryptoworks for MFC DLL ()http://www.ssware.com/cryptolicensin...ensing_mfc.htm to add license capability to my software. I asked ssware about this issuebut i did not get any response from them so i hope to get some answer here ... I am surprised and I wonder how they can stay in business with such a poor customer support ...

    In order to validate teh license the following code must be in the end application

    CString validationKey
    = _T("AQABAAP9Halqo3flELX/mwxLsWWgxWVPh4SXyBhZzOdQR5Lil1N584MqBijmwjjJzf4wpb UAMADAAA==");

    CCryptoLicense license(_T("NgKEANj1wjxY2c0B2HUnNevazQG4AAEHTwMg/QO2PGQ9HmrAPjkCSHE+o2IocoY9917RoCSdZyJMIPDLQ3PnlAR ihbrUOpA9"),validationKey);

    if(license.GetStatus()!=LS_Valid)
    {
    // AfxMessageBox(_T("License validation failed"));
    }
    else
    {
    Continue normal execution...
    }

    How can I embed this code in my Qt project. Basically I cannot understand what to include in my application to get access to MFC (I need CString, _T and I need to know which libraries I need ...)
    The sample project they ship with the demo does not help. It is an MFC Visual Studio project ...
    I do not need MFC GUI widget of course
    I think this is possible overall (I need to call a DLL from cryptoworks so I just need how to inteface it ...)

    Thanks for the help

  2. #2
    Join Date
    May 2010
    Location
    Romania
    Posts
    1,021
    Thanks
    62
    Thanked 260 Times in 246 Posts
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: mixing qt and mfc

    For CString class with Visual Studio you can include afx.h or use atlstr.h.

  3. The following user says thank you to Zlatomir for this useful post:

    marco.stanzani (27th December 2012)

  4. #3
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: mixing qt and mfc

    In this context it is probably jsut a normal C++ library. So you would add it (and potentially any build time dependency) to your .pro file's LIBS line and inculde directories to your INCLUDEPATH line and then use it just like you would use any other C++ library.

    Cheers,
    _

  5. The following user says thank you to anda_skoa for this useful post:

    marco.stanzani (27th December 2012)

  6. #4
    Join Date
    Feb 2011
    Posts
    31
    Thanks
    23
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: mixing qt and mfc

    ok, i got the product. the help says

    'The proper .lib file is automatically linked with your project using a #pragma comment(lib..) directive in the 'cryptolicensing.h' file. This file should be included in the 'stdafx.h' of your project. '
    how can i force inclusion of the stdafx.h in the automatically generated moc*.cpp files? does it make sense to make a lib which call the crytoworks API?
    thx

  7. #5
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: mixing qt and mfc

    You don't need stdafx.h. As the instructions say, you need *their* header file, "cryptolicensing.h". If it needs to be included when the moc file is created, put it in the header file that declares the QObject class you are moc'ing.

  8. The following user says thank you to d_stranz for this useful post:

    marco.stanzani (31st December 2012)

Similar Threads

  1. Mixing character encodings with QSql
    By Barnacle in forum Qt Programming
    Replies: 1
    Last Post: 19th March 2014, 11:08
  2. How to perform HSV Color mixing ?
    By Ashketchup in forum Qt Programming
    Replies: 1
    Last Post: 12th April 2012, 20:28
  3. Mixing Qt and c
    By Aladin in forum General Programming
    Replies: 8
    Last Post: 28th March 2011, 14:29
  4. Mixing MFC and Qt
    By Lele in forum Qt Programming
    Replies: 1
    Last Post: 11th May 2006, 14:55
  5. Mixing C and Qt
    By forloRn_ in forum Qt Programming
    Replies: 6
    Last Post: 21st February 2006, 00:56

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.