Wednesday, February 22, 2012

programing for smart card in QT how to :SOLVED

to start programing for smart card in QT is a problem , why ...........???
because the library of winscard.h in windows SDK does not properly included ,so
the problem is solved ,we will go step by step :


1- download windows sdk and install it .
2- in QT create a new project (gui or console).
3- copy this files ( SCardErr.h , winscard.h ,winsmcrd.h) from the directory of widows sdk and paste him into the directory of your project .
4-add him to your project from QT interface , after that they will appear in the
headers group in QT interface.
5-in the file .pro of your project add this

win32:LIBS += "C:/Program Files/Microsoft SDKs/Windows/v6.0A/Lib/WinSCard.lib" \
"C:/Program Files/Microsoft SDKs/Windows/v6.0A/Lib/SCardDlg.Lib" \
"C:/Program Files/Microsoft SDKs/Windows/v6.0A/Lib/wscapi.lib"


HEADERS += mainwindow.h \
winscard.h \
SCardErr.h \
winsmcrd.h


6- add this lines to your header file (mainwindow.h)

#include "winscard.h"
#include "windows.h"
#include "winnt.h"
#include "iostream"
#include "SCardErr.h"
#include "winsmcrd.h"


7- after that the smart card api is included properly.
8-you can start programing using all classes and functions in winscard.h .


**** winscard api use the windows api types so to convert from windows types to QT types (QString ,QByteArray) so i will put it here another day .


************* to get more information about smart card in QT post here your Questions or send me a mail to roky2003@gmail.com ..................................
please post your opinion ...................................................................................
authors : Debeche Ibrahim and Boukazoula Mehdi ----------from algeria