Ending program with #CONSOLE OFF
Another good way is to use the following commands in your input loop :
GRAPHIC GET DC TO hwin : IF hwin = 0 THEN END
Announcement
Collapse
No announcement yet.
CONSOLE OFF and Destination file write error
Collapse
X
-
-
Iswindow
With applications that use only a graphic window i sometimes use the Iswindow function
to periodically check if the window still exists, and if not to terminate the application.
Arie Verheul
Code:Declare Function IsWindow Lib "USER32.DLL" Alias "IsWindow" (ByVal hWnd As Dword) As Long Function PBMain . . . . While IsWindow(hWnd): Sleep 1000: Wend End Function
Leave a comment:
-
Dennis--
I think it's possible the more important issue is how to terminate a console program. There are 3 primary ways to do this automatically:
1- Close the console window by clicking the "X" button. Windows then ends the program for you.
2- Your program flow exits the PBMain() function.
3- You execute an END statement.
If you open 1, 2, or even 100 other windows (like GRAPHIC Windows), then close them, the program will not automatically terminate, because that's just not the way Windows works. If you write a program without a visible console window, you just need to end the program in one of the other ways, when it's appropriate. Otherwise, it could keep running invisibly, in the background, virtually forever. When the program is still executing, it is not possible to re-compile it.
Best regards,
Bob Zale
PowerBASIC Inc.
Leave a comment:
-
No need to reply to this> I found out that the function I was looking for is GRAPHIC WAITKEY$
Leave a comment:
-
CONSOLE OFF and Destination file write error
Appearantly the #CONSOLE OFF macro does not really git rid of the console in the graphics commands or it has to be used with a function I do not know
about to close the invisible console. When I use it and recompile Graphics window programs I modify for #CONSOLE OFF I get the "Destination file write" error that tells me the program is still running after I close the graphics window.
What function or macro should I use to close an ENTIRE #CONSOLE OFF based graphics window program and not get the "Destination file write" error?Tags: None
Leave a comment: