Dattebayo Posted August 13, 2009 Share Posted August 13, 2009 (edited) Hello, i need help with translating these function calls to Autoit dll calls, I've never tried dllcalls on my own before so i expected to fail the first time. the c++ functions below is what im trying to call.expandcollapse popup/* * This file was produced from documentation provided by * Hauppauge Computer Works. It is released under the * GNU General Public License * * Peter Heitman, Oct 2003 * Denybear, Apr 2005 */ #ifndef _IRREMOTE_H #ifdef __cplusplus extern "C" { #endif /* * General Notes * * The basic sequence is IR_Open(), and this starts a timer; * poll using IR_GetKeyCode() called from the WM_TIMER messages, * and then call KillTimer( hWnd, 1) and IR_Close() when you are done. * * With the release of the v2.45 IR remote driver for PVR150 * (in conjunction with the HCWPVR2 remote), the IR_GetKeyCode () has been more * or less deprecated (and for sure does not work with that version of the driver). * You should use IR_GetSystemKeyCode () as a replacement. * * The basic sequence is then IR_Open(), and this starts a timer; * poll using IR_GetSystemKeyCode() called from the WM_TIMER messages, * and then call KillTimer( hWnd, 1) and IR_Close() when you are done. */ /* * Defines */ #define IR_NOKEY 0x1fff /* * IR_Open * * Parameters: * * hWnd is the window handle of your app. Timer events WILL be sent to * this window if IR_Open is successful; the interval is nominally 85ms * * msg is UNUSED, set it to 0 * * Verbose is a flag to indicate if a message box should be displayed * with status during the open * * myIRPort is the I2C address to connect to; by default it should be 0, * which does a search for any suitable device. You should set it to 0 * unless you have a good reason not to (hint: you don't :-) * * Return Value: * * returns non-0 if it was succesful */ BOOL WINAPI IR_Open( HWND hWnd, UINT msg, BOOL Verbose, WORD myIRPort ); /* * IR_GetVersion * * Return Value: * * returns the FW version of the found IR controller in the lower 6 bits; * only useful for testing */ DWORD WINAPI IR_GetVersion(); /* * IR_Close * * Closes down the existing connections to the IR device * (Does NOT stop the TIMER; do that yourself via KillTimer( hWnd, 1)) * * Parameters: * * hWnd - currently NOT USED, set to 0 * * msg - currently NOT USED, set to 0 * * Return Value: * * returns TRUE */ BOOL WINAPI IR_Close( HWND hWnd, UINT msg ); /* * IR_Power * * Use ??? * * Parameters: * * msg - can have 2 values : either 0x12, either 0x34. * No more information is available at the moment * * Return Value: * * returns non-0 if it was succesful */ BOOL WINAPI IR_Power( UINT msg ); /* * IR_GetKeyCodeEx * * Parameters: * * piRepeatCount points to a value that contains the current repeat count; * used to do auto repeat. This pointed-to value SHOULD be 0 initially; * and should probably never be touched; and it MUST be Global/static * (not stack based) (the IR_GetKeyCodeEx function assumes this state * variable is preserved across calls) * * Return Value: * * returns the current IR button press, or IR_NOKEY for no button pressed * since last poll * * The format of the returned KeyCode is the 14bit RC5 code; * bit: 13 12 11 10 9 8 7 6 5 4 3 2 1 0 * cmd: S S T A4 A3 A2 A1 A0 C5 C4 C3 C2 C1 C0 * * S= status, always 1 * T= toggle, changes for every physical keypress (but not auto repeats * from held keys) * Ax = Address bits (0=older black remote, 31=HCWPVR remote) * Cx = Key codes (look at the full list for each remote in * \windows\IRRemote.ini file) * * * This is a low-level function; It is called by both IR_GetKeyCode() * and IR_GetSystemKeyCode (). * */ WORD WINAPI IR_GetKeyCodeEx ( int* piRepeatCount ); /* * IR_GetKeyCode * * Parameters: * * piRepeatCount points to a value that contains the current repeat count; * used to do auto repeat. This pointed-to value SHOULD be 0 initially; * and should probably never be touched; and it MUST be Global/static * (not stack based) (the IR_GetKeyCode function assumes this state * variable is preserved across calls) * * Return Value: * * returns the current IR button press, or IR_NOKEY for no button pressed * since last poll * * The format of the returned KeyCode is the 14bit RC5 code; * bit: 13 12 11 10 9 8 7 6 5 4 3 2 1 0 * cmd: S S T A4 A3 A2 A1 A0 C5 C4 C3 C2 C1 C0 * * S= status, always 1 * T= toggle, changes for every physical keypress (but not auto repeats * from held keys) * Ax = Address bits (0=older black remote, 31=HCWPVR remote) * Cx = Key codes (look at the full list for each remote in * \windows\IRRemote.ini file) */ WORD WINAPI IR_GetKeyCode( int* piRepeatCount ); /* * IR_GetSystemKeyCode * * returns the current IR button press since last poll * * Parameters: * * piRepeatCount points to a value that contains the current repeat count; * used to do auto repeat. This pointed-to value SHOULD be 0 initially; * and should probably never be touched; and it MUST be Global/static * (not stack based) (the IR_GetSystemKeyCode function assumes this state * variable is preserved across calls) * * piRemoteCode points to a return code that is <0x1F : * (0=older black remote, 31=HCWPVR remote, 30=HCWPVR2 remote) * * piKeyCode points to a return code that is <0x7F : * this is the key code (look at the full list for each remote in * \windows\IRRemote.ini file) * * Return Value: * TRUE (non-0) if key pressed, FALSE if no key pressed */ BOOL WINAPI IR_GetSystemKeyCode( int* piRepeatCount, int* piRemoteCode, int*piKeyCode ); #ifdef __cplusplus } #endif #endifAnd this is one of many attempts i tried. $dll = DllOpen("irremote.dll") $shit = DllCall($dll, "hwnd", "IR_Open","uint",0,"bool",0,"word",0) If @Error then msgbox(0,"","first dll failed - Error = "&@Error) $result = DllCall($dll, "bool", "IR_GetSystemKeyCode","int",0,"int",0) If @Error then msgbox(0,"","second dll failed - Error = "&@Error) dllclose($dll)They always return 0 >_<Irremote.dll Edited August 13, 2009 by Dattebayo Link to comment Share on other sites More sharing options...
Yashied Posted August 13, 2009 Share Posted August 13, 2009 (edited) $dll = DllOpen("irremote.dll") $shit = DllCall($dll, "hwnd", "IR_Open", "uint", 0, "int", 0, "dword", 0) MsgBox(0, "", $shit[0]) $result = DllCall($dll, "int", "IR_GetSystemKeyCode", "int", 0, "int", 0) MsgBox(0, "", $result[0]) DllClose($dll)DllCall() returns an array that contains the function return value and a copy of all the parameters (including parameters that the function may have modified when passed by reference). Edited August 13, 2009 by Yashied My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... Link to comment Share on other sites More sharing options...
Dattebayo Posted August 13, 2009 Author Share Posted August 13, 2009 woops, changed the script it still doesn't work tho cause the actual dllcall errors out. Link to comment Share on other sites More sharing options...
trancexx Posted August 13, 2009 Share Posted August 13, 2009 (edited) Yashied's function are missing one parameter each. It should be: BOOL WINAPI IR_Open( HWND hWnd, UINT msg, BOOL Verbose, WORD myIRPort ); DllCall($dll, "int", "IR_Open", "hwnd", $hWnd, "dword", 0, "int", 0, "ushort", 0) and BOOL WINAPI IR_GetSystemKeyCode( int* piRepeatCount, int* piRemoteCode, int*piKeyCode ); DllCall($dll, "int", "IR_GetSystemKeyCode", "int*", 0, "int*", 0, "int*, 0) Edited August 13, 2009 by trancexx ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
Dattebayo Posted August 13, 2009 Author Share Posted August 13, 2009 Sweet! thanks both of you! holy smokes this is amazing >_< i can totally customize my IR remote now with this. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now