Jump to content

ProcessClose in AutoItX3 version 3.3.12.0 not working


takg
 Share

Recommended Posts

I just installed version 3.3.12.0 of AutoItX3.dll and now ProcessClose does not work.

If I put version 3.2.10.0 back in,  it works.

Any idea what's going on?

I am using Windows 7 Pro.

Edited by takg
Link to comment
Share on other sites

I forgot to say AutoitX3.dll. Sorry about that.

If nobody else can reproduce, I will try to post a sample. Everything works fine for compiled Autoit script. The problem is with the AutoitX3.dll

Edited by takg
Link to comment
Share on other sites

I will try to replicate the problem in a small program on Tuesday.

I am using Windows 7 SP1 Pro. Let me know what else you need to know.

The ProcessExists function does work.

I have tried Run As Administrator and that doesn't matter.

I don't have the manual for the AutoItX3.dll version 3.2.10.0. Has something changed since then?

Could this have something to do with closing the program that calls ProcessClose before the command has a chance to execute? I tried ProcessWaitClose but that didn't seem to work either.

Link to comment
Share on other sites

I am hoping someone can help me out. 

To do the test, I think a simple loop.exe for the app to close would work.

while 1

Sleep(1000)

wend

Now a script that loads the AutoItX3.dll and calls the ProcessClose function is needed. I have never used the DllCall function in AutoIt. Tutorial is here:

http://www.autoitscript.com/forum/index.php?app=core&module=attach&section=attach&attach_id=25713

Here is the function:

DllCall ( "dll", "return type", "function" [, "type1", param1 [, "type n", param n]] )
 
Would this work?
 
DllCall("AutoItX3.dll","void","AU3_ProcessClose","dword","loop.exe")
 
Could someone who knows how to use DllCall try this out? With AutoItX3.dll version 3.3.12.0 it will not work but with AutoItX3.dll version 3.2.10.0 it will work; namely, closing loop.exe.
 
This is to test the dll. I know it would be easier to just use AutoIt built-in ProcessClose function. I am using the dll in another development environment.
 
Also, if it works with both versions of the dll, I will have to post a sample from my development environment.
 
Please note that this is only a dll issue. Also, I have tried running as adminstrator and it doesn't fix the problem.
Link to comment
Share on other sites

I just tried ProcessClose in AutoItX which is packed with AutoIt3 version 3.3.12.0 and it works just fine.

EDIT:

C#

namespace AutoItXTest
{
    class Program
    {
        static void Main(string[] args)
        {
            AutoItX.ProcessClose("PCTest.exe");
        }
    }
}
Edited by JohnOne

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

Are you really using AutoIt to DLLCall into AutoItX, or is that just being used as and example?

Because if you are, that's nuts.

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 Gude
How 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

Link to comment
Share on other sites

Please read the entire thread carefully before commenting. The scripts below are just meant to show - in a convenient way - the problem with ProcessClose in 3.3.12.0 version of AutoItX3.dll.

Here is how to replicate the problem. 

You need two versions of the AutoItX3.dll (sorry, it won't let me attach so if you can't replicate it might be I have a corrupted version of the newer dll but other functions in the dll do work so I ruled this out): 3.3.12.0 and 3.2.10.0. Rename 3.3.12.0 to AutoItX3_new.dll and 3.2.10.0 to AutoItX3_old.dll.

Now, create a Loop.exe file using this:

while 1

Sleep(1000)

wend

 

Next, create a CloseLoop.exe using this script:

 

;Function declaration
;AU3_API int WINAPI AU3_ProcessClose(LPCWSTR szProcess);
 
;DllCall("AutoItX3_new.dll", "int", "AU3_ProcessClose","str", "Loop.exe")
 
DllCall("AutoItX3_old.dll", "int", "AU3_ProcessClose","str", "Loop.exe")
 
if @error Then
msgbox(0,"failed",@error)
    Else
msgbox(0,"success",@error)
endif
 
If you use the old dll, then it works. If you use the new dll, it does not.
Link to comment
Share on other sites

AutoItX3 dll is meant for use in other language such as VB and C# as you mentioned, and said it does not work.

I'm here to tell you that it does.

I think you should post your whole C# code because you are obviously doing something wrong.

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

Does this mean you can't replicate the problem with what I posted? If so, the only possibilities left in my view are that there is something wrong with my computer or the dll I have is corrupted. I will try re-downloading the dll and test on another computer.

My source code is irrelevant at this point because I can replicate the problem with what I have posted.

Link to comment
Share on other sites

I just tried re-downloading and installing AutoIt on a different computer. The same behavior is observed. Namely, when the old dll is used, the external Loop.exe is closed. When the new (re-downloaded) dll is used, the Loop.exe does not close.

So, at this point I strongly believe there is something wrong with the AutoItX3.dll version 3.3.12.0. 

I hope this helps someone. For now, I will continue to use the older version.

Link to comment
Share on other sites

If you run that code as an x64 bit process, it won't work. If you run that code as an x86 process it works fine. If you run it as an x64 process and replace AutoItX3.dll with AutoItX3_x64.dll it runs fine.

Make sure you're running with the right DLL when you compile your program. If your program is an x64 program you'll see the same problem.

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 Gude
How 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

Link to comment
Share on other sites

BrewManNH --- I think that was it! My development computer is 64-bit. Thanks. I learned something today. I am not sure how this will affect things for me (namely, do I need x86 and x64 versions of everything? Or do I just need AutoItX3_x64.dll on 64-bit development machines?) but at least I have my work cut out for me now. Thanks again.

Link to comment
Share on other sites

Depending on what you're doing, you might only need an x86 version of your program to do it on both 64 bit and 32 bit operating systems.

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 Gude
How 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

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...