Hi,
are you sure that you have installed the correct driver, the batteries of the remote control are not empty and the remote control is working at all?
here is the code:
Code:
// AutohotkeyRemoteX10.cpp : Defines the initialization routines for the DLL.
//
#include "stdafx.h"
#include "ahscript.h"
#include ".\AutohotkeyRemoteX10.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
//helper function for single byte char to unicode translatation
UINT Initialize(DWORD hWnd)
{
fEndThread = FALSE;
pWnd = CWnd::FromHandle((HWND)hWnd);
AfxBeginThread(RunThread, NULL);
return NULL;
}
void UnInitialize(void)
{
fEndThread = TRUE;
//EVENT Abwarten
pEventsReporter->Release();
pEventsReporter = NULL;
pActiveHome->Release();
pActiveHome = NULL;
}
UINT RunThread (LPVOID pParam )
{
int nReturn = 0;
HRESULT hr;
hr = CoInitialize(NULL);
hr = CoCreateInstance( CLSID_ActiveHome, NULL, CLSCTX_INPROC|CLSCTX_LOCAL_SERVER, IID_IActiveHome, (LPVOID *) &pActiveHome );
if (SUCCEEDED(hr))
{
VARIANT varReseved1;
VariantInit(&varReseved1);
VARIANT varReseved2;
VariantInit(&varReseved2);
VARIANT varAction;
VariantInit(&varAction);
varAction.vt = VT_BSTR;
wchar_t wchTemp[10];
//setup events reporting for _IActiveHomeEvents
pEventsReporter = new CEventsReporter;
if (pEventsReporter)
{
pEventsReporter->AddRef();
//hook up pEventsReporter to get calls
pEventsReporter->AdviseActiveHome(pActiveHome);
MSG msg;
HWND hwnd;
HWND hwndParent;
while (GetMessage( &msg, NULL, 0, 0 ) > 0)
{
if (msg.hwnd && (((msg.message >= WM_KEYFIRST) && (msg.message <= WM_KEYLAST)) || ((msg.message >= WM_IME_SETCONTEXT) && (msg.message <= WM_IME_KEYUP))) )
{
hwnd = msg.hwnd;
for (;(hwndParent = GetParent( hwnd )) && IsChild( hwndParent, hwnd ); hwnd = hwndParent) {}
if (! ::GetWindowLong( hwnd, DWL_DLGPROC ) || !IsDialogMessage( hwnd, &msg ))
{
TranslateMessage( &msg );
DispatchMessage( &msg );
}
}
else
{
TranslateMessage( &msg );
DispatchMessage( &msg );
}
}
}
}
else
{
printf("error: CoCreateInstance hr=0x%x", (unsigned int)hr);
}
return TRUE;
}