
#include<stdio.h>
#include<windows.h>

int main()
{
    STARTUPINFO si = { sizeof(si)};  // set si to zero
    PROCESS_INFORMATION pi = { 0 };   // set pi to zero

    // use dwFlags to hide windows
    si.dwFlags = STARTF_USESHOWWINDOW ;  // use showwindow
    si.wShowWindow = SW_HIDE ; // hide the window

    // create the notepad process

    if ( CreateProcess("C:\\Windows\\System32\\notepad.exe",NULL,NULL,NULL,FALSE,0,NULL,NULL,&si,&pi))
    {
        printf("Process is created successfully\n");
        printf("Process id: %lu\n",pi.dwProcessId);
        printf("Process thread id: %lu\n",pi.dwThreadId);

        // close the child process handles
        CloseHandle(pi.hProcess);
        CloseHandle(pi.hThread);

    }
    else
    {
        printf("Process not created, ERROR: %lu\n",GetLastError());
        return 1;
    }
    return 0;

}
