I'm building some automated tests for Internet Explorer 9 with AutoIT. I'm currently using keyboard shortcuts to control IE9, but I need these tests to run under any language. Since the shortcuts vary through different languages, I'm trying not to hardcode the key combinations but to take them from the IE9 .mui (internationalization) files. The file I'm trying to use right now is ieframe.dll.mui (which is under %windows%\%system32%\En-us). Supposedly, I should be able to get the information I want from this file using Windows API functions such as LoadAccelerators (MSDN). I'm not very C nor C++ experienced, so I'm having trouble both with the Windows API and with the AutoIT function DllCall.
This what I have so far:
Global $kernel32 = OpenDll("kernel32.dll") Global $user32 = OpenDll("user32.dll") Global $ieframe = OpenDll("ieframe.dll") Local $accelerators = LoadAccelerators($ieframe, "") ConsoleWrite($accelerators & @LF) ; ================= user32.dll functions ==================== Func LoadAccelerators($moduleHandle, $acceleratorTable) Local $result = DllCall($user32, "HANDLE", "LoadAccelerators", "HANDLE", $moduleHandle, "str", $acceleratorTable) CheckDllCallError(@error) ConsoleWriteIfNull($result, "The accelerator is null") Return $result EndFunc ; ================= kernel32.dll functions ==================== Func FindResource($moduleHandle, $resourceId, $resourceType) Local $result = DllCall($kernel32, "HANDLE", "FindResource", "HANDLE", $moduleHandle, "int", $resourceId, "int", $resourceType) CheckDLLCallError(@error) ConsoleWriteIfNull($result, "The resource handle is null") Return $result EndFunc Func LoadResource($moduleHandle, $resourceHandle) Local $result = DllCall($kernel32, "HANDLE", "LoadResource", "HANDLE", $ieframe, "HANDLE", $resourceHandle) CheckDLLCallError(@error) ConsoleWriteIfNull($resource, "The resource is null") Return $result EndFunc ; ================= Utils ==================== Func ConsoleWriteIfNull($var, $message) If not $var Then ConsoleWriteError($message & @LF) EndIf EndFunc Func CheckDLLCallError($error) Switch $error Case 1 ConsoleWriteError("Unable to use the DLL file" & @LF) Case 2 ConsoleWriteError("Unknown return type" & @LF) Case 3 ConsoleWriteError("Function not found in the DLL file" & @LF) Case 4 ConsoleWriteError("Bad number of parameters" & @LF) Case 5 ConsoleWriteError("Bad parameter" & @LF) Case Else EndSwitch EndFunc Func OpenDll($dllName) Local $dll = DllOpen($dllName) If ($dll = -1) Then ConsoleWriteError("Could not load " & $dllName & @LF) EndIf Return $dll EndFunc
It seems that LoadAccelerators is returning a null value. I guess that I'm not passing the right argument/argument types, but I already tried several things to no avail.
Any help would be appreciated!





