Hello, World! - QB64 - Win32 console.

by (Login MCalkins)
Moderator

 

It works! :-)

Regards,
Michael



' public domain, sept 2011, michael calkins
DECLARE DYNAMIC LIBRARY "kernel32"
    FUNCTION AllocConsole~& ()
    FUNCTION GetStdHandle~%& (BYVAL nStdHandle AS _UNSIGNED LONG)
    FUNCTION WriteConsoleW~& (BYVAL hConsoleOutput AS _UNSIGNED _OFFSET, BYVAL lpBuffer AS _UNSIGNED _OFFSET, BYVAL nNumberOfCharsToWrite AS _UNSIGNED LONG, BYVAL lpNumberOfCharsWritten AS _UNSIGNED _OFFSET, BYVAL lpReserved AS _UNSIGNED _OFFSET)
END DECLARE

DIM stdout AS _UNSIGNED _OFFSET
DIM trash AS _UNSIGNED LONG
CONST lenbuffer = 30
DIM buffer AS STRING * LENBUFFER
DIM n AS STRING * 1
n = CHR$(0)
buffer = "H" + n + "e" + n + "l" + n + "l" + n + "o" + n + "," + n + " " + n + "w" + n + "o" + n + "r" + n + "l" + n + "d" + n + "!" + n + MKL$(&HA000D)

trash = AllocConsole~&
stdout = GetStdHandle~%&(&HFFFFFFF5)
trash = WriteConsoleW~&(stdout, _OFFSET(buffer), lenbuffer \ 2, _OFFSET(trash), 0)

PRINT "Switch to the console window that was just created to see the message. Then"
PRINT "switch back, and press any key."
SLEEP
DO WHILE LEN(INKEY$)
LOOP
SYSTEM

Posted on Sep 11, 2011, 11:07 AM

Respond to this message   

Return to Index

Response TitleAuthor and Date
Has done for a while...Unseen on Sep 12
 Re: Has done for a while... on Sep 12
  This might help...Unseen on Sep 12
   *thanks. on Sep 12
    * Your allways welcome, you helped me enough! :) Glad to return the favour...Unseen on Sep 12

 Copyright © 1999-2014 Network54. All rights reserved.   Terms of Use   Privacy Statement