Find Jobs
Hire Freelancers

C DLL - Visual Basic Callback Function

$15-20 USD

Ditutup
Disiarkan lebih dari 21 tahun yang lalu

$15-20 USD

Dibayar semasa penghantaran
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
ID Projek: 2880837

Tentang projek

5 cadangan
Projek jarak jauh
Aktif 22 tahun yang lalu

Ingin menjana wang?

Faedah membida di Freelancer

Tetapkan bajet dan garis masa anda
Dapatkan bayaran untuk kerja anda
Tuliskan cadangan anda
Ianya percuma untuk mendaftar dan membida pekerjaan
5 pekerja bebas membida secara purata $8 USD untuk pekerjaan ini
Avatar Pengguna
See private message.
$3.40 USD dalam 14 hari
5.0 (97 ulasan)
6.6
6.6
Avatar Pengguna
See private message.
$17 USD dalam 14 hari
4.9 (92 ulasan)
6.0
6.0
Avatar Pengguna
See private message.
$8.50 USD dalam 14 hari
4.5 (42 ulasan)
4.6
4.6
Avatar Pengguna
See private message.
$8.50 USD dalam 14 hari
5.0 (39 ulasan)
4.4
4.4
Avatar Pengguna
See private message.
$3.40 USD dalam 14 hari
5.0 (4 ulasan)
2.2
2.2

Tentang klien

Bendera UNITED STATES
Hampton, United States
0.0
0
Ahli sejak Sep 15, 2001

Pengesahan Klien

Terima kasih! Kami telah menghantar pautan melalui e-mel kepada anda untuk menuntut kredit percuma anda.
Sesuatu telah berlaku semasa menghantar e-mel anda. Sila cuba lagi.
Pengguna Berdaftar Jumlah Pekerjaan Disiarkan
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Memuatkan pratonton
Kebenaran diberikan untuk Geolocation.
Sesi log masuk anda telah luput dan telah dilog keluar. Sila log masuk sekali lagi.