I would suggest using TerminateProcess and provide a handle to the process. That way if your program doesnt have the access rights to kill the selected process you can update the security token of the program.
Example:
// iMorg->EvilZone
bool KillProc(unsigned long pid)
{
HANDLE pHandle = OpenProcess(PROCESS_ALL_ACCESS,
FALSE,
pid);
if (pHandle == NULL)
return false;
if( !TerminateProcess(pHandle, 0) )
return false;
else
return true;
}
To do it when a key is pressed you can use GetAsyncKeyState() as ande said or you can hook the keyboard and look for the correct message.
EDIT: Shit didnt see the VB, nvm. Ill leave it if you ever need a c++ example anyway.
E