Now with program that reproduces the error under win7, it seems to have to do with changing window title, size, and virtual resolution.
See the image attached to see the various output values of GetDeviceID. (Amazingly the call within the function gives same answer always, while the one in the SYNC() loop differs based on window size)
Here is the code form that program:
// show all errors
SetErrorMode(2)
#constant SCREEN_WIDTH = 1200
#constant SCREEN_HEIGHT = 800
// set window properties
SetWindowTitle( "Test1" )
SetWindowSize( SCREEN_WIDTH, SCREEN_HEIGHT, 0 )
SetWindowAllowResize( 1 ) // allow the user to resize the window
// set display properties
SetVirtualResolution( SCREEN_WIDTH, SCREEN_HEIGHT ) // doesn't have to match the window
SetOrientationAllowed( 1, 1, 1, 1 ) // allow both portrait and landscape on mobile devices
SetSyncRate( 60, 0 ) // 30fps instead of 60 to save battery
SetScissor( 0,0,0,0 ) // use the maximum available screen space, no black borders
UseNewDefaultFonts( 1 ) // since version 2.0.22 we can use nicer default fonts
SetPrintSize( 18 )
#constant YES 1
#constant NO 0
#constant SCREEN_PIXELS_PC_WIDTH 1920
#constant SCREEN_PIXELS_PC_HEIGHT 1080
#constant SCREEN_PIXELS_MOBILE_WIDTH 1136
#constant SCREEN_PIXELS_MOBILE_HEIGHT 640
#constant NAV_EDITOR 0
#constant NAV_MAINMENU 1
#constant NAV_PLAY 2
menu_nav = 0
FUNC_GEN_set_window_properties( menu_nav )
do
print( "DeviceID : '" + GetDeviceID() + "'")
print( "" )
print( "Menu_Nav value: " + str(menu_nav) )
print( "" )
print( " - Click left mouse to change program mode")
print( "" )
print( " - Press ESC to exit")
If GetPointerReleased() = YES
inc menu_nav, 1
if menu_nav > NAV_PLAY then menu_nav = NAV_EDITOR
FUNC_GEN_set_window_properties( menu_nav )
endif
if GetRawKeyReleased(27) = YES then end
sync()
loop
function FUNC_GEN_set_window_properties ( nav )
select nav
case NAV_EDITOR:
SetWindowTitle ( "DeviceID '" + GetDeviceID() + "'")
SetWindowSize ( SCREEN_PIXELS_PC_WIDTH, SCREEN_PIXELS_PC_HEIGHT, NO ) // NO = normal window, YES = full screen
SetVirtualResolution ( SCREEN_PIXELS_PC_WIDTH, SCREEN_PIXELS_PC_HEIGHT ) // set display properties
SetOrientationAllowed ( YES, YES, NO, NO ) // portrait, portrait2, landscape, landscape2
endcase
case NAV_MAINMENU:
SetWindowTitle ( "DeviceID '" + GetDeviceID() + "'" )
SetWindowSize ( SCREEN_PIXELS_MOBILE_WIDTH, SCREEN_PIXELS_MOBILE_HEIGHT, NO ) // NO = normal window, YES = full screen
SetVirtualResolution ( SCREEN_PIXELS_MOBILE_WIDTH, SCREEN_PIXELS_MOBILE_HEIGHT ) // set display properties
SetOrientationAllowed ( NO, NO, YES, YES ) // portrait, portrait2, landscape, landscape2
endcase
case NAV_PLAY:
SetWindowTitle ( "DeviceID '" + GetDeviceID() + "'")
SetWindowSize ( SCREEN_PIXELS_MOBILE_WIDTH/2, SCREEN_PIXELS_MOBILE_HEIGHT/2, NO ) // NO = normal window, YES = full screen
SetVirtualResolution ( SCREEN_PIXELS_MOBILE_WIDTH/2, SCREEN_PIXELS_MOBILE_HEIGHT/2 ) // set display properties
SetOrientationAllowed ( NO, NO, YES, YES ) // portrait, portrait2, landscape, landscape2
endcase
endselect
endfunction