Hello,

I am trying to use the EndProc() UDF to close all instances of KIX32.EXE on the local workstation when a button is clicked, but for some reason they will not close. If I change the $PROC to "notepad.exe" it will close notepad. What am I doing wrong? I am running the button in a wkix32.exe kixform script. The code is below:

Code:

;************* Button2 **************
$Button2 = $Form.Controls.Button()
$Button2.FontBold = "True"
$Button2.FontSize = 12
$Button2.Height = 39
$Button2.Left = 200
$Button2.Text = "Stop Printing"
$Button2.Top = 380
$Button2.Width = 254
$Button2.OnClick = "OnButtonClick2()"
;**************************************

Function OnButtonClick2

$COMPUTER = @WKSTA
$PROC = "kix32.exe"
ENDPROC($PROC,$COMPUTER)


EndFunction

FUNCTION ENDPROC($PROC, optional $COMPUTER)
Dim $Process,$RC
IF $COMPUTER=''
$COMPUTER='.'
ENDIF
For each $Process in GetObject('winmgmts:{impersonationLevel=impersonate}!\\'+$COMPUTER+'\root\cimv2')
.ExecQuery('select * from Win32_Process where Name='+'"'+$PROC+'"')
$RC=$Process.Terminate
Next
ENDFUNCTION



Thanks for all your help,

-Michael
_________________________
Help Computa!