5 Replies - 606 Views - Last Post: 15 November 2015 - 04:59 PM Rate Topic: -----

#1 DrWho198  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 3
  • Joined: 15-November 15

Resourcing a third party DLL - how to do this

Posted 15 November 2015 - 02:13 PM

I'm trying to access a DLL that was made for use with C#.
I know it should be possible to use this DLL in vb.net too, but since I have little experience in vb.net (just recently stepped over from vb6) I have no clue what is wrong.

For reference, the DLL that I try to use from a project called vJoy found here: http://vjoystick.sourceforge.net/site/

What I do manage to do is add the DLL as resource, after this VB.net seems to recognize all objects related to this dll.
But as soon as I access it during runtime, VB.net throws an error saying the DLL can not be found. I tried loading the file as an existing component so that VB.net would include at the location of my binary, but still this error occurs.

Can anyone help me out how to set up this dll so I can start porting the code to access the DLL from C# to vb.net.

If anyone needs the DLL's and or the documentation then please ask. But they can be found at the soundforge site aswell in the SDK download. And in case you wonder, its a 'feeder' that I'm trying to set up. So I need the 'vJoyInterfaceWrap.dll'.

Is This A Good Question/Topic? 0
  • +

Replies To: Resourcing a third party DLL - how to do this

#2 IronRazer  Icon User is offline

  • Custom Control Freak
  • member icon

Reputation: 1458
  • View blog
  • Posts: 3,700
  • Joined: 01-February 13

Re: Resourcing a third party DLL - how to do this

Posted 15 November 2015 - 02:44 PM

From what i see, vJoy is a device driver and it needs to be installed on the computer, did you do that?

Being it is a 3rd party library, you should try the links below to see about getting help with it first. The first link is a support forum for vJoy where you can ask questions about it and the second link is to contact the author of the library.

http://vjoystick.sou.../2-support/list

http://vjoystick.sou...p/contact-form1

Normally, when you add a reference to a dll, it is copied to the debug folder. However some dll`s you don`t add a reference to at all, you use PInvoke to access the dll functions. You would be better off asking these things on their forum i believe.
Was This Post Helpful? 0
  • +
  • -

#3 DrWho198  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 3
  • Joined: 15-November 15

Re: Resourcing a third party DLL - how to do this

Posted 15 November 2015 - 02:52 PM

Thank for the help.
Yeah, I already installed th driver, but you do not communicate with the drivers directly.
You are presented with a DLL and a wrapper DLL for c# and that's how you communicate.
I know of the forum on sourceforge, but the guys there hove no knowlage of VB.net and do not support it.
I know it should be pretty simple, but I'm missing something here.

If you add a wrapper dll as reference, do you still need to declare the functions?
Was This Post Helpful? 0
  • +
  • -

#4 IronRazer  Icon User is offline

  • Custom Control Freak
  • member icon

Reputation: 1458
  • View blog
  • Posts: 3,700
  • Joined: 01-February 13

Re: Resourcing a third party DLL - how to do this

Posted 15 November 2015 - 03:54 PM

Quote

If you add a wrapper dll as reference, do you still need to declare the functions?


No, if you add a Reference to it you should just import the NameSpace(s), create a new instances of it, and use the new instance to access its methods, properties, and events.

In the (Solution Explorer) tab, click on the (Show All Files) button and then expand the (References) node. Right click on the reference to your vJoy library and select (Properties). Make sure the (Copy Local) option is set to True. That is for copying the referenced library to the bin folder where the exe file is.

If it is already True then set it to False and then back to True. I see on the bottom of the link below, someone mentions that for VS2010 and who knows if it has been fixed in newer VS versions.

How to: Set the Copy Local Property of a Reference

If none of that helps then see if you are targeting the Client version of the .Net 4.0 Framework. If so then try targeting the full version. I have read a few posts about that being a problem if the dll you are referencing has a reference to the full 4.0 version.
Was This Post Helpful? 1
  • +
  • -

#5 DrWho198  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 3
  • Joined: 15-November 15

Re: Resourcing a third party DLL - how to do this

Posted 15 November 2015 - 04:20 PM

thanks, your comment is actually very helpful. about half an hour ago I was stuck on that part. But I managed to get past it. I eventually got something working. Its too late to do some more testing, but I do have some response. turns out that VB.NET Express uses x86 by default. I was using x64 dll's because I have a x64 system. Once I started using x86 dll's, the errors stopped. I've read that you can change vb.net express to compile for x64, but for now this should do.

once again. thank you for your help!
And you explained things well.
Was This Post Helpful? 1
  • +
  • -

#6 IronRazer  Icon User is offline

  • Custom Control Freak
  • member icon

Reputation: 1458
  • View blog
  • Posts: 3,700
  • Joined: 01-February 13

Re: Resourcing a third party DLL - how to do this

Posted 15 November 2015 - 04:59 PM

You`re Welcome. It figures that it was the only thing i did not cover, building the app to target x86 (32bit) or x64 (64 bit) systems. Oh well, i`m glad to see you got it figured out.

Below is two links where you can find some more details on setting the application to target different platforms. You are probably safer to just stick with targeting the x86 (32 bit) platform though.

How to: Configure Projects to Target Platforms

Google search:
Targeting 64 or 32 bit systems vb.net
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1