Results 1 to 11 of 11

Thread: DLL

  1. #1

    Thread Starter
    Hyperactive Member WP's Avatar
    Join Date
    Aug 2000
    Location
    Belgium
    Posts
    278

    Talking

    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

    Visual Basic 6.0 EE SP5 / .Net
    Windows XP

  2. #2
    Guest
    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.

  3. #3
    Guest

    Lightbulb

    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?

  4. #4
    Guest
    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++.

  5. #5

    Thread Starter
    Hyperactive Member WP's Avatar
    Join Date
    Aug 2000
    Location
    Belgium
    Posts
    278

    Thumbs down HOW

    But HOW can i do that, can anyone give me a piece of code or something?

    WP

    Visual Basic 6.0 EE SP5 / .Net
    Windows XP

  6. #6
    Guest
    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...

  7. #7
    Guest
    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

  8. #8

    Thread Starter
    Hyperactive Member WP's Avatar
    Join Date
    Aug 2000
    Location
    Belgium
    Posts
    278

    Wink 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

    Visual Basic 6.0 EE SP5 / .Net
    Windows XP

  9. #9
    Guest
    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++).

  10. #10
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    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

  11. #11
    Guest
    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
  •  



Click Here to Expand Forum to Full Width