Solved

Visual Basic 5.0 and Visual C++ Interfacing

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

Expert Comment

by:Tbird
Comment Utility
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
Comment Utility
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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

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…
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 …
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…

763 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now