Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

GetOpenCardName function

Status
Not open for further replies.

Denyson

Programmer
Mar 20, 2001
19
BR
I'm workink with Win98 Visual C++ 6.0 and Microsoft SDK.
I'm trying to develop something with Smartcards and PCSC.
I'm using the GetOpenCardName Microsoft SDk Function but I can't initialize the parameter lpfnConnect from OPENCARDNAME Struct.
Anybody coud help me how to initialize this parameter?
Please send me an example.

Thanks
 
This is the OPENCARDNAME Struct body:

typedef struct {
DWORD dwStructSize;
HWND hwndOwner;
SCARDCONTEXT hSCardContext;
LPTSTR lpstrGroupNames;
DWORD nMaxGroupNames;
LPTSTR lpstrCardNames;
DWORD nMaxCardNames;
LPCGUID rgguidInterfaces;
DWORD cguidInterfaces;
LPTSTR lpstrRdr;
DWORD nMaxRdr;
LPTSTR lpstrCard;
DWORD nMaxCard;
LPCTSTR lpstrTitle;
DWORD dwFlags;
LPVOID pvUserData;
DWORD dwShareMode;
DWORD dwPreferredProtocols;
DWORD dwActiveProtocol;
LPOCNCONNPROC lpfnConnect;
LPOCNCHKPROC lpfnCheck;
LPOCNDSCPROC lpfnDisconnect;
SCARDHANDLE hCardHandle;
} OPENCARDNAME, *LPOPENCARDNAME;

where:

lpfnConnect
Pointer to the caller's card connect routine. If the caller needs to perform additional processing to connect to the card, this function pointer is set to the user's connect function. If the connect function is successful, the card is left connected and initialized, and the card handle is returned.
The prototype for the connect routine is

Connect(
hSCardContext, // the card context passed in the parameter block
szReader, // the name of the reader
mszCards, // multistring containing the possible card names in the reader
pvUserData // pointer to user data passed in parameter block
);

Thanks
 
Thank you, this is what I have seen, too in MSDN. I thought that you already have a program where you use this.

The three functions below are CALLBACK Functions:
LPOCNCONNPROC lpfnConnect;
LPOCNCHKPROC lpfnCheck;
LPOCNDSCPROC lpfnDisconnect;

If you want to know how to use callback functions look for "RegisterClass Samples" or "EnumWindows Samples" in MSDN. These are functions that use Callback functions as parameter.

Good luck,s-) Blessed is he who in the name of justice and good will, shepards the week through the valley of darknees...
 
He Denyson,

I have an off topic question.
May I ask what you 're designing and for what kind of smartcards?

The reason for this is that I'm currently creating an Debug interface for Smartcards, as a sort of 'Internship' Assignment.
And well, I'm almost done, but can always use some good pointers about things to remember.

Cheers, Martini
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top