Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > General > Use dll c++ in vb

Thread Tools Display Modes
Old 10-20-2009, 03:37 AM
perrotekel perrotekel is offline
Join Date: Jul 2007
Posts: 1
Default Use dll c++ in vb

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.
Reply With Quote
Old 10-20-2009, 09:30 AM
OnErr0r's Avatar
OnErr0r OnErr0r is offline
Obsessive OPtimizer

* Guru *
Join Date: Jun 2002
Location: Debug Window
Posts: 13,743

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.
Quis custodiet ipsos custodues.
Reply With Quote

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..