Solved

Visual Basic 5.0 and Visual C++ Interfacing

Posted on 1998-08-04
2
171 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
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 Month10 days, 19 hours left to enroll

632 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