Hi
I got a Logitech G15 keyboard for Christmas and now I'm trying to program it. I'ts got a monochrome graphical LCD screen.
I've managed to get a simple program going in c++, but since i prefer Blitz3D I would like to create a dll with some simple functions.
This works
lgLcdOpenContext InnitLCD(LPCSTR name)
{
DWORD res;
//// initialize the library
res=lgLcdInit();//res
HandleError(res, _T("lgLcdInit"));
//// connect to LCDMon
// set up connection context
lgLcdConnectContext connectContext;
ZeroMemory(&connectContext, sizeof(connectContext));
connectContext.appFriendlyName = _T(name);//"simple sample");
connectContext.isAutostartable = false;
connectContext.isPersistent = false;
// we don't have a configuration screen
connectContext.onConfigure.configCallback = NULL;
connectContext.onConfigure.configContext = NULL;
// the "connection" member will be returned upon return
connectContext.connection = LGLCD_INVALID_CONNECTION;
// and connect
res=lgLcdConnect(&connectContext);//RES
HandleError(res, _T("lgLcdConnect"));
// now we are connected (and have a connection handle returned),
// let's enumerate an LCD (the first one, index = 0)
lgLcdDeviceDesc deviceDescription;
res=lgLcdEnumerate(connectContext.connection, 0, &deviceDescription);//res
HandleError(res, _T("lgLcdEnumerate"));
// at this point, we have an LCD
//_tprintf(_T("Found an LCD with %dx%d pixels, %d bits per pixel and %d soft buttons\n"),
// deviceDescription.Width, deviceDescription.Height, deviceDescription.Bpp,
// deviceDescription.NumSoftButtons);
// open it
lgLcdOpenContext openContext;
ZeroMemory(&openContext, sizeof(openContext));
openContext.connection = connectContext.connection;
openContext.index = 0;
// we have no softbutton notification callback
openContext.onSoftbuttonsChanged.softbuttonsChangedCallback = NULL;
openContext.onSoftbuttonsChanged.softbuttonsChangedContext = NULL;
// the "device" member will be returned upon return
openContext.device = LGLCD_INVALID_DEVICE;
res=lgLcdOpen(&openContext);//res
HandleError(res, _T("lgLcdEnumerate"));
return openContext;
}
But since Blitz cant get the returned class i need to send it to my function, and let c++ edit the content
This code here doesn't work though
void InnitLCD(LPCSTR name,lgLcdOpenContext openContext)
{
DWORD res;
//// initialize the library
res=lgLcdInit();//res
HandleError(res, _T("lgLcdInit"));
//// connect to LCDMon
// set up connection context
lgLcdConnectContext connectContext;
ZeroMemory(&connectContext, sizeof(connectContext));
connectContext.appFriendlyName = _T(name);//"simple sample");
connectContext.isAutostartable = TRUE;
connectContext.isPersistent = TRUE;
// we don't have a configuration screen
connectContext.onConfigure.configCallback = NULL;
connectContext.onConfigure.configContext = NULL;
// the "connection" member will be returned upon return
connectContext.connection = LGLCD_INVALID_CONNECTION;
// and connect
res=lgLcdConnect(&connectContext);//RES
HandleError(res, _T("lgLcdConnect"));
// now we are connected (and have a connection handle returned),
// let's enumerate an LCD (the first one, index = 0)
lgLcdDeviceDesc deviceDescription;
res=lgLcdEnumerate(connectContext.connection, 0, &deviceDescription);//res
HandleError(res, _T("lgLcdEnumerate"));
// at this point, we have an LCD
//_tprintf(_T("Found an LCD with %dx%d pixels, %d bits per pixel and %d soft buttons\n"),
// deviceDescription.Width, deviceDescription.Height, deviceDescription.Bpp,
// deviceDescription.NumSoftButtons);
// open it
// lgLcdOpenContext openContext;
ZeroMemory(&openContext, sizeof(openContext));
openContext.connection = connectContext.connection;
openContext.index = 0;
// we have no softbutton notification callback
openContext.onSoftbuttonsChanged.softbuttonsChangedCallback = NULL;
openContext.onSoftbuttonsChanged.softbuttonsChangedContext = NULL;
// the "device" member will be returned upon return
openContext.device = LGLCD_INVALID_DEVICE;
res=lgLcdOpen(&openContext);//res
HandleError(res, _T("lgLcdEnumerate"));
//return openContext;
}
So how would i edit the fisrts peice of code so i can call it like this:
lgLcdOpenContext openContext;
memset(&openContext,0,sizeof(openContext));
InnitLCD(_T("NAME"),openContext);