|
-
Nov 16th, 2000, 02:40 PM
#1
Thread Starter
New Member
Hi!
Is it possible to make own API call liberys in VB? So i can make a function, compile it into a dll and then call it from another program with the declare function statement?
-
Nov 16th, 2000, 03:14 PM
#2
No. VB can only create ActiveX DLL's. In order to use a function in that respect, you need to use a Standard DLL. To make a standard DLL, use C++.
-
Nov 23rd, 2000, 07:32 AM
#3
Hyperactive Member
call c++ dll
Is it possible to pass a variable into a MFC c++ dll.. if so could someone give an example of how to declare the dll and how to pass variable to it assuming it as only one parameter of type long
Many thanks
-
Nov 23rd, 2000, 07:54 AM
#4
Hyperactive Member
c++
Does anyone know how to alter code for a c++ dll to make it viewable to VB?
-
Nov 23rd, 2000, 03:40 PM
#5
Re: call c++ dll
Originally posted by gsc1ugs
Is it possible to pass a variable into a MFC c++ dll.. if so could someone give an example of how to declare the dll and how to pass variable to it assuming it as only one parameter of type long
Many thanks
Use the Declare Function statement.
Code:
Declare Function MyFunc Lib "MyLib" (ByVal MyParam As Long) As Long
-
Nov 24th, 2000, 07:51 AM
#6
Hyperactive Member
done
Thanks but didn't work.. but master it in the end here's the solution.
VB: Alias is the key calling the mangled function and byte size
Declare Function CheckDongle Lib "D:\DEVELOP\ALL16_32\SetReg\Debug\SetReg.dll" Alias "_CheckDongle@4" (ByVal nDays As Integer) As Integer
C++
#ifdef __cplusplus
extern "C" {
#endif
int __declspec(dllexport) CALLBACK CheckDongle(int lDays)
{
CDongle CInstDongle;
return CInstDongle.OnSetRegistryEntries(lDays); //EXTENDS INTO CLASS DEFINITION
}
#ifdef __cplusplus
}
#endif
-
Nov 24th, 2000, 08:01 AM
#7
Hyperactive Member
but still have related problem
I would like to pass a long value thru this function but VB as a fit.. anyone tell me a work around? int are fine
-
Nov 24th, 2000, 10:27 AM
#8
Hyperactive Member
guru's come'on
This is a problem for the Guru's com'on..! forever greatful.. i need a long... ooh eer!
-
Nov 24th, 2000, 04:11 PM
#9
1st off, the answer to your question.
Code for C++ DLL.
Code:
#include "windows.h"
extern "C" __declspec(dllexport) int _stdcall CppFunc(int num)
{
return num;
}
Code for VB.
Code:
Private Declare Function CppFunction Lib "C:\MyPath\CppDll.dll" Alias "_CppFunc@4" (ByVal num As Integer) As Integer
Private Sub Command1_Click()
Print CppFunction(34)
'returns 34 (or whatever you pass through)
End Sub
Secondly, when you ask a question give people time to answer it. You posted twice within 4 hours. Sometimes it takes days to get a response.
-
Nov 27th, 2000, 05:57 AM
#10
Hyperactive Member
exellent
Now then.. what about this long VB 4 is 32 bit why cant i send a long to c++ and return it back?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|