Win 7, in fullscreen mode using Alt+Enter ends program

Windows specific questions.
elsairon
Posts: 207
Joined: Jul 02, 2005 14:51

Win 7, in fullscreen mode using Alt+Enter ends program

Postby elsairon » Jun 30, 2012 6:28

Here is a simple demonstration that shows switching screen from normal to full works correctly when following the code.

However, using Alt+Enter, which normally toggles fullscreen in windows applications causes the FB program to exit.

Is there something I could add to the code to prevent the program from exiting when using Alt+Enter to toggle from full screen back to the other view?

Code: Select all

screen 17,,,0
width 80, 25
? "Hello World"
sleep
screen 17,,,1
width 80, 25
? "Hello World"
sleep
screen 17,,,0
width 80, 25
? "Hello World"
sleep

pestery
Posts: 493
Joined: Jun 16, 2007 2:00
Location: Australia

Re: Win 7, in fullscreen mode using Alt+Enter ends program

Postby pestery » Jun 30, 2012 7:35

It worked fine for me (on Win7). Maybe your having a problem with Alt+Enter counting as a key press, which would interrupt the Sleep command. You could try adding something so that the program will only exit when a certain key is pressed, just in case there is a change.

Code: Select all

Screen 17,,,0
Width 80, 25
Do
   ? "Hello World"
   Sleep

   Dim As String key = InKey
   While key <> ""
      If key = Chr(13) Then Exit Do ' Enter -> exit program
      If key = Chr(27) Then Exit Do ' Escape -> exit program
      If key = Chr(32) Then Exit Do ' Space -> exit program
      If LCase(key) = "f" Then ' f -> make full screen
         Screen 17,,,1
         Width 80, 25
      EndIf
      If LCase(key) = "w" Then ' w -> make windowed
         Screen 17,,,0
         Width 80, 25
      EndIf
      key = InKey
   Wend
Loop
elsairon
Posts: 207
Joined: Jul 02, 2005 14:51

Re: Win 7, in fullscreen mode using Alt+Enter ends program

Postby elsairon » Jul 01, 2012 5:22

Here is code that exemplifies the problem better.

Run the program, then press Alt + Enter.

This ends the program for me, (on Win 7)

However, with the do...loop trapping there should be no exit, as far as I understand.

Code: Select all

screen 17,,,1
? "Hello World"
do
loop
fxm
Posts: 9947
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: Win 7, in fullscreen mode using Alt+Enter ends program

Postby fxm » Jul 01, 2012 5:42

Can you test this using the "GDI" graphic driver?

Code: Select all

setenviron("fbgfx=GDI")
screen 17,,,1
? "Hello World"
do
loop
MichaelW
Posts: 3500
Joined: May 16, 2006 22:34
Location: USA

Re: Win 7, in fullscreen mode using Alt+Enter ends program

Postby MichaelW » Jul 01, 2012 5:45

Perhaps it is triggering an exception and Windows is terminating it. I don't know how to do this on Win 7, but you may be able to determine what is happening by looking in the Application event logs.
elsairon
Posts: 207
Joined: Jul 02, 2005 14:51

Re: Win 7, in fullscreen mode using Alt+Enter ends program

Postby elsairon » Jul 01, 2012 6:00

fxm wrote:Can you test this using the "GDI" graphic driver?

Code: Select all

setenviron("fbgfx=GDI")
screen 17,,,1
? "Hello World"
do
loop


@ fxm - Using this code still ends the program for me with Alt+Enter.

@ MichaelW - I'm not sure where that is and I'll start searching, thanks.
[edit] I'm able to access the Event Viewer and see numerous logs of system events and I don't know if I can instruct windows to log all events of a specific app yet, or how to view them if I did.
elsairon
Posts: 207
Joined: Jul 02, 2005 14:51

Re: Win 7, in fullscreen mode using Alt+Enter ends program

Postby elsairon » Jul 01, 2012 7:09

I used a tool called Process Monitor (procmon.exe) from Sysinternals and was able to generate a csv logfile of a compiled version of the program, from start to finish.

The log is 22k odd lines of system operations.

The program sits idle after creating it's thread, and then 5 seconds later (when I use the Alt+Enter command) it issues a close thread.

The rest of the log ~11k lines of startup thread creation lasting about .7 seconds, and ~11k thread destruction, list systems events related to starting and ending the process lasting another .7 seconds. Most of these seem to be registry access.

I don't see anything related to errors, and conclude that the system views the program exiting as correct activity.

I'm not sure what my next step should be.
fxm
Posts: 9947
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: Win 7, in fullscreen mode using Alt+Enter ends program

Postby fxm » Jul 01, 2012 7:50

What happens with "screen 18,,,1" for example?
MichaelW
Posts: 3500
Joined: May 16, 2006 22:34
Location: USA

Re: Win 7, in fullscreen mode using Alt+Enter ends program

Postby MichaelW » Jul 01, 2012 8:46

If Win 7 comes with DrWatson, you could set it up (under 2000/XP, to do this you would start by executing drwtsn32.exe), and after the system notifies you that an error log has been created, look in the DrWatson log file. You can test the setup with an app that deliberately triggers an exception, for example an integer divide by zero exception:

Code: Select all

dim as integer i,j=1
j \= i

Return to “Windows”

Who is online

Users browsing this forum: No registered users and 6 guests