• C10 and API to read smart card

    From Steve Shurts@21:1/5 to Jason Sixface on Mon Sep 17 12:58:16 2018
    On Tuesday, May 29, 2018 at 4:30:18 AM UTC-4, Jason Sixface wrote:
    Hi friends,
    I need to integrate a smart card reader with my clarion application.

    Windows 10 have default Winscard.dll


    Thus i made a library out of it and need to call the following 2 lines: SCardListReaders and SCardConnect

    MSDN list out the prototype as follows:-

    LONG WINAPI SCardListReaders(
    _In_ SCARDCONTEXT hContext,
    _In_opt_ LPCTSTR mszGroups,
    _Out_ LPTSTR mszReaders,
    _Inout_ LPDWORD pcchReaders
    );


    LONG WINAPI SCardConnect(
    _In_ SCARDCONTEXT hContext,
    _In_ LPCTSTR szReader,
    _In_ DWORD dwShareMode,
    _In_ DWORD dwPreferredProtocols,
    _Out_ LPSCARDHANDLE phCard,
    _Out_ LPDWORD pdwActiveProtocol
    );




    Inside the clarion global map, i put the following:-

    module('Winscard.dll')

    SCardConnect(unsigned,long,ulong,ulong,unsigned,unsigned),ulong,PASCAL,proc
    SCardListReaders(unsigned,long,long,ulong),ulong,PASCAL,proc

    end



    Then in a procedure, i populate a button and in the embed, i put the following:-

    LOC:Value = SCardConnect(hSC, ReaderName, SCARD_SHARE_SHARED, SCARD_PROTOCOL_T0, hCard, dProtocol)


    i create a local data for the following:-
    hsc - string
    ReaderName string
    hcard - long
    dprotocol - long

    i compile it and get error message.

    i am sure i am doing it wrong. what should i correct? please guide

    thanks

    Jason

    LPTSTR = CSTRING; are you sure about the LPCTSTR? If correct, try CSTRING for it, too...

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)