|
Thread: DLL
-
Sep 19th, 2000, 10:04 AM
#1
Thread Starter
Hyperactive Member
Can anyone tell me how to make a dll file?
so i can use it like:
Code:
declare function MyFunction lib "MyFunctions" (param1, param2)
Variable1 = MyFunction(param1, param2)
any help appreciated
WP
-
Sep 19th, 2000, 11:34 PM
#2
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.
-
Sep 19th, 2000, 11:36 PM
#3
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?
-
Sep 19th, 2000, 11:38 PM
#4
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++.
-
Sep 20th, 2000, 05:32 AM
#5
Thread Starter
Hyperactive Member
HOW
But HOW can i do that, can anyone give me a piece of code or something?
WP
-
Sep 21st, 2000, 10:50 PM
#6
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...
-
Sep 22nd, 2000, 04:39 PM
#7
Yes, I do know this. Add the follwoing to your C++ DLL.
Code:
#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.
Code:
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
-
Sep 23rd, 2000, 06:31 AM
#8
Thread Starter
Hyperactive Member
THank you
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
-
Sep 23rd, 2000, 08:03 AM
#9
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++).
-
Sep 23rd, 2000, 08:22 AM
#10
Monday Morning Lunatic
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?
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Sep 23rd, 2000, 11:30 AM
#11
Yes, the @8 is the number of bytes required for the function's arguments as well as the return value.
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
|