| View previous topic :: View next topic |
| Author |
Message |
angela_quests Newbie
Joined: 28 Jul 2005 Posts: 8
|
Posted: Sep 19th, 2005 08:25 PM Post subject: call function for button and mscomm |
|
|
hi, i'm a newbie on programming.
i am using smart card reader and have the sdk(gsdkpcsc.dll) for programming.
then, i already wite down all the declaratiion for the module.
i also have made the command button.
my project is,
i) when click at the READ button, it will start communication with smart card in
the card reader, then it'll get the identification number from the smart card,
12 digit.then, the number appeared at text box
ii) by clicking verify buuton,the 12 digit number is compared with the database
with m Access
iii) if matches with databse, then it will send a unique charachter such as AEI
at the serial port of my microcontrooler. this project is for 2 user.
iv) if not match, then it says, access is denied.
my problem s, i need help on the code lines for READ and VERIFY..
can anyone help?
READ > open session, commnubication, get data
VERIFY > match with database and send AEI(user 1), IOU(user 2) to serial port
i need to get 12 digit numb for this function \Declare Function JPN_IDNum Lib "gsdkpcsc.dll" _
my module code :
/********************************************************
Option Explicit
'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
' General Declaration
'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Declare Function OpenReader Lib "gsdkpcsc.dll" Alias "_OpenReader@0" _
() As Integer ' open communication session with the card reader
Declare Function cardConnect Lib "gsdkpcsc.dll" Alias "_CardConnect@12" _
(ByVal port As Integer, ByVal Rdrname As String, ByVal nRdrLen As Integer) As Long
' open communication session with the card in the reader
Declare Function CardDisconnect Lib "gsdkpcsc.dll" _
Alias "_CardDisconnect@0" _
() As Integer
' Closes communication session with the card in the reader
Declare Function CloseReader Lib "gsdkpcsc.dll" Alias "_CloseReader@0" _
() As Integer
' Closes communication session with the card reader
Declare Function CardDetect Lib "gsdkpcsc.dll" Alias "_CardDetect@4" _
(ByVal pcExplanation As String) As Integer
' Checks if card is in card reader
Declare Function ResetCard Lib "gsdkpcsc.dll" Alias "_ResetCard@0" _
() As Long
' Reset the card
Declare Function GetError Lib "gsdkpcsc.dll" Alias "_GetError@0" _
() As Integer
' returns information on last error that occured
Declare Function SelJPNApp Lib "gsdkpcsc.dll" Alias "_SelJPNApp@0" _
() As Integer
' select JPN to read JPN data
Declare Function SelJPJApp Lib "gsdkpcsc.dll" Alias "_SelJPJApp@0" _
() As Integer
' select JPJ to read JPJ data
Declare Function SelIMMApp Lib "gsdkpcsc.dll" Alias "_SelIMMApp@0" _
() As Integer
'Select IMM to read IMM data
'*************************************************************************
' JPN section
'*************************************************************************
Declare Function JPN_OrgName Lib "gsdkpcsc.dll" _
Alias "_JPN_OrgName@4" _
(ByVal pbOrgName As String) As Integer
'original name in 150 bytes
Declare Function JPN_MyKadName Lib "gsdkpcsc.dll" _
Alias "_JPN_MyKadName@4" _
(ByVal pbMyKadName As String) As Integer
' 3 lines of name stored in blocks 0f 30+30+20=80
Declare Function JPN_KPTName Lib "gsdkpcsc.dll" _
Alias "_JPN_KPTName@4" _
(ByVal pbKPTName As String) As Integer
' KPTName is 40bytes , 2 lines of name stored in blocks of 20+20=40
Declare Function JPN_IDNum Lib "gsdkpcsc.dll" _
Alias "_JPN_IDNum@4" _
(ByVal pbIDNum As String) As Integer
' ID number in 13bytes
Declare Function JPN_Gender Lib "gsdkpcsc.dll" _
Alias "_JPN_Gender@4" _
(ByVal pbGender As String) As Integer
' Gender is 1 byte(L for lelaki , P for perempuan)
Declare Function JPN_OldIDNum Lib "gsdkpcsc.dll" _
Alias "_JPN_OldIDNum@4" _
(ByVal pbOldIDNum As String) As Integer
' Old ID Number is 8 bytes
Declare Function JPN_BirthDate Lib "gsdkpcsc.dll" _
Alias "_JPN_BirthDate@4" _
(ByVal pbBirthDate As String) As Integer
' Date of birth is 4 bytes (numeric)
Declare Function JPN_BirthPlace Lib "gsdkpcsc.dll" _
Alias "_JPN_BirthPlace@4" _
(ByVal pbBirthPlace As String) As Integer
Declare Function JPN_DateIssued Lib "gsdkpcsc.dll" _
Alias "_JPN_DateIssued@4" _
(ByVal pbDateIssued As String) As Integer
Declare Function JPN_Citizenship Lib "gsdkpcsc.dll" _
Alias "_JPN_Citizenship@4" _
(ByVal pbCitizenship As String) As Integer
Declare Function JPN_Race Lib "gsdkpcsc.dll" _
Alias "_JPN_Race@4" _
(ByVal pbRace As String) As Integer
Declare Function JPN_Religion Lib "gsdkpcsc.dll" _
Alias "_JPN_Religion@4" _
(ByVal pbReligion As String) As Integer
Declare Function JPN_EastMsian Lib "gsdkpcsc.dll" _
Alias "_JPN_EastMsian@4" _
(ByVal pbEastMsian As String) As Integer
Declare Function JPN_RJ Lib "gsdkpcsc.dll" _
Alias "_JPN_RJ@4" _
(ByVal pbRJ As String) As Integer
*******************************************************/ |
|
| Back to top |
|
dougthomas Moderator
Joined: 27 Jul 2005 Posts: 271 Location: Essex, UK
|
Posted: Sep 23rd, 2005 12:00 AM Post subject: |
|
|
Hi,
You've set a difficult one here ! It's like trying to do a jigsaw when all the pieces are blank. You've got all the bits but no indication how to put them together. I don't suppose you've got any documentation with some examples in have you ?
Failing that please could you tell us where the DLL came from.
Regards
Doug _________________ If you can see the light at the end of the tunnel, it probably means there's a Train coming. |
|
| Back to top |
|
angela_quests Newbie
Joined: 28 Jul 2005 Posts: 8
|
Posted: Sep 27th, 2005 03:58 AM Post subject: |
|
|
i run F8 to get a step by step, but when went to
nResult = JPN_MyKadName(MyKadName) , it says cant make entry to dll point at JPN_MyKad@4 (the one in the module section),
i also went to thread saying need to register the dll but i can't be registered.
for your information, i already pasted gsdkpcsc.dll to the VB project folder also at drive C/windows/system32/drivers.
but still have problem at nResult = JPN_MyKadName(MyKadName)
[vbcode]
Private Sub cmd_read_Click()
Dim nResult As Integer
Dim nPort As Integer
Dim sRdrName As String
Dim lResult As Long
nResult = OpenReader
nPort = 1
sRdrName = "IRIS SCR30U 0"
lResult = cardConnect(nPort, sRdrName, Len(sRdrName))
nResult = SelJPNApp()
Dim MyKadName As String
Text1.Text = MyKadName
MyKadName = ""
nResult = JPN_MyKadName(MyKadName)
nResult = CardDisconnect()
nResult = CloseReader()
End Sub
[/vbcode]
[code] _________________ smart card reader |
|
| Back to top |
|
dougthomas Moderator
Joined: 27 Jul 2005 Posts: 271 Location: Essex, UK
|
Posted: Sep 27th, 2005 04:58 AM Post subject: |
|
|
Hi,
I don't think the DLL is the issue as you've already used it earlier in the code. First thing to do is to check that you have alias name typed in correctly in the module, this is what you have
| Code: |
Declare Function JPN_MyKadName Lib "gsdkpcsc.dll" _
Alias "_JPN_MyKadName@4" _
(ByVal pbMyKadName As String) As Integer
|
Are there any typing errors ?
| Quote: |
it says cant make entry to dll point at JPN_MyKad@4
|
Did you mean that, or did you just not type all the message correctly. ie did it object to _JPN_MyKadName@4 or JPN_MyKad@4 ?
Have you tried to use any of the other JPN routines ? Could you try JPN_OrgName for instance and see if you get a similar error.
Regards
Doug _________________ If you can see the light at the end of the tunnel, it probably means there's a Train coming. |
|
| Back to top |
|
angela_quests Newbie
Joined: 28 Jul 2005 Posts: 8
|
Posted: Sep 28th, 2005 05:36 AM Post subject: |
|
|
it object to _JPN_MyKadName@4 when the warning (debug) window appeared.
i already tested it with jpn org function but still error.
do u see any wrong coding on my programme for cmd_read? _________________ smart card reader |
|
| Back to top |
|
dougthomas Moderator
Joined: 27 Jul 2005 Posts: 271 Location: Essex, UK
|
Posted: Sep 29th, 2005 04:31 AM Post subject: |
|
|
Hi again,
I can't see anything obviously incorrect with your code but I note that you're not checking the Return codes when you are calling the functions.
It may be that none of the earlier calls are working and that there is a fundamental problem with accessing the DLL.
I assume that the documentation for the DLL tells you what successful and unsuccessful return code are. (ie what nResult and lResult should be after the various calls you make).
Have you checked that you have typed the function names in correctly and there are no spelling mistakes etc in the Module code ?
Regards
Doug _________________ If you can see the light at the end of the tunnel, it probably means there's a Train coming. |
|
| Back to top |
|
angela_quests Newbie
Joined: 28 Jul 2005 Posts: 8
|
Posted: Oct 14th, 2005 04:56 AM Post subject: no mistake |
|
|
there's no mistake at all.
i'm stucked here. _________________ smart card reader |
|
| Back to top |
|
dougthomas Moderator
Joined: 27 Jul 2005 Posts: 271 Location: Essex, UK
|
Posted: Oct 14th, 2005 05:10 AM Post subject: |
|
|
Hi again,
Must admit I'm stumped !
Is there any way you can post the documentation for the dll or is it too big?
Regards
Doug _________________ If you can see the light at the end of the tunnel, it probably means there's a Train coming. |
|
| Back to top |
|
|