Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

winscard api call

cressttcresstt Posts: 1Member
I'm not exactly a newbie. Have been programming VB with MSSQL for about two year. I go into something I never dealt before which is API programming. Trying to understand the whole concept.


please help me to understand what value should I subtitute these parameters. Most of the examples are for VC ++. Only example of which I'm very confused is at this MSDN refrence here http://msdn.microsoft.com/library/default.asp?url=/library/en-us/secauthn/security/scardestablishcontext.asp

it says that for the ScardEstablishContext the first parameter is dwscope. In the VC example, one can straigh away send either SCARD_SCOPE_USER or SCARD_SCOPE_SYSTEM. This will not work in VB. I found a online reference for ScardEstsblishContext for VB and the code is like this
ngresult = SCardEstablishContext(2, 0, 0, mlngContext)

my question is how do you translate the first param (either SCARD_SCOPE_USER or SCARD_SCOPE_SYSTEM) to be "2" (on the above example)

there lotsa more API call which resemble the problem above like parameter dwsharemode and dvPreferredProtocols for ScardConnect (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/secauthn/security/scardconnect.asp)..how are does translated into long/integer fields. Here are the VB translated code Result = SCardConnectA(mlngContext, szReader, 2, 1, cardHandle, cardProto). I appreciate any pointers. Thanks in advance

Comments

  • BitByBit_ThorBitByBit_Thor Posts: 2,444Member
    : I'm not exactly a newbie. Have been programming VB with MSSQL for about two year. I go into something I never dealt before which is API programming. Trying to understand the whole concept.
    :
    :
    : please help me to understand what value should I subtitute these parameters. Most of the examples are for VC ++. Only example of which I'm very confused is at this MSDN refrence here http://msdn.microsoft.com/library/default.asp?url=/library/en-us/secauthn/security/scardestablishcontext.asp
    :
    : it says that for the ScardEstablishContext the first parameter is dwscope. In the VC example, one can straigh away send either SCARD_SCOPE_USER or SCARD_SCOPE_SYSTEM. This will not work in VB. I found a online reference for ScardEstsblishContext for VB and the code is like this
    : ngresult = SCardEstablishContext(2, 0, 0, mlngContext)
    :
    : my question is how do you translate the first param (either SCARD_SCOPE_USER or SCARD_SCOPE_SYSTEM) to be "2" (on the above example)
    :

    SCARD_SCOPE_USER is a constant; or in C a preprocessor definition.

    What you normally do is use an API List program to search up the Function Definition for VB and to get the values of the constants.
    You can also look in the appropriate C header files for the preprocessor definition (if you have MSVC++ installed).

    : there lotsa more API call which resemble the problem above like parameter dwsharemode and dvPreferredProtocols for ScardConnect (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/secauthn/security/scardconnect.asp)..how are does translated into long/integer fields. Here are the VB translated code Result = SCardConnectA(mlngContext, szReader, 2, 1, cardHandle, cardProto). I appreciate any pointers. Thanks in advance
    :

    Probably the same here... They are fixed values (constants) that you can look up in either an API List program or C header files.


    Greets...
    Richard

Sign In or Register to comment.