VM140 VB.net 2005

Received the board today and although I asked before purchasing it if the DLL works with VB.Net 2005 I cannot seem to find it.

There are sample projects for C++ and VB6; tried to convert the VB6 project into .Net 2005 and upon staring with F5 it comes with an error about value instead of 0
Tried to find a tool to convert C++ into VB.net; good luck with that…

So I can still use VB6 but that’s discontinued and have all my apps in VS.Net 2005 and need to find a way to get this working.
I tried to create a new app and created the user form and copied the code; so far so good…until I set a reference to the DLL file; then the following error comes up;
"A reference to K8061.dll could not be loaded. Please make sure that the file is accessible and that it is a valid assembly or Com component.

Do you have a DLL that I can use in VB.Net 2005 as VB6 is not really an option for me and don’t master C++.

Thanks in advance for your reply and tips.

Adrian

You can use this VB 2008 project for the K8061: box.net/shared/5n393f1ifs
This project seems to open in VB 2005 too.

[quote]until I set a reference to the DLL file[/quote]No need to set a reference. You just need to copy the DLL to the System32 folder.
(If you are using 64 bit operating system, please copy the DLL to Windows folder.)

On the CD in the folder “\K8061 extended USB interface\Vista ready software” there is a driver for Windows XP and Vista and some software examples too.
You may also download this “Vistapack” from this page: velleman.eu/distributor/supp … 8061&type=

Downloaded the vista pack and used the VS2005 -pro test code.
When I try to connect to the device I get an error message on the code line h = OpenDevice()
“Unable to load DLL ‘K8061’; The specified module could not be found. Exception result 0X8007007E”

Also tried VS2008; also get an error message on the code line h= OpenDevice()

I did copy the DLL file into the C:Windows\System32 folder

Please help.

Thanks,

  • Adrian

This is very strange. Normally the DLL file is found if located in the System32 folder.
Only if you are using a 64 bit operating system (e.g. Windows 7) then the file is not found.
Should be put into the C:\Windows folder in this case.

Or put it to the folder C:\Windows\SysWOW64
The K8061.DLL is a 32-bit file.
The 64-bit files go into System32, and 32-bit files go into SysWOW64 folder.

Saved the DLL in the c:windows, c:windows\system and c:\windows\system32 folder but doesn’t change a thing ( I am using XP Pro)
Tried to run the VC2005 code and get an error when I click on Connect ; “no WinUSBSupport on this computer”
Tried to run the VC6 version and had to convert in VS2005; that resulted in 18 errorsin the code
Tried to run the VBExpress version; get error on line intCard = OpenDevice “LoaderLock was Detected”
“Attempting managed execution inside OS loader lock”
Same error on the same line with VBPro version
Tried running VB6 version from the Vista download pack and error occurs “file not found K8061.dll”

The only version I can get going is the VB6 version that came with the CD

Sorry to say this but I am not impressed with the software provided.
I am not willing to go back to use VB6; I have all my apps in VS2005

Please provide a working DLL that I can set a reference to in the project rather then having to guinipig around with it in several folders.

Thanks
-Adrian

Have you installed the driver from the Vistapack?
After doing it, you can run the programs in the Vistapack using the DLL from the Vistapack.

In all the Vistapack example program project folders the K8061.DLL is included. It is in the \bin subfolder of the project or in the same folder with the .exe.

no I did not, please let me know how to install these and I’ll try again.

Thanks

You have to go to Device Manager.
Uninstall the current driver.
Unplug and plug the VM140 USB plug.
Install the driver from the Vistapack \Driver folder.

When driver installed, you can copy the K8061.DLL from the Vistapack \VB demo program folder to System32 folder.

Then you may download and run this new Visual Basic 2008 example project:
box.net/shared/5n393f1ifs

  • Should run without any problems…

I have it up and running now with the VS2005 Pro VB version but I would like to make some comments.

After compiling and deploying the application an error came again as the DLL K8061 could not be found.
So I copied the DLL in the C:windows folders and system & system32 sub folders; no luck.
I then copied the file into the folder where the executable was saved with the click once setup application.
Then it worked.

Not sure who your programmer is but seriously please encourage him/her to make a DLL in VS2005/2008 (VS200x allows you to make a DLL in minutes) that can be referenced to in the Demo project.
You compile and deploy and voila problem solved; all in all I have been wasting a few hours to get something quite simple up and running to the point of satisfaction.

I write apps daily for a living and write DLL’s all the time but always in a way that can be referenced to in the final application as deployment is so much easier and customer friendly.

Thanks for all your help.

Adrian

Thank you for your comments. Indeed, in the demo projects the DLL may be put into the project folders.
This may be anyhow confusing:
If the project is opened in Windows 7 x64, the DLL must copied to the new subfolder: \bin\x86\Debug
In Windows x32 the DLL should be located in the subfolder: \bin

Also people may use other compilers than VS200x having totally different subfolder structure…

It may be much easier to keep a single copy of the DLL just in one location in the Windows subfolder (either System32 or in SysWOW64 - in case of x64 operating systems).

There is no need to set a reference.

Also the DLL update to the new release is easier. No need for searching and replacing every instance of the DLL in the project subfolders. Just need to replace the DLL in one location.

Also if the program is written from scratch, there is no need to copy the DLL to some folders…

Note that there are two kinds of files with the extension ‘.dll’, one being a conventional Dynamic Link Library (what .NET would call an unmanaged DLL), and the other being a .NET Assembly file. We usually work with a Dynamic Link Library since it needs to be used in multiple programming languages, not just in .NET.