Autor Beitrag
Thunder
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 145

WinXP
D6 Pers
BeitragVerfasst: Do 26.02.04 21:05 
Hallo,

Wie funktioniert der Befehl AllocConsole aus der Win32API?

Er hat keine Parameter und öffnet eine DOS-Konsole. Aber wie führe ich in der Konsole dann DOS-Befehle aus??

Und wie kriege ich das Handle auf die Konsole?

Und zu guter letzt: Wie ändere ich Titel und Icon?? Das müsste ich doch dann über das Handle machen??!!

Ich will eine Konsole öffnen und dort ein Proggi starten (Seti). Das aber IN DER KONSOLE auch wieder beenden und wieder starten OHNE das eine neue Konsole aufgemacht wird.

Habe dafür schon folgenden C-Code von Autor von SetiStash erhalten:
ausblenden Quelltext
1:
2:
3:
AllocConsole();
 _snprintf(idleTitle, sizeof(idleTitle), "SetiStashConsoleWindow%d", GetCurrentProcessId());
 SetConsoleTitle(idleTitle);


Danke im VOraus


Zuletzt bearbeitet von Thunder am Fr 27.02.04 19:54, insgesamt 1-mal bearbeitet
Tana´Ri
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 230



BeitragVerfasst: Fr 27.02.04 14:07 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
GetStdHandle( Value: DWord ): THandle;
{
Value: 
 - STD_INPUT_HANDLE Handle to the standard input device. Initially, this is a handle to the console input buffer, CONIN$. 
 - STD_OUTPUT_HANDLE Handle to the standard output device. Initially, this is a handle to the active console screen buffer, CONOUT$. 
 - STD_ERROR_HANDLE Handle to the standard error device. Initially, this is a handle to the active console screen buffer, CONOUT$. 
}


ReadMore

_________________
mfg
Tana´Ri
Thunder Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 145

WinXP
D6 Pers
BeitragVerfasst: Fr 27.02.04 14:46 
Also um ein Proggi in der COnsole zu starten hab ich folgenden Code gefunden:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
private
  aPI       : TProcessInformation;

var
  aSI: TStartupInfo;

// auszuführender DOS-Befehl
    // TStartupInfo-Datenstruktur initialisieren 
    FillChar(aSI, Sizeof(aSI), #0); 
    with aSI do begin 
      cb := Sizeof(aSI); 
      dwFlags := STARTF_USESHOWWINDOW; 
      wShowWindow := SW_SHOWDEFAULT; 
    end
    // DOS-Programm als neuen Process starten 
    CreateProcess(nil'F:\seti.exe'nilnil, False,
      CREATE_SEPARATE_WOW_VDM or NORMAL_PRIORITY_CLASS, 
      nilnil, aSI, aPI);


hab noch andere befehle. wie zum beispiel die farbe ändern.

Mein Problem noch:
Wie beende ich ein Proggi in der Console wieder???