-
September 23rd, 2011, 02:49 PM
#1
How to call CALLBACK from inside DLL
Hi
I make a wraper dll ...
So, I need to export to aplication some result...
Well. this is code:
xVideo.h
#ifndef xVideoDEF
#define xVideoDEF(f) WINAPI f
#endif
typedef BOOL (CALLBACK CallBackEnumerator)(char * name,GUID guid,void * user);
/*
name - the device name
GUID - the device CLSID
user - The 'user' parameter
*/
//xVideo_Capture_xxx functions flags
//...........................................
#define xVideo_AudioCapture 0x10066
#define xVideo_VideoCapture 0x10080
int xVideoDEF(xVideo_CaptureGetDevices)(DWORD devicetype,CallBackEnumerator *callback,void* user);
// Of course, this is only part of xVideo.h, But I only have problems with callbacks, This here is only one from
//several simiral callbacks
//************************************************************
main.cpp
#include <windows.h>
#include <xVideo.h>
using namespace std;
#define export extern "C" __declspec (dllexport)
BOOL APIENTRY DllMain (HINSTANCE hInst /* Library instance handle. */ ,
DWORD reason /* Reason this function is being called. */ ,
LPVOID reserved /* Not used. */ )
{
switch (reason)
{
case DLL_PROCESS_ATTACH:
break;
case DLL_PROCESS_DETACH:
break;
case DLL_THREAD_ATTACH:
break;
case DLL_THREAD_DETACH:
break;
}
/* return (double)s TRUE on success, FALSE on failure */
return TRUE;
}
extern "C" {
export double GM_xVideo_CaptureGetDevices(double devicetype){
double result=0;
if (devicetype==0){result=(double)(int) xVideo_CaptureGetDevices(xVideo_AudioCapture,&GetDevicesCallback,NULL); }
if (devicetype==1){result= (double)(int)xVideo_CaptureGetDevices(xVideo_VideoCapture,&GetVideoDevicesCallback,NULL); }
return(double)result;
}
}
// This is only error related part of all main.cpp
//************************************************************
Please What to do??? Callbacks in this way don't work
I was try to make *.def file, but i got only errors...
Tnx in advance
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|