|
-
Aug 11th, 2012, 06:12 PM
#1
Thread Starter
Addicted Member
[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!
-
Aug 11th, 2012, 06:51 PM
#2
Member
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
-
Aug 11th, 2012, 07:29 PM
#3
Thread Starter
Addicted Member
Re: LoadLibrary
Yes, it seems easy, but I don't know how to do it.
-
Aug 11th, 2012, 07:38 PM
#4
Member
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
-
Aug 11th, 2012, 08:35 PM
#5
Thread Starter
Addicted Member
Re: LoadLibrary
 Originally Posted by pietercdevries
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?
-
Aug 11th, 2012, 11:22 PM
#6
Member
Re: LoadLibrary
right click somewhere in the toolbox click Choose Items
Than go to the com components tab page and hid browse
-
Aug 12th, 2012, 12:59 PM
#7
Thread Starter
Addicted Member
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?
-
Aug 12th, 2012, 05:44 PM
#8
Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|