Click to See Complete Forum and Search --> : DLL
WP
Sep 19th, 2000, 10:04 AM
Can anyone tell me how to make a dll file?
so i can use it like:
declare function MyFunction lib "MyFunctions" (param1, param2)
Variable1 = MyFunction(param1, param2)
any help appreciated
WP
Make it with Visual C++ 4,5,6 and It will be able to.
I'm sorry, I do NOT know HOW to use VC++ because I'm just starting VC++ after almost pro-forming in VB.
Why did you want to do that? Why can't you use VB DLLs and do it a simpler way, or do you want a FULLY compatable DLL?
all you have to do for VBDLLs are referencing & using.
or you can have a more (I get it) functional DLL from C++, which you MUST have. Otherwise you can ask Megatron, he seems to know C++.
WP
Sep 20th, 2000, 05:32 AM
But HOW can i do that, can anyone give me a piece of code or something?
WP
I think just ANY C++ function will do. I just started C++, unlike how I excelled at VB, so I can't do anything...
I assume MEGATRON should know this...
Yes, I do know this. Add the follwoing to your C++ DLL.
#include "windows.h"
extern "C" __declspec(dllexport) void _stdcall ExportedMessageBox(HWND hWnd, LPCSTR lpszText)
{
MessageBox(hWnd, lpszText, "Title", MB_OK);
}
Now compile it and add the following to your Form.
Private Declare Function ExportedMessageBox Lib "C:\Program Files\Microsoft Visual Studio\MyProjects\CppDll\Debug\CppDll" Alias "_ExportedMessageBox@8" (ByVal hWnd As Long, ByVal lpszText As String) As Long
Private Sub Command1_Click()
ExportedMessageBox Me.hWnd, "Hello"
End Sub
WP
Sep 23rd, 2000, 06:31 AM
Good!
The only thing is that you did it in c++. And I don't know anything about c++, so I want to write it in vb. You can also make dlls in vb, but i don't now how to make functions(_messagebox@8) there.
Can't you typ in vbscript in c++ ?
WP
That's the problem with VB. It can only create ActiveX DLL's. In order to use a DLL in that respect, you must create a Standard DLL (which VB cannot make hence you use C++).
parksie
Sep 23rd, 2000, 08:22 AM
Also, if you link a .DEF file in, you can change the exported function names:
_ExportedMessageBox@8 becomes ExportedMessageBox
Megatron - I know that C functions have a _ prepended, but is the @8 the total parameter size?
Yes, the @8 is the number of bytes required for the function's arguments as well as the return value.
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.