Find Jobs
Hire Freelancers

C DLL - Visual Basic Callback Function

$15-20 USD

Closed
Posted over 21 years ago

$15-20 USD

Paid on delivery
I'm primarily a Visual Basic programmer and I'm making calls to a DLL written in C. I have no problems using the DLL except when trying to implement a callback function in VB. All I need are the few lines of Visual Basic code that will implement the callback. Just want a simple example. I can only offer the header file, not the DLL. Below is the header file: #ifndef _USBCDDLL_HPP #define _USBCDDLL_HPP #define DEVICE_COMMANDOK 0 #define DEVICE_IDERROR 1 #define DEVICE_BUSY 2 #define DEVICE_UNKNOWERROR 3 extern "C" { typedef void (CALLBACK* CDDeviceChangePROC )(int); WINUSERAPI VOID WINAPI InitUSBCDLibrary(); WINUSERAPI VOID WINAPI CloseUSBCDLibrary(); WINUSERAPI VOID WINAPI SetCDCallbackProc( CDDeviceChangePROC lpProc ); WINUSERAPI int WINAPI GetDeviceNumber(); WINUSERAPI int WINAPI EnumDevice( int); // CD Device Operate function below WINUSERAPI int WINAPI USBCDReset( int ID ); WINUSERAPI int WINAPI USBCDMoveto( int ID, int Index ); WINUSERAPI int WINAPI USBCDGetCDDown( int ID ); WINUSERAPI int WINAPI USBCDLEDON( int ID ); WINUSERAPI int WINAPI USBCDLEDOFF( int ID ); WINUSERAPI int WINAPI USBCDGetStatus( int ID ); } #endif ADDITIONAL INFORMATION Here's some text from the documentation provided to me. Keep in mind I'm looking for the implementation that will work in VB. Our library support a callback function, when device is add or remove, you callback function will called with now device number pass in. The callback function should be below type: typedef void (CALLBACK* CDDeviceChangePROC )(int); use SetCDCallbackProc( CDDeviceChangePROC lpProc ) to set your callback function. Ex : // Callback function void CALLBACK OnCDDeviceChange( int nDeviceNumber ) { // Do what you want to do when device changed ( because user add or remove device ) } in your main code, use below code to set callback function: SetCDCallbackProc( (CDDeviceChangePROC)OnCDDeviceChange ); **Added Note** I have already tried the 'standard' callback procedure's as is used with the Win32 APIs using addressof. But, I get a runtime error: Run-time error '49' Bad DLL calling convention. ## Deliverables 1) Complete and fully-functional working program(s) in executable form as well as complete source code of all work done. ## Platform Win32 Visual Basic
Project ID: 2880837

About the project

6 proposals
Remote project
Active 21 yrs ago

Looking to make some money?

Benefits of bidding on Freelancer

Set your budget and timeframe
Get paid for your work
Outline your proposal
It's free to sign up and bid on jobs
6 freelancers are bidding on average $9 USD for this job
User Avatar
See private message.
$3.40 USD in 14 days
5.0 (92 reviews)
6.4
6.4
User Avatar
See private message.
$17 USD in 14 days
4.9 (92 reviews)
6.0
6.0
User Avatar
See private message.
$12.75 USD in 14 days
5.0 (34 reviews)
5.4
5.4
User Avatar
See private message.
$8.50 USD in 14 days
4.5 (41 reviews)
4.6
4.6
User Avatar
See private message.
$8.50 USD in 14 days
5.0 (38 reviews)
4.4
4.4
User Avatar
See private message.
$3.40 USD in 14 days
5.0 (4 reviews)
2.2
2.2

About the client

Flag of UNITED STATES
United States
0.0
0
Member since Sep 15, 2001

Client Verification

Thanks! We’ve emailed you a link to claim your free credit.
Something went wrong while sending your email. Please try again.
Registered Users Total Jobs Posted
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Loading preview
Permission granted for Geolocation.
Your login session has expired and you have been logged out. Please log in again.