Display: Visual Basic Version
The Visual Basic version of Display makes the window visible in the load event handler before calling fg_modeset() or fg_modetest(). It achieves the full screen display by setting the form's BorderStyle property to 0 (None) through the Properties window, then setting its WindowState property to 2 (Maximized) in the load event handler after switching to the 800x600 display resolution.
'*****************************************************************************
' *
' Display.frm *
' *
' This program resizes the desktop to 800x600 using the fg_modeset() *
' function. *
' *
'*****************************************************************************
Const vbWidth = 800
Const vbHeight = 600
Dim hPal As Long
Dim hVB As Long
Private Sub Form_Activate()
Call fg_realize(hPal)
Refresh
End Sub
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyEscape Or KeyCode = vbKeyF12 Then Unload Me
End Sub
Private Sub Form_Load()
ScaleMode = 3
Visible = True
If fg_modetest(vbWidth, vbHeight, fg_colors()) <> 0 Then
Call MsgBox("Cannot set 800x600 desktop", vbOKOnly Or vbCritical, "Error")
Unload Me
Exit Sub
End If
Call fg_modeset(vbWidth, vbHeight, fg_colors(), 1)
WindowState = 2 ' maximize window to 800x600
Call fg_setdc(hDC)
hPal = fg_defpal()
Call fg_realize(hPal)
Call fg_vbinit
hVB = fg_vballoc(vbWidth, vbHeight)
Call fg_vbopen(hVB)
Call fg_vbcolors
Call fg_setcolor(19)
Call fg_fillpage
End Sub
Private Sub Form_Paint()
Call fg_vbpaste(0, vbWidth - 1, 0, vbHeight - 1, 0, vbHeight - 1)
End Sub
Private Sub Form_Unload(Cancel As Integer)
Call fg_vbclose
Call fg_vbfree(hVB)
Call fg_vbfin
Call fg_modeset(0, 0, 0, 0)
End Sub
|