Jump to content

CloseHandle


Recommended Posts

I have two objects that I will use with OpenProcess throughout my application and I was wondering would it be a good idea to use CloseHandle before using OpenProcess on the second object. Also, is opening multiple processes at the same time considered a bad programming habit?

Link to comment
Share on other sites

  • Moderators

Depends on if it's the same exact call to the same exact process. If it's the same call, may just need to keep it open during the script maybe as a global and then close the handle before you exit.

If they are two different types of open ( eg. PROCESS_DUP_HANDLE and the other is like PROCESS_QUERY_INFORMATION ) or they are two different but constant executables that the pid doesn't change to, then you could possibly keep both handles open during the duration of your script and close them at the end of it.

Both of the above options would allow you to only call the OpenProcess() one time each exe.

But, sadly, we have no way on giving you proper advice without seeing how you're actually using it in your code. My suggestions are purely hypothetical to your interpreted hypothetical situation.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

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...