PDA

View Full Version : mixing qt and mfc



marco.stanzani
27th December 2012, 10:17
hi there
i 'd like to use the cryptoworks for MFC DLL ()http://www.ssware.com/cryptolicensing/cryptolicensing_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

Zlatomir
27th December 2012, 10:54
For CString class with Visual Studio you can include afx.h or use atlstr.h.

anda_skoa
27th December 2012, 11:02
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,
_

marco.stanzani
30th December 2012, 11:51
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

d_stranz
30th December 2012, 18:30
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.