Seite 1 von 2

OpenConsole()

Verfasst: 29.12.2011 18:45
von 7x7
Hallo Leute,

regulär kann ich dem "OpenConsole()-Befehl keine Parameter übergeben. Gibt es dennoch eine Möglichkeit, ein Konsolen-Fenster gleich mit einer bestimmten Größe öffnen zu lassen?

Re: OpenConsole()

Verfasst: 29.12.2011 18:53
von RSBasic

Code: Alles auswählen

If OpenConsole()    
  stdout.l=GetStdHandle_(#STD_OUTPUT_HANDLE)  
  NewSize.SMALL_RECT
  NewSize\top = 0
  NewSize\left = 0
  NewSize\bottom=50
  NewSize\right=50
  SetConsoleWindowInfo_(stdout,1,@NewSize)
  
  mySize.l
  mySize = (51 << 16) + 51
  SetConsoleScreenBufferSize_(stdout, mySize) 
  Debug(Str(GetLastError_()) ) 
  Input()
EndIf
http://forum.oszone.net/thread-75006.html

Re: OpenConsole()

Verfasst: 29.12.2011 20:14
von 7x7
Danke, RSBasic! Werde es nachher mal ausprobieren.

(seltsam, auf was für Seiten du dich rumtreibst... :D )

Re: OpenConsole()

Verfasst: 30.12.2011 09:05
von Shardik
Eine Suche im deutschen oder englischen Forum hätte dort ähnliche Lösungen gefunden: :wink:
EgonEprom: http://www.purebasic.fr/german/viewtopi ... 87&start=4
Brice Manuel: http://www.purebasic.fr/english/viewtopic.php?t=26573

Re: OpenConsole()

Verfasst: 30.12.2011 11:38
von funkheld
Interessantes Thema. So etwas habe ich auch gesucht.
Hab hier mal etwas gemischt aus einer Purebasicdemo und hier.

Jetzt kann ich meine Messdaten über die serielle Schnittstelle schön Farbig und mit Positionen reinsetzen.

gruss

Code: Alles auswählen

text$  = "der consolentest..."                 ; just a small text$ string
dlay   = 1000                                  ; delay will set to 4000
;-------- Open our Console --------
OpenConsole()  
stdout.l=GetStdHandle_(#STD_OUTPUT_HANDLE) 
NewSize.SMALL_RECT
NewSize\top = 0
newSize\left = 0
NewSize\bottom=50
NewSize\right=50
SetConsoleWindowInfo_(stdout,1,@NewSize)
 
mySize.l
mySize = (51 << 16) + 51
SetConsoleScreenBufferSize_(stdout, mySize) 

; First we must open a console
    ConsoleTitle ("Consolentest:")  ; Now we can give the opened console a Titlename ;)                                                  
    EnableGraphicalConsole(1)                                                                                                 
;-------- Ask and display the UserName -------- 
    ConsoleLocate (10,12)                          ; x y position 
    Print ("Bitte Namen eingeben: ")               ; Ask for name
    name$=Input()                                  ; Wait for user input

    ClearConsole()                                 ; This will clean the ConsoleScreen
    
    ConsoleLocate (10,10)                          ; x y position 
    PrintN ("Willkommen "+name$)                      ; Print our text and the UserName
    ConsoleLocate (16,12)                          ; x y position
    PrintN (text$)                                 ; Print our text

    Delay (dlay)                                   ; Waits for moment
;-------- Cls and Cycle the Text-BG-Color 0 to 15 --------                                                 
    ClearConsole()                                 ; This will clean the ConsoleScreen
                                                   ; Info: Standard colors are (8 for text, 0 for backround)
    For i = 0 To 15
        ConsoleColor (0,i)                         ; Change BackGround text color (max 15) in every loop         
        ConsoleLocate (10+i,4+i)                     ; x y position 
        Print (text$)                              ; Print our text
    Next i

    Delay (dlay)                                   ; Waits for moment
;-------- Cls and Cycle the Text-FG-Color 0 to 15 --------
    ConsoleColor(0,0)                              ; Set back to black (0,0) for complete background...
    ClearConsole()                                 ; This will clean the ConsoleScreen
                                                   ; Info: Standard colors are (8 for text, 0 for backround)
    For i = 0 To 15
        ConsoleColor (i,0)                         ; Change ForGround text color (max 15) in every loop         
        ConsoleLocate (10,4+i)                     ; x y position 
        Print (text$)                              ; Print our text
    Next i

    Delay (dlay)                                   ; Waits for moment
;-------- Cls and Cycle the Background-Color 0 to 15 --------
    For a = 1 To 15
        ConsoleColor(a,a)                          ; Cycle background color...
        ClearConsole()                             ; This will clean the ConsoleScreen
        ;                                          ; Info: Standard colors are (8 for text, 0 for backround)
        For i = 0 To 15
            ConsoleColor (i,a)                     ; Change ForGround text color (max 15) in every loop         
            ConsoleLocate (5,4+i)                  ; x y position 
            Print (text$)                          ; Print our text
        Next i
        ;
        Delay(dlay/8)                              ; Waits for moment
      Next a   
      
    Delay (dlay)                                   ; Waits for moment
;-------- Cls and Cycle the Background-Color 0 to 15 --------
    For a = 1 To 15
      ConsoleColor(a,a)                          ; Cycle background color...
      ClearConsole()                             ; This will clean the ConsoleScreen
      ;                                          ; Info: Standard colors are (8 for text, 0 for backround)
      For i = 0 To 15
        ConsoleColor (i,a)                       ; Change ForGround text color (max 15) in every loop         
        ConsoleLocate (8+i,14+i)                 ; x y position 
        Print (text$)                            ; Print our text
      Next i
      
     Delay(dlay/8)                               ; Waits for moment
   Next a  
   
   ConsoleColor (4,15)  
   ConsoleLocate (8,40)                          ; x y position 
   Print ("fertisch...") 
   
   Input()
   CloseConsole()
End

Re: OpenConsole()

Verfasst: 30.12.2011 11:49
von ts-soft
Zeile 5 noch anpassen:

Code: Alles auswählen

stdout.i=GetStdHandle_(#STD_OUTPUT_HANDLE)
da ein Handle immer ein Integer ist, ansonsten könnte (muss nicht) es Probleme unter x64 geben :wink:

Re: OpenConsole()

Verfasst: 31.12.2011 00:31
von funkheld
Habe mit dem "lel" keine Probleme, du....?
x64 sind heute nur ein zwangskauf beim Computerkauf, welches Programm nutzt schon dieses x64 ?

gruss

Re: OpenConsole()

Verfasst: 31.12.2011 01:11
von ts-soft
In "naher" Zukunft wohl jedes und wenn Du das dann erst ändern möchtest, sachlich ist es trotzdem schon falsch,
auch wenn es unter 32-Bit keinen Einfluss hat.

und vielleicht hier auch mal lesen: http://www.purebasic.fr/blog/?p=42

Re: OpenConsole()

Verfasst: 31.12.2011 01:37
von NicTheQuick
funkheld hat geschrieben:Habe mit dem "lel" keine Probleme, du....?
x64 sind heute nur ein zwangskauf beim Computerkauf, welches Programm nutzt schon dieses x64 ?

gruss
:?

Re: OpenConsole()

Verfasst: 31.12.2011 02:20
von ts-soft
Erinnert mich ein bissel an den Wechsel von 16-Bit auf 32-Bit
Da konnte sich erst auch keiner mit seinem 640 KB PC vorstellen, das 32-Bit
mal standard wird und man soviel RAM und Rechenleistung benötigt :mrgreen:
Als dann Win95 kam, waren die meisten Rechner aber erstmal zu Leistungsschwach.
Ich hab Win95 mit Tricks dann auch mit 4 MB RAM betrieben, Systemstart dauerte
dann eben mal 15 Minuten :bounce:
64-Bit braucht mit Sicherheit länger bis es Standard wird, aber die meiste Zeit davon
ist ja bereits Vergangenheit.