The program writes its line of text then crashes with the usual unhelpful windows message that the program has stopped responding.
FBdebugger says WriteConsoleOutputCharacter is trying to write to location zero.
Am I using the wrong library?
Code: Select all
#INCLUDE "windows.bi"
dim Colr As Long
dim hStdOut As Handle
dim ul As Coord
dim as string txt
dim as long row, col, fgcolr, bgcolr
txt = "what hath god wrought"
fgcolr = 14
bgcolr = 6
row = 12
col = 40
Colr = BgColr * 16& + FgColr
ul.x = col - 1
ul.y = row - 1
hStdOut = GetStdHandle(STD_OUTPUT_HANDLE)
WriteConsoleOutputCharacter hStdOut, Txt, Len(Txt), ul, 0
FillConsoleOutputAttribute hStdOut, Colr, Len(Txt), ul, 0