fromm VB to a DLL written in Visual C++.

Posted on 2005-03-16
Medium Priority
Last Modified: 2010-05-02
What I need to know is how to pass a string type, by reference and as
a parameter, fromm VB to a DLL written in Visual C++. Right now I am
trying it and I am not getting values back from the dll even though I
get the values when I either debug the dll or run it from a driver app
compiled in C. The C app was compiled as a standard DLL. I also tried
it as a COM DLL and I got the same issue.

The problem is that I have a VB client app accessing a Visual C++
standard DLL. The client app needs to send a string values to the dll
and have the dll update these values for later use by the client app.

I can contact the dll and get the values it's just that when it gets
back to the client app it is gibberish. I have tried just sending the
string on way and I realise that C++ arrays and VB strings have
compatability issues.
Question by:struggling_coder_3203
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 32

Accepted Solution

Erick37 earned 1500 total points
ID: 13557224
=Short version=
How To Pass a String Between Visual Basic and Your C DLL

=Long Version=
How to pass arrays and strings between Visual Basic and C functions or between Visual Basic and C++ functions by using Visual Basic 6.0

Expert Comment

ID: 13562507
How are you referencine your DLL?

Are you doing it thru References from the Project Menu or are you referencing as you would an API?

Author Comment

ID: 13569882
Referencing as I would an API. Most of my testing was done when I
compiled the C++ project as a standard DLL. So I accessed it as I
would windows API.

I also tested it, though not as thoroughly, when I compiled the
project as a COM dll. I think I still had similar issues. Of course at
that time I made a reference from the Project menu.


Featured Post

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month11 days, 22 hours left to enroll

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question