use Loadlibrary in my application

Forum for discussion on different user applications
Locked
Jianjunmeng
Posts: 8
Joined: 28 Apr 2014, 12:37

use Loadlibrary in my application

Post by Jianjunmeng » 21 Nov 2014, 11:30

Hello,
I want to control a device by the application rather than only to control the virtual cursor movement. I started with modifying the feedbackDemo. I find I can not load the xxx.dll which is necessary for controlling the device by the LoadLibrary() function. The code is added to the construct of the DevicefeedbackTask (or is it supposed to added to the DeviceFeedbackTask::OnInitialize( const SignalProperties& /*Input*/ ) ?).

DeviceFeedbackTask::DeviceFeedbackTask()
: mRunCount( 0 ),
........................
commandLayer_handle (NULL),
MyInitAPI (NULL)
{
BEGIN_PARAMETER_DEFINITIONS
"Application:Window int WindowWidth= 640 640 0 % "
" // width of application window",
...........................
...........................
//We load the API.
commandLayer_handle = LoadLibrary(L"DeviceAPI.UsbCommandLayer.dll");

if(commandLayer_handle==NULL)
{
bcierr << "Error while loading library. Cannot perform Feedback Task. Leaving,,," << endl;
}
else
{
bciout << "Device API loaded Successfully" << endl;
}

}

The application executable file can be successfully built in VS2008, however, when I run the BCI2000 with this application. It always start with "Error while loading library. Cannot perform Feedback Task. Leaving,,," and cannot work correctly. I've checked all the xxx.dll, they are already in the same directory with application executable file. Could anyone help to solve this problem? Thanks a lot.
PS: A simple code with win32 console application executable file works well in the same directory, its function is control the device with basic function.

Thanks a lot.
Best,
Steve

Jianjunmeng
Posts: 8
Joined: 28 Apr 2014, 12:37

Re: use Loadlibrary in my application

Post by Jianjunmeng » 24 Nov 2014, 18:12

Hello,
I found the problem. Because I compile the application in 64bit while the dll for the device only works in 32bit. :D Thanks.
Best,
Steve

Locked

Who is online

Users browsing this forum: No registered users and 29 guests