473,734 Members | 2,788 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Using DLL from a fingerprint detector in my VB - data type mismatch...?

1 New Member
Hi everyone!
i'm new at this forum as well as programming in .net
I have to develop a module that can use and configure a fingerprint detector; its documentation is written in C, as you will see below.
This is the function declaration that appears at the documentation
extern int WINAPI Wis_Diagnose (unsigned char *pwd, SYSTEMDATA
CurSystemData);
This function is for the device test. Ex, PC test if the device is ready.
It returns 0 if the device test is OK; -1 if the device test is NG

Below i write down the two structures that this function uses, as described in the manual:
Expand|Select|Wrap|Line Numbers
  1. typedef struct _SYSTEMDATA 
  2.  unsigned char Version;  //DSP version 
  3.  unsigned char IP[4];   //IP address 
  4.  unsigned char NetMask[4];  //netmask 
  5.  unsigned char Gateway[4];  //gateway 
  6.  unsigned char BaudRate;  //baudrate for external 
  7.  unsigned char DeviceID[3];  //device ID 
  8.  unsigned short UserNo;  //user number 
  9.  unsigned long LogNo;  //log number 
  10.  unsigned char AuthenMode;  //1: 1-1  2: 1:1/1:N(<50 user
  11.  unsigned char UartMode;  //1:232, 2:485 
  12.  unsigned char VoiceEN;  //1:enable 
  13.  unsigned char ServerIP[3][4]; //server IP sets 
  14.  unsigned char IDLength;  //ID length for display 
  15.  unsigned char Reserved[20]; 
  16.  
  17.   DOORDATA  DoorData;  //door setting 
  18.  
  19.   unsigned char DeviceName[16];  //device name 
  20.   unsigned char HasDevice;    //this parameter should be 3 
  21.   unsigned char ProtocolPswd;  //protocol password 
  22.   unsigned char Reserved1[7]; 
  23. }SYSTEMDATA; //112 Bytes 
  24.  
  25. //door data structure 
  26. typedef struct _DOORDATA 
  27.   unsigned short DoorOpenSec; 
  28.   unsigned short DoorOverSec; 
  29.   unsigned short AlarmTime; 
  30.   unsigned char AlarmEnable;  //0: Disable 
  31.   unsigned char Reserved[9]; 
  32. }DOORDATA; //16 bytes

Now, i have been trying to define some variables that match the ones originally in the manual; below is this code:

Expand|Select|Wrap|Line Numbers
  1. Structure doordata
  2. Dim DoorOpenSec As Short
  3. Dim DoorOverSec As Short
  4. Dim AlarmTime As Short
  5. Dim AlarmEnable As String
  6. Dim Reserved As String
  7. End Structure
  8.  
  9. Structure SystemData
  10. Dim Version As String
  11. Dim IP As String
  12. Dim NetMask As String
  13. Dim Gateway As String
  14. Dim BaudRate As String
  15. Dim DeviceID As String
  16. Dim UserNo As Short
  17. Dim LogNo As Long
  18. Dim AuthenMode As String
  19. Dim UartMode As String
  20. Dim VoiceEN As String
  21. Dim ServerIP() As String
  22. Dim IDLength As String
  23. Dim Reserved As String
  24. Dim DoorData As doordata
  25. Dim DeviceName As String
  26. Dim HasDevice As String
  27. Dim ProtocolPswd As String
  28. Dim Reserved1 As String
  29. End Structure
  30.  
And the DLLImport i declared is as follows:
Expand|Select|Wrap|Line Numbers
  1. <DllImport("C:\WisClient.dll", EntryPoint:="Wis_Diagnose", SetLastError:=True, _ 
  2. CharSet:=CharSet.Unicode, ExactSpelling:=True, _
  3. CallingConvention:=CallingConvention.StdCall)> _
  4. Public Shared Function Diagnostico( _
  5. ByVal pwd As String, _
  6. ByRef systemdata As SystemData) _
  7. As Integer
  8. End Function
Now, sometimes, i got the folowing error:
PInvokeStackImb alance was detected
Message: A call to PInvoke function ....' has unbalanced the stack. This is likely because the managed PInvoke signature does not match the unmanaged target signature. Check that the calling convention and parameters of the PInvoke signature match the target unmanaged signature.

And all the time my Vstudio doesn't respond.... (an unhandled win32 exception...)
I think the problem is in the equivalences between the C and VB.NET data types...

I will really appreciate any comments that can help me solve this problems
Thanks in advance!!

EMilio Leyes
Salta, ARgentina
Jul 31 '08 #1
0 1312

Sign in to post your reply or Sign up for a free account.

Similar topics

2
2325
by: Joh | last post by:
Hello, (sorry long) i think i have missed something in the code below, i would like to design some kind of detector with python, but i feel totally in a no way now and need some advices to advance :( data = "it is an <atag> example of the kind of </atag> data it must handle and another kind of data".split(" ")
6
12762
by: ASPfool | last post by:
Hello everyone, Please help me before I throw my computer out of the window: I'm working on a web application in classic ASP (vbscript), which is making calls to some webservices. The calls are made using SOAP - i installed the SOAP3 toolkit on my windows 2k server to enable this. The webservice calls are returning String Arrays which I can't seem to do anything useful with. The call shown below returns a string array with two...
43
5593
by: Gremlin | last post by:
If you are not familiar with the halting problem, I will not go into it in detail but it states that it is impossible to write a program that can tell if a loop is infinite or not. This is a fallacy built on the assumption of mythical infinite all powerfull machines. In reality we deal with finite machines that are capable of two states in a loop, they either terminate, or repeat themselves. In the mythical halting problem scenario...
2
2017
by: PaJeeper | last post by:
I'm trying to write code that will automatically add a specified number of records to a table using variables derived from queries. I am attempting to do this with DAO. Background. I have three tables within an Access 2000 Database. 1. IssuedCards. It contains all of the card data for cards that have been issued. 2. CardRequestTable. Used to hold user request for cards. This is
5
2034
by: junglist | last post by:
Hi guys, I've been trying to implement an editable datagrid and i have been succesful up to the point where i can update my datagrid row by row. However what used to happen was that once i updated one row, all of them were updated so i immediatelly figured out that i have to include the id of every entry in the update statement. This is where the problem is raised. My database is an Access database. The table i am updating contains a Date...
1
3280
by: amitbadgi | last post by:
I am getting the following error while converting an asp application to asp.net Exception Details: System.Runtime.InteropServices.COMException: Data type mismatch in criteria expression. Source Error: Line 233: Line 234: rs =
6
13421
by: Scott M. Lyon | last post by:
As I mentioned in my other post, I'm attempting to, using COM Interop so I can update existing VB6 code to (for several specific functions) return a Hashtable from a .NET library. I've had very little luck processing the Hashtable itself in VB6 (I can add a reference to the project so it knows what a Hashtable is, but I'm not having much luck looping through all objects in the Hashtable), so I decided to try a different idea.
2
9000
by: psychomad | last post by:
Please, can someone help me out to solve this error, i've been searching throughout my codes and yet i didnt succeed in finding the error!!!! The Error is: Server Error in '/' Application. -------------------------------------------------------------------------------- Data type mismatch in criteria expression.
19
21567
by: Lysander | last post by:
I have written a query that takes three integers representing day,month and year, forms a date from them and compares this date to the date the record was entered and returns any records where the date is more than 10 months out. The query runs fine, but I when I put the criteria of >10 I get 'Data Type mismatch' error. The code below is the original query. I have since put all the datediff bit in code, with all variables declared as date,...
0
8946
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8776
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
9236
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9182
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8186
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4550
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3261
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2724
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2180
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.