03-13-2008 12:10 AM
03-14-2008 02:30 PM
03-14-2008 04:54 PM
@Andrew Chang wrote:
All parameters are correctly connected. Where is the problem?
09-07-2008 03:18 AM
hello,
i have a simmilar problem. could anyone please take a look at following code:
// ant_sendevent.cpp : Definiert die exportierten Funktionen für die DLL-Anwendung.
//
#include "stdafx.h"
#include <stdio.h>
#include "ant_sendevent.h"
#include "extcode.h" //labview inlcude
#include <cstdlib>
//definitonen für ANT_Load und UnLoad
static HMODULE hANTdll;
static BOOL bLoaded = FALSE;
UCHAR *aucResponseBuffer;
UCHAR *aucChannelEventBuffer;
LVUserEventRef *antEvent;
LVUserEventRef *antResponse;
char* myeventbuffer[10];
char* myresponsebuffer[10];
//Functionen der ANT DLL
P_ANT_ARF ANT_AssignResponseFunction;
P_ANT_AEF ANT_AssignChannelEventFunction;
// Dies ist das Beispiel einer exportierten Funktion.
///////////////////////////////////////////////////////////////////////
ANT_SENDEVENT_API BOOL ANT_Load(void)
{
if (bLoaded)
return TRUE;
hANTdll = LoadLibraryA("ANT_DLL.dll");
if (hANTdll == NULL)
return FALSE;
ANT_AssignResponseFunction = (P_ANT_ARF) GetProcAddress(hANTdll, "ANT_AssignResponseFunction");
ANT_AssignChannelEventFunction = (P_ANT_AEF) GetProcAddress(hANTdll, "ANT_AssignChannelEventFunction");
if (ANT_AssignResponseFunction == NULL)
return FALSE;
if (ANT_AssignChannelEventFunction == NULL)
return FALSE;
bLoaded = TRUE;
return TRUE;
}
///////////////////////////////////////////////////////////////////////
ANT_SENDEVENT_API BOOL ANT_UnLoad(void)
{
if (hANTdll != NULL)
{
FreeLibrary(hANTdll);
}
bLoaded = FALSE;
return FALSE;
}
//my CallBack Function for Events
BOOL ANT_ChannelEventFunction(UCHAR ucChannel, UCHAR ucEvent)
{
char* ucChannel_ = reinterpret_cast<char*>(ucChannel);
char* ucEvent_ = reinterpret_cast<char*>(ucEvent);
strcpy(myeventbuffer[10], (char*)ucChannel);
strcpy(myeventbuffer[10], (char*)ucEvent);
SendEvent(antEvent,myeventbuffer[10]);
return TRUE;
}
//my CallBack Function for Response
BOOL ANT_ResponseFunction(UCHAR ucChannel, UCHAR ucResponseMesgID)
{
char* ucChannel_ = reinterpret_cast<char*>(ucChannel);
char* ucResponseMesgID_ = reinterpret_cast<char*>(ucChannel);
strcpy(myresponsebuffer[10], (char*)ucChannel_);
strcpy(myresponsebuffer[10], (char*)ucResponseMesgID_);
SendResponse(antResponse,myresponsebuffer[10]);
return TRUE;
}
ANT_SENDEVENT_API BOOL functioncaller(UCHAR ucChannel_, UCHAR* aucResponseBuffer, UCHAR* aucChannelEventbuffer)
{
aucChannelEventBuffer[MESG_DATA_SIZE];
aucResponseBuffer[MESG_RESPONSE_EVENT_SIZE];
if(ANT_AssignResponseFunction != NULL && ANT_AssignChannelEventFunction != NULL)
{
ANT_AssignResponseFunction(ANT_ResponseFunction, aucResponseBuffer);
ANT_AssignChannelEventFunction(1, ANT_ChannelEventFunction, aucChannelEventBuffer);
return TRUE;
}
return FALSE;
}
ANT_SENDEVENT_API void SendEvent(LVUserEventRef *antEvent, char* Eventmsg)
{
PostLVUserEvent(*antEvent,(void *)&Eventmsg);
return;
}
ANT_SENDEVENT_API void SendResponse(LVUserEventRef *antResponse, char*Responsemsg)
{
PostLVUserEvent(*antResponse,(void *)&Responsemsg);
return;
}
i always get the 1097 error but it seems i am way to stupid to solve this. i have read the kb article, but without any result (and i am net to c++ so its very, very hard)... please - could anyone help?
thanx
martin