Autor Beitrag
aminitoy
Hält's aus hier
Beiträge: 15



BeitragVerfasst: Mo 28.12.09 16:23 
Hallo,

In meiner Konsolen Anwendung erstelle ich eine Windows Form. Wie kann ich zugleich das Konsolenfenster schließen oder verstecken ohne das er mir die Windows Form schließt?
und ich möchte trotzdem meine konsolen anwendung haben und nicht auf eine windows anwendung umstellen, hat seine gründe!

danke im vohinein
andy11
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 21



BeitragVerfasst: Mo 28.12.09 17:35 
versuchs einmal mit dem Befehl Hide();
geht für Windows Forms, bin mir daher nicht sicher ob er auch für console geht

lg andy
Th69
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Moderator
Beiträge: 4809
Erhaltene Danke: 1061

Win10
C#, C++ (VS 2017/19/22)
BeitragVerfasst: Mo 28.12.09 18:13 
Das müßte mit dem WinAPI-Befehl FreeConsole gehen.
Mittels P/Invoke dann aus C# aufrufbar, s. www.pinvoke.net/defa...l32/FreeConsole.html
aminitoy Threadstarter
Hält's aus hier
Beiträge: 15



BeitragVerfasst: Di 29.12.09 09:11 
Mit Hide hab ich es schon überlegt finde das mit FreeConsole aber die schönere Lösung.
Was mir nicht so gefällt ist das er die Konsole trotzdem kurz aufblinken lässt.

Danke für die Hilfe!
Th69
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Moderator
Beiträge: 4809
Erhaltene Danke: 1061

Win10
C#, C++ (VS 2017/19/22)
BeitragVerfasst: Di 29.12.09 11:30 
Und warum willst du dann keine Windows-Anwendung erstellen? Du könntest auch umgekehrt mittels 'AllocConsole' dort dann eine Konsole zusätzlich öffnen.

Edit: Alternativ kann man auch 'Application.Run()', d.h. ohne Parameter benutzen, muß dann aber für das Beenden irgendwo 'Application.Exit()' aufrufen.
So könntest du wahlweise ein Formular öffnen und/oder eine Konsole.