So in my code I'm opening for example notepad using ShellExecute and I want to close it after but I cannot find any working way, so my question is, what is the easiest way to close particular aplication using c++ code?
#include <iostream>
#include <Windows.h>
int main()
{
ShellExecute(NULL, "open", "notepad", NULL, NULL, SW_SHOWDEFAULT);
Sleep(10000);
//here I'm missing the part that closes previously opened notepad
return 0;
}