Jump to content
Sign in to follow this  
dramaking

CloseHandle

Recommended Posts

dramaking

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?

Share this post


Link to post
Share on other sites
SmOke_N

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.

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.