AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

DllCall-Support for X10 remote controls (i.e.Notebooks)

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
Micha



Joined: 15 Nov 2005
Posts: 437
Location: Germany

PostPosted: Sun Jan 29, 2006 9:03 pm    Post subject: DllCall-Support for X10 remote controls (i.e.Notebooks) Reply with quote

Hi,
my Aldi Medion Notebook MD96500 has a X10.com remote control, which is not recognized as HID-USB-Device nor by winlirc.
After a long research I have found the X10 SDK to support the remotecontrol in your own applications.
Time to write a DLL to use with AHK for remote controlling apps with my remote control.

In the function DoAction you receive the Key and the state (pressed/released). Thus you can expand the script very easy.
if Command = "louder" then rise the volume
if Command = "2" switch to channel 2 in your TV-APP
...
...

If you have problems please Mail me or post in that thread

The DLL: http://www.autohotkey.net/~Micha/X10/AutohotkeyRemoteX10.dll
The script: http://www.autohotkey.net/~Micha/X10/X10RemoteControl.ahk

If you have problems to get the dll working, you will need new MS-Dlls (mfc80.dll, msvcr80.dll) please download the 2 Archives, unpack them and start the vcredist_x86.exe. It will install the needed dlls
http://www.autohotkey.net/~Micha/vcredist_x86.sfx.part1.exe
http://www.autohotkey.net/~Micha/vcredist_x86.sfx.part2.rar
There's a uploadlimit of 2 MB, thus I had to split the Archives

Ciao
Micha


Last edited by Micha on Thu Feb 02, 2006 11:35 am; edited 2 times in total
Back to top
View user's profile Send private message
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10467

PostPosted: Mon Jan 30, 2006 12:13 am    Post subject: Reply with quote

Nice looking package. Now, when anyone searches for X10 or similar, they will find a ready-made solution thanks to you Smile
Back to top
View user's profile Send private message Send e-mail
Micha



Joined: 15 Nov 2005
Posts: 437
Location: Germany

PostPosted: Thu Feb 02, 2006 11:36 am    Post subject: Reply with quote

Updated links. Add mfc-dlls in a package
Back to top
View user's profile Send private message
Muffy
Guest





PostPosted: Thu Feb 16, 2006 11:57 am    Post subject: H Reply with quote

Very Happy Sounds fine, but doesn't work with my Medion X10 on WinXP Crying or Very sad

The remote control is working, as i can see with a test program, but if i run your script no tooltip is displayed. Any ideas?
Back to top
Micha



Joined: 15 Nov 2005
Posts: 437
Location: Germany

PostPosted: Thu Feb 16, 2006 9:03 pm    Post subject: Reply with quote

Hi Muffy,
are there any error-messages or does just nothing happens ?

What test program do you have used? Perhaps I can try, if it works with my remote control, just to see that it should work.

Ciao
Micha
Back to top
View user's profile Send private message
guest166
Guest





PostPosted: Sun Feb 26, 2006 1:09 pm    Post subject: Reply with quote

I have a Niveus Media USB remote (x10 clone), will this solution work for me?
Any chance you could tell me step by step (read: for someone with no clue) how to get this working? Embarassed
Back to top
Micha



Joined: 15 Nov 2005
Posts: 437
Location: Germany

PostPosted: Sun Feb 26, 2006 5:58 pm    Post subject: Reply with quote

Hi,
I can't tell you if it will work, but you can have a try.

Download the dll and the script from the first post.
Download this ZIP: http://www.autohotkey.net/~Micha/mfc_dlls.zip

Put all files to the same directory and start the script.
If you press a key on the remotecontrol a tooltip should appear.

If that works, you can do everything what's possible with ahk by pressing a button on the remote control.

Ciao
Micha
Back to top
View user's profile Send private message
Adj



Joined: 23 Dec 2007
Posts: 3

PostPosted: Sun Dec 23, 2007 11:07 pm    Post subject: Reply with quote

Hey Micha,
This sounds great! i'd love this if i could get it to work.

However i failed to get it working. I do not know what the problem is. I got a working (works with girder, which i do not like so much) X10 Remote Control with my Aldi Medion desktop.

I've downloaded the files, extracted them and put them in one directory. No errors occur when i start the script, but nothing happens when i press a button. I've checked the Key history and script info which is empty.

I'm not so known with DLL's so i might do something wrong there..

Could you please give me some direction to a solution please?

Thanks in advance!

Adj
Back to top
View user's profile Send private message
Micha



Joined: 15 Nov 2005
Posts: 437
Location: Germany

PostPosted: Mon Dec 24, 2007 10:01 am    Post subject: Reply with quote

Hi Adj,
please try dependency walker. A short description is here
Back to top
View user's profile Send private message
Jeggo
Guest





PostPosted: Sun Mar 02, 2008 7:08 pm    Post subject: X10 Desktop Remote Reply with quote

Hello Micha,

I have the same problem with my X10 Medion remote clone.
As proposed I did a Dependency Walker run. As far as understand the output everything is OK.

I believe, that the AutohotkeyRemoteX10.dll is not processing the X10 commands.

I just mailed you the log file.

CU

Jens
Back to top
Micha



Joined: 15 Nov 2005
Posts: 437
Location: Germany

PostPosted: Mon Mar 03, 2008 8:18 pm    Post subject: Reply with quote

Hi,
I've recompiled the dll.
Please download the new vcredist from microsoft
http://www.microsoft.com/downloads/details.aspx?familyid=9B2DA534-3E03-4391-8A4D-074B9F2BC1BF&displaylang=en
The new Dll:
http://www.autohotkey.net/~Micha/X10/AutohotkeyRemoteX10.zip
and the X10 SDK. The dll should work without, but I have installed Server2003 and the notebook drivers for my remote control doesn't install with that os. I wasn't able to run the dll without the sdk, but you can try it without the sdk first.
http://www.x10.com/activehomepro/sdk/
My remote is working without further dlls on my new installed notebook
Please post if you have any further problems
Ciao
Micha
Back to top
View user's profile Send private message
Jeggo
Guest





PostPosted: Tue Mar 04, 2008 9:41 pm    Post subject: Reply with quote

Hi Micha,

I tried the things you mentioned. But it did not work Sad
Still no reaction of the script, when I press a key on the remote.

Is it possible to get the sourcecode for your DLL?
Maybe I can findout what the problem is.

CU

Jens
Back to top
Micha



Joined: 15 Nov 2005
Posts: 437
Location: Germany

PostPosted: Wed Mar 05, 2008 5:57 pm    Post subject: Reply with quote

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;
}
Back to top
View user's profile Send private message
Jeggo
Guest





PostPosted: Wed Mar 05, 2008 7:42 pm    Post subject: Reply with quote

Hi Micha,

now it is working Very Happy
It looks like a reboot was missing. Next weekend I will try to integrate it in my AHK-script.
I will tryout what drivers and DLLs where actual needed to run the X10 remote.

CU

Jens
Back to top
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group