createprocess



  • hallo forum!!!
    ich verstehe create process nicht richtig:

    aus msdn:

    BOOL CreateProcess(
      LPCTSTR lpApplicationName,
      LPTSTR lpCommandLine,
      LPSECURITY_ATTRIBUTES lpProcessAttributes,
      LPSECURITY_ATTRIBUTES lpThreadAttributes,
      BOOL bInheritHandles,
      DWORD dwCreationFlags,
      LPVOID lpEnvironment,
      LPCTSTR lpCurrentDirectory,
      LPSTARTUPINFO lpStartupInfo,
      LPPROCESS_INFORMATION lpProcessInformation
    );
    
    ////////////////////////////////////////////////////////////////
    // ERZEUGEN EINES PROZESSES
    // Aufruf von NOTEPAD
    
    #include <iostream.h>
    #include <process.h>
    #include <windows.h>
    
    void main( void ) {
    
        STARTUPINFO si;               
        PROCESS_INFORMATION pi;
    
        ZeroMemory( &si, sizeof(si) );  // fülle Speicherbereich mit NULL
        si.cb = sizeof(si);             // Grösse des Speicherbereichs
        ZeroMemory( &pi, sizeof(pi) );  // fülle Speicherbereich mit NULL
    
        bool ok = CreateProcess( NULL, "Notepad.exe", NULL, NULL,FALSE, 
                                 0, NULL, NULL, &si, &pi )    
    
        if (!ok)   cout <<  "CreateProcess failed." ; 
    
        // PROCESSINFORMATION abfragen:
    
        cout << "Kind-Prozess ID: "            << pi.dwProcessId << endl; 
        cout << "Kind-Prozess HANDLE: "        << pi.hProcess << endl;
        cout << "Kind-Prozess Thread-HANDLE: " << pi.hThread << endl;
        cout << "Kind-Prozess Thread-ID: "     << pi.dwThreadId << endl;
    
        // Wait until child process exits.
        WaitForSingleObject( pi.hProcess, INFINITE );
    
        // Close process and thread handles. 
        CloseHandle( pi.hProcess );
        CloseHandle( pi.hThread );
    }
    

    bitte kann mir da jemand die Parameter von CreateProcess erkären?
    das ist mit &si, &pi.....und der erste Parameter: NULL vor Notpad.exe????
    was muss man sonst noch wissen dazu??

    mfg trancer 🙂



  • wie mache ich den process unsichtbar: mit sw_hide oder so? wo gibt man das rein??

    mfg trancer 🙂



  • ...ist doch alles super in der MSDN beschrieben: MSDN: CreateProcess



  • trancer schrieb:

    wie mache ich den process unsichtbar: mit sw_hide oder so?

    Im STARTUPINFO-Struct bei dwFlags STARTF_USESHOWWINDOW mit angeben und dann den Member wShowWindow mit SW_HIDE füllen - versuch das mal. 🙂


Anmelden zum Antworten