I'm getting pretty pissed off at the examples in MSDN never working for me. :P

I have this code STRAIGHT from MSDN:

ProcessID& = Shell("Calc.exe", vbNormalFocus)
processhandle& = OpenProcess(SYNCHRONIZE, True, ProcessID&)

MsgBox "Calculator has been launched!"

ret& = TerminateProcess(processhandle&, 0&)
ret& = CloseHandle(processhandle&)
ret& = CloseHandle(processhandle&)

MsgBox "calculator has been terminated"

Considering where its from, shouldn't it work? does this little bit of code work for anyone else?

While they're here, can anyone explain why CloseHandle is called twice, and then suggest a solution for closing something given the process ID? :P

THank you! :)