Error When Running PCAN-Basic

The free CAN Software API (Application Programming Interface) for Windows®
Locked
kbachovchin
Posts: 2
Joined: Thu 30. Jul 2020, 21:55

Error When Running PCAN-Basic

Post by kbachovchin » Thu 30. Jul 2020, 22:13

Hello,

I downloaded the PCAN-Basic API from the website
https://www.peak-system.com/fileadmin/m ... -basic.zip

I’m trying to run the PCANBasicExample.vbproj from the following folder that gets installed
pcan-basic\PCAN-Basic API\Samples\VB

However, when I attempt to run the project from inside Visual Studio I get the following error message:
“Unable to find the library: PCANBasic.dll”

Looking at the ReadMe.txt, I see it says:

If you build an application that uses the PCANBasic.dll, you need to to copy
the PCANBasic.dll manually to your Windows System directory.
Windows 32-bit systems:
32-bit DLL > Windows\System32
Windows 64-bit systems:
32-bit DLL > Windows\SysWOW64
64-bit DLL > Windows\System32

I’m using a 64-bit PC, so I copied PCANBasic.dll from pcan-basic\PCAN-Basic API\x64 to C:\Windows\SysWOW64. However, the same error “Unable to find the library: PCANBasic.dll” still occurred when running the project inside Visual Studio

I next tried to also copy the 32-bit PCANBasic.dll from pcan-basic\PCAN-Basic API\Win32 to C:\Windows\System32 even though I am using a 64-bit PC. After this, I got a different error when running the project in Visual Studio:

System.InvalidOperationException: 'An error occurred creating the form. See Exception.InnerException for details. The error is: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)'. Inner Exception. BadImageFormatException: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B

What do I need to do to resolve these errors so that I can run the project in Visual Studio?

Thank you,

kbachovchin
Posts: 2
Joined: Thu 30. Jul 2020, 21:55

Re: Error When Running PCAN-Basic

Post by kbachovchin » Thu 30. Jul 2020, 22:21

I figured out my mistake. According to the ReadMe.txt, The 32-bit DLL needs to be copied to Windows\SysWOW64 and the 64-bit DLL needs to be copied to Windows\System32. That's confusing, but it works after doing that.

User avatar
U.Wilhelm
Sales & Support
Sales & Support
Posts: 1189
Joined: Fri 10. Sep 2010, 19:34

Re: Error When Running PCAN-Basic

Post by U.Wilhelm » Fri 31. Jul 2020, 08:25

No Problem - you are not the first who was confused about the naming that Microsoft use here...
we have some extra threads about this issue:
LINK1
and
LINK2
--------------------------------
PEAK-System Technik
Technical Support Team
support@peak-system.com
-------------------------------

Locked