Solved

Visual Basic 5.0 and Visual C++ Interfacing

Posted on 1998-08-04
2
165 Views
Last Modified: 2013-11-25
How does one call a Visual C++ function from Visual Basic 5.0 program??
0
Comment
Question by:pmaurin
[X]
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
2 Comments
 

Expert Comment

by:Tbird
ID: 1467812
There are many was to get access to Visual C++ Code.

You can Write an OCX control in Visual C++.

You can Write a DLL that exposes functions, etc.

Which are you interested in?

If it is an OCX you merly need to add the OCX to your project and its properties methods and events are exposed.

If it is a DLL you must declare the function like any other DLL.
0
 
LVL 2

Accepted Solution

by:
shchuka earned 100 total points
ID: 1467813
You need to compile the C++ functions into a DLL

Declare your functions such as
void _declspec(DLLExport) _stdcall CFunction(paramlist)

You'll also need the DEF file, which will look like this:

LIBRARY
    dll-name
EXPORT
    CFunction

After you compiled it, you'll get a .dll file, say CFunction.dll

In you VB program, you'll declare it using

(use sub for void, fucntions for everything else)
declare sub CFunction lib "CFunction.dll" (paramlist)

After that you can call it as you would any function.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

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…
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
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…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

726 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