Use dll c++ in vb

perrotekel
10-20-2009, 03:37 AM
Hello everyone, first to congratulate for forum.

I like to use a dll made in C + + from Visual Basic, I have a file with the definitions of functions.

Are these 3 functions that I use but I really do not get it to work.

Functions c + +.


unsigned char DLLENTRY openMega(char * commPort,char useMem,char * filename);
unsigned char DLLENTRY closeMega(void);
unsigned char DLLENTRY readMega(unsigned int race,unsigned int sound);



So I have intention to implement in vb6 but I finish work.


'unsigned char DLLENTRY openMega(char * commPort,char useMem,char * filename);
Public Declare Function openMega Lib "D:\Relojes Palomas\pruebaReloj\megaint.dll" _
(ByVal commPort As String, _
ByVal useMem As String, _
ByVal filename As String) As String


'unsigned char DLLENTRY readMega(unsigned int race,unsigned int sound);
Public Declare Function readMega Lib "D:\Relojes Palomas\pruebaReloj\megaint.dll" _
(ByVal race As Integer, _
ByVal sound As Integer) As String


'unsigned char DLLENTRY getMegaData(void * p);
Public Declare Function getMegaData Lib "D:\Relojes Palomas\pruebaReloj\megaint.dll" _
(ByRef p As Integer) As String

Can help me please?



PD: sorry for my english.

OnErr0r
10-20-2009, 09:30 AM
You've made some incorrect assumptions about the data types. Unsigned char (or just char) is a single byte, not a string. Integer in C++ is a Long in VB.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum