AutID Posted February 27, 2016 Posted February 27, 2016 (edited) Hello, I will put it as simple as possible Why this code runs perfectly on 32bit and it fails on 64bit? Local $hWND = WinGetProcess("[CLASS:LSS_app]") ConsoleWrite($hWND & @LF) Local $hModuleList = _WinAPI_EnumProcessModules($hWND) If @error Then ConsoleWrite("Error: " & @error & @LF) For $i = 0 To $hModuleList[0][0] - 1 ;~ If StringInStr($hModuleList[$i][1], "sysCap64.dll") Then ConsoleWrite($hModuleList[$i][0] & @LF) ;~ EndIf Next As the title says EnumProcessModules returns error 10 which I have no clue what it is. It must be something with autoit or my lack of coding because a similar code in C# will work like a charm on both x86 and x64 Process[] Processes = Process.GetProcessesByName("winLSS64Cap"); Process nProcess = Processes[0]; Handle = OpenProcess(0x10, true, (uint)nProcess.Id); for(int i = 0; i < nProcess.Modules.Count; i++) { Console.WriteLine(nProcess.Modules[i].ModuleName); } Edited February 27, 2016 by AutID https://iblockify.wordpress.com/
AutID Posted February 28, 2016 Author Posted February 28, 2016 Any WinAPI guru mind lending a hand here? https://iblockify.wordpress.com/
JohnOne Posted February 28, 2016 Posted February 28, 2016 (edited) What does the firs parameter of that api take? What does the second parameter of that api take? Edited February 28, 2016 by JohnOne AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
AutID Posted February 29, 2016 Author Posted February 29, 2016 (edited) Flags. To determine which modules the function will return based on bits. If I recall correctly default will return all of them. I have tried with all the flags. The error is the same Edited February 29, 2016 by AutID https://iblockify.wordpress.com/
JohnOne Posted February 29, 2016 Posted February 29, 2016 Error codes 10 (0xA) The environment is incorrect AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
AutID Posted February 29, 2016 Author Posted February 29, 2016 That doesn't tell me a lot. Which environment? The OS? It must be autoit side since the similar code in C# on the same computer works like a charm https://iblockify.wordpress.com/
InunoTaishou Posted February 29, 2016 Posted February 29, 2016 Out of all the posts I've seen where someone tried to blame AutoIt, they've never been right. #include <WinApiProc.au3> Local $hWND1 = WinGetProcess("[CLASS:MozillaWindowClass]") Local $hWND2 = WinGetProcess("[CLASS:QWidget]") Local $hModuleList = _WinAPI_EnumProcessModules($hWND1) ConsoleWrite("Error for $hWND1 (PID: " & $hWND1 & ") " & @error & @LF) $hModuleList = _WinAPI_EnumProcessModules($hWND2) ConsoleWrite("Error for $hWND2 (PID: " & $hWND2 & ") " & @error & @LF) I get no error when I enum for FireFox but i do get an error when I enum for QWidget (VLC). Both PIDs are correct.
AutID Posted February 29, 2016 Author Posted February 29, 2016 32 minutes ago, InunoTaishou said: Out of all the posts I've seen where someone tried to blame AutoIt, they've never been right. #include <WinApiProc.au3> Local $hWND1 = WinGetProcess("[CLASS:MozillaWindowClass]") Local $hWND2 = WinGetProcess("[CLASS:QWidget]") Local $hModuleList = _WinAPI_EnumProcessModules($hWND1) ConsoleWrite("Error for $hWND1 (PID: " & $hWND1 & ") " & @error & @LF) $hModuleList = _WinAPI_EnumProcessModules($hWND2) ConsoleWrite("Error for $hWND2 (PID: " & $hWND2 & ") " & @error & @LF) I get no error when I enum for FireFox but i do get an error when I enum for QWidget (VLC). Both PIDs are correct. I don't know who is blaming autoit and I don't know what your post means. In case you are talking about me and supposing I am that guy blablabla, how does your post prove the opposite? https://iblockify.wordpress.com/
JohnOne Posted March 1, 2016 Posted March 1, 2016 Have you tried compiling code for 64 bit? Just to eliminate that. To me "The environment is incorrect" sounds like a bitness issue you see, AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
AutID Posted March 1, 2016 Author Posted March 1, 2016 9 hours ago, JohnOne said: Have you tried compiling code for 64 bit? Just to eliminate that. To me "The environment is incorrect" sounds like a bitness issue you see, That solved it! However I need to compile it every time I need to test it. + consolewrite debugs won't do here. Is there a way to avoid this issue on scite? Big thanks mate https://iblockify.wordpress.com/
BrewManNH Posted March 2, 2016 Posted March 2, 2016 (edited) #AutoIt3Wrapper_UseX64=Y, add this to your script and then run it in Scite, should be fine that way. EDIT: You have to have installed Scite4AutoIt3 prior to using this directive. Edited March 2, 2016 by BrewManNH If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator
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