Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Question abou Visual Basic DLL

Posted on 1999-06-29
6
Medium Priority
?
162 Views
Last Modified: 2013-11-25
1. I have DLL function that was created for Visual Basic.
2. I know how can i to use this function in Visual Basic,
   simply by following declaration:
   Private Declare Function myName Lib "libname" () As type
3. How can i to define this DLL function in Microsoft
   Visual C++ 5.0???
   I don't have sources of the DLL.
4. Thank you very much in advance.
0
Comment
Question by:alexgor
[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
6 Comments
 
LVL 6

Expert Comment

by:clifABB
ID: 1520766
If the dll was created specifically for VB, odds are that you cannot use it in C++.  VB uses string pointers in an odd way that C++ doesn't support.

0
 
LVL 2

Expert Comment

by:thew00d
ID: 1520767
If your DLL is an ActiveX DLL you do not need to declare it, you just set a reference to it.


0
 
LVL 13

Accepted Solution

by:
Mirkwood earned 100 total points
ID: 1520768
It is a general misunderstanding that VB dll can export function.
Public functions in a dll are not exported.
VB cannot export functions like C that can. I repeat CANNOT do that.
The only DLL's that VB can make are ActiveX dll's.

What you can do is put your functions that your want to export in a class which is "globalmultiuse" Now application that use this DLL can make a reference to this DLL like any ActiveX dll. They can now use the functions.

BTW: Using a class to reference your functions has the advantage that the location of the DLL is not important anymore. If your are referencing exported functions, that you need the location of the DLL or the DLL should be in your path.

1) Create two projects:
       a) Tstclient (Standard Exe)
       b) TstServer (ActiveX dll)

2) Add a class TstClass to TstServer

3) Change property of class to "GlobalMultiUse"

4) Add functions to TstClass
          TstMyFunction1
          TstMyFunction2

5) Add TstServer as reference to TstClient

6) Now you can use TstMyFunction1 and TstMyFunction anywhere in TstClient.
0
Technology Partners: 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!

 

Author Comment

by:alexgor
ID: 1520769
To Mirkwood.
After i create active x how can define my function in the
C++.
Thank you very much.
0
 
LVL 13

Expert Comment

by:Mirkwood
ID: 1520770
You cannot easily
You have to connect to it using a COM mechanism for example ATL...

Choose project/add to project/ component and controls and select the TstClass as mentioned in my example


0
 
LVL 6

Expert Comment

by:clifABB
ID: 1520771
alexgor:
If, as you state in your original question, you use your dll in VB by declaring the function(s), then it is not an ActiveX dll.
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
Suggested Courses

704 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