• Welcome to PlanetSquires Forums.
 

Problems with Windows 10

Started by José Roca, April 26, 2018, 08:54:58 AM

Previous topic - Next topic

José Roca

I have bought a new HP computer with Intel i5-7500 3,4 GHz and I'm having problems trying to use FreeBasic with it.

Just using

#include once "windows.bi"

generates the following output (using -v -showincludes to display the tree of included files):


FreeBASIC Compiler - Version 1.05.0 (01-31-2016), built for win32 (32bit)
Copyright (C) 2004-2016 The FreeBASIC development team.
standalone
target:       win32, 486, 32bit
compiling:    C:\Programación\Tests\x.bas -o C:\Programación\Tests\x.asm (main module)
x.bas
|  C:\Programación\FreeBasic32\inc\windows.bi
|   |  C:\Programación\FreeBasic32\inc\crt\stdarg.bi
|   |  C:\Programación\FreeBasic32\inc\win\windef.bi
|   |   |  C:\Programación\FreeBasic32\inc\win\_mingw.bi
|   |   |  C:\Programación\FreeBasic32\inc\win\winapifamily.bi
|   |   |  C:\Programación\FreeBasic32\inc\win\basetsd.bi
|   |   |   |  C:\Programación\FreeBasic32\inc\win\_mingw.bi
C:\Programación\FreeBasic32\inc\win\_mingw.bi(23) error 4: Duplicated definition, __STRINGIFY in '#define __STRINGIFY(x) #x'
C:\Programación\FreeBasic32\inc\win\_mingw.bi(24) error 4: Duplicated definition, __MINGW64_STRINGIFY in '#define __MINGW64_STRINGIFY(x) __STRINGIFY(x)'
C:\Programación\FreeBasic32\inc\win\_mingw.bi(38) error 4: Duplicated definition, __MINGW_IMP_SYMBOL in '#define __MINGW_IMP_SYMBOL(sym) _imp__##sym'
C:\Programación\FreeBasic32\inc\win\_mingw.bi(39) error 4: Duplicated definition, __MINGW_IMP_LSYMBOL in '#define __MINGW_IMP_LSYMBOL(sym) __imp__##sym'
C:\Programación\FreeBasic32\inc\win\_mingw.bi(41) error 4: Duplicated definition, __MINGW_USYMBOL in '#define __MINGW_LSYMBOL(sym) sym'
C:\Programación\FreeBasic32\inc\win\_mingw.bi(46) error 4: Duplicated definition, __MSABI_LONG in '#define __MSABI_LONG(x) x##l'
C:\Programación\FreeBasic32\inc\win\_mingw.bi(78) error 4: Duplicated definition, _CRT_INSECURE_DEPRECATE_MEMORY in '#define _CRT_INSECURE_DEPRECATE_MEMORY(_Replacement)'
C:\Programación\FreeBasic32\inc\win\_mingw.bi(79) error 4: Duplicated definition, _CRT_INSECURE_DEPRECATE_GLOBALS in '#define _CRT_INSECURE_DEPRECATE_GLOBALS(_Replacement)'
C:\Programación\FreeBasic32\inc\win\_mingw.bi(81) error 4: Duplicated definition, _CRT_OBSOLETE in '#define _CRT_OBSOLETE(_NewItem)'
C:\Programación\FreeBasic32\inc\win\_mingw.bi(87) error 4: Duplicated definition in 'declare function __mingw_get_crt_info() as const zstring ptr'
C:\Programación\FreeBasic32\inc\win\_mingw.bi(87) error 132: Too many errors, exiting


Looks like the #pragma once and #include once directives are being ignored and the compiler tries to parse _mingw.bi twice.

Regardin WinFBE and other executables of some of my examples, they don't scale according the DPI setting and run at 96 DPI.

PowerBasic runs fine.

Paul Squires

Hi José, what you describe seems super strange. I have been using Windows 10 since it was released. Never had any problems with it. It runs even better than Windows 7. I haven't noticed any scaling issues either. FireFly looks ugly on my new system but WinFBE looks perfect. Here are my specs:

Dell XPS, 16 gig RAM, i7-7700HQ @ 2.80GHz (64-bit Win10)

I am running a 3840 x 2160 screen at 350% scaling.
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

José Roca

And the biggest problem is that I can't investigate because I can't compile.

> I am running a 3840 x 2160 screen at 350% scaling.

Now you know why I have been so insistent about the importance of writing DPI aware applications. When running virtualized at such scaling, controls like check boxes a radio buttons look particullary horrible.

Johan Klassen

is C:\Programación equivalent to C:\Program Files? if so it could be a permissions problem

José Roca

No, it happens that apparently FreeBasic does not like Spanish accents. After renaming the folder to "Programs", it works fine.

Now I have to investigate why it does not scale.

José Roca

To solve the second problem, I have changed this line in CWindow.inc


IF AfxUseDpiScaling = 0 THEN this.DPI = 96 ELSE this.DPI = -1


to


IF AfxIsProcessDpiAware = FALSE THEN this.DPI = 96 ELSE this.DPI = -1


AfxUseDpiScaling queries the registry entry "Software\Microsoft\Windows\DWM" for the value of "UseDpiScaling", but this value is not present in my registry. I think that I used it in the times of Windows XP, where you could use large font but did not support the IsProcessAware function. Workarounds sometimes end biting you.

I have noticed that with Windows 10 you can change the DPI on the fly and Windows resizes the window and controls Cool!

@Paul,

I'm attaching the modified CWindow.inc file to allow you to test if it work with your editor.

Paul Squires

Quote from: José Roca on April 26, 2018, 02:13:38 PM

@Paul,

I'm attaching the modified CWindow.inc file to allow you to test if it work with your editor.


Thanks! I have tried it wil both a 32 and 64 recompile of the editor and both seem to work okay. I haven't noticed any problems but if I do I will be sure to let you know.
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

Paul Squires

Quote from: José Roca on April 26, 2018, 02:13:38 PM
AfxUseDpiScaling queries the registry entry "Software\Microsoft\Windows\DWM" for the value of "UseDpiScaling", but this value is not present in my registry. I think that I used it in the times of Windows XP, where you could use large font but did not support the IsProcessAware function. Workarounds sometimes end biting you.
On my system, that Registry entry existed and was set to true so of course I never noticed any issues. Thanks for fixing the issue so that it will now work on all modern versions of Windows.
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

José Roca

Great. I have recompiled your editor and I can work with FreeBasic again.