Husker_Jason Posted June 13, 2023 Share Posted June 13, 2023 @martin I've downloaded the files from this link: When I tried to call this code, every time it tries to use the COMMG64.DLL, I get an error that it cannot load it. I reduced the code to this to try troubleshooting it and make sure the file is where I think it is: #RequireAdmin $DLLNAME = 'COMMG64.dll' If Not FileExists($DLLNAME) Then ConsoleWrite ("FAILED" & @CR) Else ConsoleWrite ("SUCCED" & @CR) EndIf $hDll = DllOpen($DLLNAME) If $hDll = -1 Then ConsoleWrite ("FAILED" & @CR) Else ConsoleWrite ("SUCCED" & @CR) EndIf This is what I got for the results: SUCCED FAILED So, the file exists, but for whatever reason, the DllOpen call fails. Does anyone have any idea what I'm doing wrong? I'm running this on a Windows 11 in 64bit mode. The files are in my "My Documents" folder. Link to comment Share on other sites More sharing options...
Andreik Posted June 13, 2023 Share Posted June 13, 2023 Use #AutoIt3Wrapper_UseX64 directive to force x64 or x86 version of AutoIt. Insert this line after #RequireAdmin and try again. #AutoIt3Wrapper_UseX64=y Link to comment Share on other sites More sharing options...
Husker_Jason Posted June 13, 2023 Author Share Posted June 13, 2023 I gave it a shot, but no luck. In fact, I got a different response. For some reason the ConsoleWrite statements no longer provide output. The program ends with no errors, but I get no responses printed. I added some MSGBOX lines in the same places as the ConsoleWrites, and those did run. Unfortunately, the responses indicate the same problem. Program exists, but it can't be opened with the DllOpen statement. My updated code in case I have a typo. #RequireAdmin #AutoIt3Wrapper_UseX64=Y ConsoleWrite("Start" & @CR) MsgBox(1,"test","test") $DLLNAME = 'COMMG64.dll' If Not FileExists($DLLNAME) Then ConsoleWrite ("FAILED" & @CR) MsgBox(1,"test1","test") Else ConsoleWrite ("SUCCED" & @CR) MsgBox(1,"test2","test") EndIf $hDll = DllOpen($DLLNAME) If $hDll = -1 Then ConsoleWrite ("FAILED" & @CR) MsgBox(1,"test3","test") Else ConsoleWrite ("SUCCED" & @CR) MsgBox(1,"test4","test") EndIf When I run it, I get MsgBox 2 and 3 to trigger (as well as the first one) Link to comment Share on other sites More sharing options...
Andreik Posted June 13, 2023 Share Posted June 13, 2023 Show us the error code. Link to comment Share on other sites More sharing options...
Solution Husker_Jason Posted June 13, 2023 Author Solution Share Posted June 13, 2023 (edited) This is all I get in the console log. >"C:>"C:\Program Files (x86)\AutoIt3\SciTE\..\AutoIt3.exe" /ErrorStdOut "C:\Users\jason.PASLAN\Documents\AutoIt\FunctionLib\COM_Support_64\test.au3" >Exit code: 0 l looked at my SCiTE version and it said it was a 32 bit version so I thought I might have installed the wrong one. This is a new computer and I was reinstalling software, so I might have screwed up. That said, I uninstalled AutoIt and redownloaded and installed it again. I also installed the SciTE4AutoIt3.exe file. After doing this, the code started working properly. I also noticed that my console info started showing on the bottom of the screen instead of the side and I got more info when it run. It has been a while since I did any coding in AutoIt, so not sure what i did wrong to begin with. Anyway, it appears to be working now. Thanks for you help though. My SCiTE version still says 32-bit. Is that right? Edited June 13, 2023 by Husker_Jason Link to comment Share on other sites More sharing options...
abberration Posted June 13, 2023 Share Posted June 13, 2023 I have had similar troubles with 32-bit dlls. There are two ways I use to make sure I run the AutoIt script as 32 bit to work properly with 32 bit dlls: 1. Compile the script to a 32 bit executable. 2. Right-click the script and go to the bottom option "Run Script (x86)". But yeah, since it is working now that you have your 32 bit stuff sorted out, that was your problem. Easy MP3 | Software Installer | Password Manager Link to comment Share on other sites More sharing options...
Andreik Posted June 13, 2023 Share Posted June 13, 2023 I want to see how DllOpen fails. Use this and let us know the error code. $hDll = DllOpen($DLLNAME) If @error Then ConsoleWrite('Error: ' & @error & @CRLF) Link to comment Share on other sites More sharing options...
Husker_Jason Posted June 13, 2023 Author Share Posted June 13, 2023 22 minutes ago, Andreik said: I want to see how DllOpen fails. Use this and let us know the error code. $hDll = DllOpen($DLLNAME) If @error Then ConsoleWrite('Error: ' & @error & @CRLF) "Unfortunately", after I reinstalled AutoIt, it works now so it does not give an error anymore. I gave it a shot and now it just flys through the error check. Since I don't know how I originally screwed up my install to begin with, I can't get back to that original state. Link to comment Share on other sites More sharing options...
TheXman Posted June 13, 2023 Share Posted June 13, 2023 3 hours ago, Andreik said: I want to see how DllOpen fails. Use this and let us know the error code. $hDll = DllOpen($DLLNAME) If @error Then ConsoleWrite('Error: ' & @error & @CRLF) DllOpen() does not set @error upon failure. It only signals a failure by returning -1. CryptoNG UDF: Cryptography API: Next Gen jq UDF: Powerful and Flexible JSON Processor | jqPlayground: An Interactive JSON Processor Xml2Json UDF: Transform XML to JSON | HttpApi UDF: HTTP Server API | Roku Remote: Example Script About Me How To Ask Good Questions On Technical And Scientific Forums (Detailed) | How to Ask Good Technical Questions (Brief) "Any fool can know. The point is to understand." -Albert Einstein "If you think you're a big fish, it's probably because you only swim in small ponds." ~TheXman 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