Jump to content

Help with ProcessClose()


Recommended Posts

#include <MsgBoxConstants.au3>



While 1
   $r_hash = 0
   Sleep(1000)
$r_hash += 1
$r_var = RegEnumVal("HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", $r_hash)
If @error <> 0 Then
   ExitLoop
Else
RegRead("HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", $r_var)
$var = RegRead("HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", $r_var)
MsgBox(4096, "Program files are in:", $var)
ProcessClose($r_var)
   EndIf
WEnd

Why my Process not close?

Link to comment
Share on other sites

  • Developers
26 minutes ago, adrieclipse said:

Why my Process not close?

No enough information, but doubt that the registry contains the proces name, but rather the fully qualified name (path+program).
So, What does happen ?
Do you get any MSgBox() at all?
Add error checking to get feedback from the ProcessClose() function!

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

A few issues with your coding --

  • You set $r_hash equal to 0 inside your loop. This needs to occur before the loop to avoid reading the same registry key over and over
  • Your initial RegRead isn't needed (you aren't capturing the resulting value)
  • $r_var doesn't contain the full executable name (no extension),  so you can't use it to close a process
Link to comment
Share on other sites

Link to comment
Share on other sites

19 minutes ago, Jos said:

No enough information, but doubt that the registry contains the proces name, but rather the fully qualified name (path+program).
So, What does happen ?
Do you get any MSgBox() at all?
Add error checking to get feedback from the ProcessClose() function!

Jos

How can i do he read the program name? 
msbox say me panth+program, but is possible say only program and close the process?

Link to comment
Share on other sites

17 minutes ago, Danp2 said:

A few issues with your coding --

  • You set $r_hash equal to 0 inside your loop. This needs to occur before the loop to avoid reading the same registry key over and over
  • Your initial RegRead isn't needed (you aren't capturing the resulting value)
  • $r_var doesn't contain the full executable name (no extension),  so you can't use it to close a process

msgbox say path+program, how possible msgbox say only program?

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