How can i use my infrared remote controll in my application?
my infra red device is not connected to a com-port but to my Medion Tv-Radio card (a MD2819 TV-card equipted with a phillips 7134 chipset (or so))
Printable View
How can i use my infrared remote controll in my application?
my infra red device is not connected to a com-port but to my Medion Tv-Radio card (a MD2819 TV-card equipted with a phillips 7134 chipset (or so))
You are going to have to get with the manufacturer and get an API for your hardware, or instructions from them on how to integrate with the hardware.
well there seems to be an public api for this or so.. this C code can read button presses (i guess not sure though) but its written in c(++) can somebody convert this to vb? :S
VB Code:
//AVerTV Studio Girder plugin by Pavel Chromy //based on plugin written by Michal Milczewski #include <stdio.h> #include <windows.h> #include <winuser.h> #include "girder.h" #pragma argsused #define AVERDEVICENUM 28 #define INT_POLE 100 //Remote Poling Interval (ms) typedef void __cdecl (CALLBACK *THWInit)(void); typedef int __cdecl (CALLBACK *TGetRemoteData)(void); //typedef void __cdecl (CALLBACK *TSetRemoteData)(int); //typedef int __cdecl (CALLBACK *TGetRemoteFlag)(void); //typedef void __cdecl (CALLBACK *TSetRemoteFlag)(int); //typedef int __cdecl (CALLBACK *TIsRemoteDataReady)(void); #pragma data_seg(".SHARDATA") static HINSTANCE DllH = NULL; static THWInit HWInit; static TGetRemoteData GetRemoteData; //static TSetRemoteData SetRemoteData; //static TGetRemoteFlag GetRemoteFlag; //static TSetRemoteFlag SetRemoteFlag; //static TIsRemoteDataReady IsRemoteDataReady; #pragma data_seg() int PoleTimer=0; bool IsDriverOK = false; t_functions gir_sf; VOID CALLBACK TimerProc(HWND hwnd,UINT uMsg,UINT idEvent,DWORD dwTime); /*=========================================================*/ bool LoadDll(HINSTANCE &DllH) { CoInitialize(NULL); DllH=LoadLibrary("averapi.dll"); // try to load "averapi.dll" - win2k/me if (DllH==NULL) { MessageBox(GetForegroundWindow(),"The 'averapi.dll' library can't be found.\nYou have to install Medion software first.","Medion Girder plugin error",MB_OK | MB_ICONHAND| MB_SYSTEMMODAL); return false; } HWInit=(THWInit)GetProcAddress(DllH, "AVER_HWInit"); GetRemoteData=(TGetRemoteData)GetProcAddress(DllH, "AVER_GetRemoteData"); //SetRemoteData=(TSetRemoteData)GetProcAddress(DllH, "AVER_SetRemoteData"); //GetRemoteFlag=(TGetRemoteFlag)GetProcAddress(DllH, "AVER_GetRemoteFlag"); //SetRemoteFlag=(TSetRemoteFlag)GetProcAddress(DllH, "AVER_SetRemoteFlag"); //IsRemoteDataReady=(TIsRemoteDataReady)GetProcAddress(DllH, "AVER_IsRemoteDataReady"); if (!HWInit || !GetRemoteData) { MessageBox(GetForegroundWindow(),"Error during importing functions from Medion library.","Medion Girder plugin error",MB_OK | MB_ICONHAND| MB_SYSTEMMODAL); return false; } // hardware init HWInit(); //it takes a while with win9x drivers return true; } bool UnloadDll(HINSTANCE &DllH) { CoUninitialize(); bool result = FreeLibrary(DllH); DllH = NULL; return result; } void StartTimer(int msec) { if (PoleTimer) KillTimer(NULL,PoleTimer); PoleTimer=SetTimer(NULL,0,msec,(int(__stdcall *)())TimerProc); } void StopTimer(void) { if (PoleTimer) { KillTimer(NULL,PoleTimer); PoleTimer=0; } } void SendKey(int key) { char payload='\0'; char eventstr[16]; sprintf(eventstr,"AVER_%02X",key); gir_sf.send_event(eventstr,&payload,1,AVERDEVICENUM); } VOID CALLBACK TimerProc(HWND hwnd,UINT uMsg,UINT idEvent,DWORD dwTime) { static int key; //AVerTV Studio - the IsRemoteDataReady() function does not behave as expected if ((key=GetRemoteData())&2) { SendKey(key); } } //grinder callings /*=========================================================*/ extern "C" __declspec(dllexport) void CALLBACK gir_version(char *data, int size) { strncpy(data,"2.0",size); } extern "C" __declspec(dllexport) void CALLBACK gir_name(char *data, int size) { strncpy(data,"Medion remote controler",size); } extern "C" __declspec(dllexport) void CALLBACK gir_description(char *data, int size) { strncpy(data,"Captures IR events from medion md2819",size); } extern "C" __declspec(dllexport) int CALLBACK gir_devicenum() { return AVERDEVICENUM; } extern "C" __declspec(dllexport) int CALLBACK gir_requested_api(int max_api) { return 1; } extern "C" __declspec(dllexport) int CALLBACK gir_open (int gir_major_ver, int gir_minor_ver, int gir_micro_ver, p_functions p) { if (p->size!=sizeof(s_functions)) return GIR_FALSE; memcpy((void *)(&gir_sf), p, sizeof(s_functions)); if (IsDriverOK=LoadDll(DllH)) return GIR_TRUE; return GIR_FALSE; } extern "C" __declspec(dllexport) int CALLBACK gir_close() { UnloadDll(DllH); return GIR_TRUE; } extern "C" __declspec(dllexport) int CALLBACK gir_start() { if (!IsDriverOK) return GIR_FALSE; StartTimer(INT_POLE); return GIR_TRUE; } extern "C" __declspec(dllexport) int CALLBACK gir_stop() { if (!IsDriverOK) return GIR_FALSE; StopTimer(); return GIR_TRUE; } /*=========================================================*/
:blush: