Solved

Visual Basic 5.0 and Visual C++ Interfacing

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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

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

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

734 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