Results 1 to 8 of 8

Thread: [RESOLVED] LoadLibrary

  1. #1
    Lively Member
    Join Date
    Mar 12
    Posts
    109

    Resolved [RESOLVED] LoadLibrary

    I'm trying to use LoadLibrary and GetProcAddress to load functions from a C++ dll. The problem I'm having is I don't know how to actually use the function I've loaded.

    Here's some code:

    Code:
    Private Sub Main_Load(sender As Object, e As System.EventArgs) Handles Me.Load
            Dim LibraryHandle As IntPtr = LoadLibrary("C:\instant.dll")
            Dim FunctionHandle As IntPtr = CType(GetProcAddress(CInt(LibraryHandle), "Instant_Dialog"), IntPtr)
        End Sub
    So, how do I use the function? Also, I want to add the dll as a resource instead of linking it to the directory, but I get an error when I use, "Me.Resources.Instant.dll")

    Any suggestions? Thanks!

  2. #2
    Member
    Join Date
    Mar 11
    Posts
    44

    Re: LoadLibrary

    Hi,
    I don't know much about dll's but it seem easy.
    You are putting it in two variables which have a name and a value.
    Now you have to sent your variable value to a control or a system object.
    Pieter

  3. #3
    Lively Member
    Join Date
    Mar 12
    Posts
    109

    Re: LoadLibrary

    Yes, it seems easy, but I don't know how to do it.

  4. #4
    Member
    Join Date
    Mar 11
    Posts
    44

    Re: LoadLibrary

    This might sound stupid but what is the reason to load the dll
    What is the dll its function
    why dont you import the dll in the toolbox and then use it

  5. #5
    Lively Member
    Join Date
    Mar 12
    Posts
    109

    Re: LoadLibrary

    Quote Originally Posted by pietercdevries View Post
    This might sound stupid but what is the reason to load the dll
    What is the dll its function
    why dont you import the dll in the toolbox and then use it
    I didn't know I could do that. How can I do that?

  6. #6
    Member
    Join Date
    Mar 11
    Posts
    44

    Re: LoadLibrary

    right click somewhere in the toolbox click Choose Items
    Than go to the com components tab page and hid browse

  7. #7
    Lively Member
    Join Date
    Mar 12
    Posts
    109

    Re: LoadLibrary

    Ok, well that didn't work very well. I imported the dll, but it doesn't appear in the toolbox. Anyone have any suggestions about my original problem? Using loadlibrary to use functions in a dll?

  8. #8
    Member
    Join Date
    Mar 11
    Posts
    44

    Re: LoadLibrary

    Someone can only help you if you tell us what you want to do with the dll.
    If you baking something and ask how much sugar should I put than someone needs to know what you are baking.
    Pieter

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •