Click here to Skip to main content
15,888,351 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a code .

VB
Dim hContext As IntPtr
Dim rc As IntPtr
Dim dwScope As Integer

Dim mszReaders(512) As Byte
Dim mszGroup(512) As Byte
Dim pcchReaders As Long

Dim curReader As String

' if a Context is established, release it first
If isContext = True Then RELCONTEXTBUTTON_Click(RELCONTEXTBUTTON, New System.EventArgs())

' Set Scope (see Scard.bas "Scopes")
dwScope = SCARD_SCOPE_USER

' Establish Context
rc = SCardEstablishContext(dwScope, 0, 0, hContext)
If rc <> OKERR_OK Then
    MESSAGETEXT.Text = (HandleError(rc))
    Exit Sub
End If

' Set maximum Length of mszReaders
pcchReaders = 2048

' Create a Multistring (terminated with two '\0's)
mszGroup(0) = &H0
mszGroup(1) = &H0
Try
    rc = SCardListReaders(hContext, mszGroup(LBound(mszGroup)), mszReaders(LBound(mszReaders)), pcchReaders)
Catch ex As Exception
    MessageBox.Show(ex.Message)

End Try

But when I execute this code on x86bit,Its work fine and value of hContext is +ve(&HCD010000) .but when I execute it on x64bit
the hContext take the -ve value(&HCD00000100000000).When I debug the code "SCardListReaders" gives "Stack Overflow Exception".
So what should be the datatype for hContext and how to remove this error
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900