Help Variable Windows XP/7

Blitz3D Forums/Blitz3D Programming/Help Variable Windows XP/7

Yue(Posted 2013) [#1]
I have a problem trying to retrieve the data of a variable, in Windows XP I returned 2, however returns me windows 7 22 and that causes me problems in the logic of the program.

Someone who can help me to know what is happening. :(


Yasha(Posted 2013) [#2]
Going to need to post some code...


virtlands(Posted 2013) [#3]
OOps, I misunderstood,

,,,now it's apparent that it has something to do with video modes.


Yue(Posted 2013) [#4]
Windows XP OK no problem.


Problem Windows 7.



Code here:

Init Variable.
Copia_ModoVideo% = INI_GetValue(Fichero.INI_File,"Graficos","Modo_Video")


Disable / enable button save.
	If Graficos% = True
		
		AppTitle BCF_TestComboBoxType(CMB_ModoVideo%) +"X" + Copia_ModoVideo%
		
		If Copia_ModoVideo% <>  BCF_TestComboBoxType(CMB_ModoVideo%)  	Then 
			BCF_EnableGadget(Boton[BtonGuardar]\Imagen%,True)
		Else 
			BCF_EnableGadget(Boton[BtonGuardar]\Imagen%,False )
		End If 
		
		
	End If 


help please.


Yasha(Posted 2013) [#5]
...what's in the Windows 7 INI file at that line? It looks straightforward: the problem is that an invalid value is being retrieved. Has a different value been saved for Windows 7?

If not, perhaps post the INI file?


Midimaster(Posted 2013) [#6]
I think you want to store the value of the graphic card entry like "320x200".

But it looks like you save the index of the graphic mode in the modes list? 640x480 is very early in the list... so it is the second, And 720x480 is far doen the list at position 22?

So, some more questions about this:

What does the "2x2" represent?
What does it mean?
Send us all lines where Copia_ModoVideo% is used!

What do you want to store in Copia_ModoVideo%?
What do you want to store in CMB_ModoVideo%?


Yue(Posted 2013) [#7]
2X2

AppTitle BCF_TestComboBoxType (CMB_ModoVideo%) + "X" + Copia_ModoVideo%

Saves the current video last index to display in the combobox controls



File INI.
Kernel.img

Configuración General



;Opciones Gráficas
[ Graficos ]
Modo_Video =  2 ;Variable Copia_ModoVido!!
Calidad_Sombras = 1
Distancia_Dibujado = 2500.0
DOF = 1
SYNCV = 1
Modo_Windows = 0 
Calidad_Reflejos = 2
Calidad_Agua = 2
Filtro_Textura = 2
GLOW = 1
RAYS = 1



;Opciones Audio
[ Sonidos ]
VolumeMusica = 50.0
VolumeEfectos = 50.0
VolumeVoces = 50.0



;Opciones Pantalla
[ Pantalla ]
SubTitulos = 1
Lenguaje = 0



Yue(Posted 2013) [#8]
Code no problem XP, Yes problem Windows 7.




Yasha(Posted 2013) [#9]
Is the file posted above copied from your Windows 7 machine? If not, can you confirm that the INI file on Windows 7 stores exactly the same data as the file on Windows XP? It's possible that you're saving different values to the file, and that the error is actually happening earlier on in the program with however the file is generated.

Also, please use the "codebox" tag for large code blocks.


Yue(Posted 2013) [#10]
Ok,

INI Windows 7, index 800 600 32 = 4

;Configuración General



;Opciones Gráficas
[ Graficos ]
Modo_Video = 4 ; Windows 7 ,23 Windows XP
Calidad_Sombras = 1
Distancia_Dibujado = 2500.0
DOF = 1
SYNCV = 1
Modo_Windows = 1
Calidad_Reflejos = 2
Calidad_Agua = 2
Filtro_Textura = 2
GLOW = 1
RAYS = 1



;Opciones Audio
[ Sonidos ]
VolumeMusica = 50.0
VolumeEfectos = 50.0
VolumeVoces = 50.0



;Opciones Pantalla
[ Pantalla ]
SubTitulos = 1
Lenguaje = 0


I have noticed something strange with User32, with the aim of recovering the data on screen height and length windows desktop, I return the highest value or the current width in windows 7 returns an index below.

In windows xp if the screen width is 1024, 1024 returns user32 in windows 7 returns a inidce below.

Widht screen Windows 7 1024
User32 >>> Blitz 683 ....

It could be the cause of the problem??


Yasha(Posted 2013) [#11]
OHHHHH... you mean the index used for the CountGfxModes/GfxModeWidth etc. functions?

Those indices are completely non-portable! They very much depend on the individual machine. The point of those functions is that you must not assume anything about which modes are available - you should be using them to test which modes are available, and at what number. There is no reason to expect the indices would be the same, because there is no reason to expect that the same modes would even exist on another machine.

In other words, do not save this number: it is meaningless (it isn't even guaranteed to be the same if you restart your computer). Definitely do not compare it to a BCF mode setting, because there is no connection at all between the two!


Yue(Posted 2013) [#12]
but I'm doing the following.

Scanning first graphics modes, these index return me eg 1 to 5

; Copia_ModoVideo% 
Graphics3D GfxModeWidth(Copia_ModoVideo%),GfxModeHeight(Copia_ModoVideo%),GfxModeDepth(Copia_ModoVideo%)



Yue(Posted 2013) [#13]
Error User32.dll

Graphics3D 800,600,32
SetBuffer BackBuffer()
Global WidthDes% 			= User32_GetSystemMetrics (0)
Global HeightDes% 	 		= User32_GetSystemMetrics (1)


Text 0,0,WidthDes% + "X" + HeightDes%
Flip 
WaitKey()
EndGraphics()
End



No error Windows XP User32.dll



Yasha(Posted 2013) [#14]
It looks like your Windows 7 system is being confused by a DPI setting: http://stackoverflow.com/questions/2630392/getsystemmetrics-returns-wrong-value-for-sm-cxscreen

You should be able to use EnumDisplaySettings to get unscaled results instead: http://msdn.microsoft.com/en-us/library/windows/desktop/dd162611%28v=vs.85%29.aspx

(I don't know offhand how to use this function, will get back with details later if nobody beats me to it.)


Yue(Posted 2013) [#15]


Solved, I have a defect, and I do not understand programming I blame the engine.

From what has been learned is that in user32.dll in windows 7 returns the exact value of the height and width of the desk yet that erroneous information is displayed in the display properties.

The solution implies that 'running properly on Windows XP and Windows 7, when you start the program first scans graphics modes are supported, these values &#8203;&#8203;are saved in a file that are indexes, depending on operating system and graphics card are variably height and width data.

For example the 4 in windows 7 refers to graphical mode 800 * 600 -32 - on another machine this value worth 8 with Windows 7 and in Windows XP it in another machine 23 and 19.

They are like variables that take different data agrees oparativo system and graphics card.

But the error was in my head, and corrected the code into graphics mode scanning.

This data is stored for the user in combo box control, but internally handled indexes for each field are filled.




however in order to retrieve data from the height and width of the windows desktop, is that when the app is displayed on the desktop window mode, only available modes are displayed, but not on the desktop through windows, because if this were to happen that way, the user would choose by mistake so high, exceeding the width of the windows desktop and the application window would be much larger.

Thanks for attention.


virtlands(Posted 2013) [#16]
Yasha said,
"You should be able to use EnumDisplaySettings to get unscaled results instead:
http://msdn.microsoft.com/en-us/library/windows/desktop/dd162611%28v=vs.85%29.aspx "

Just out of curiosity, I tried for a while to figure out the

EnumDisplaySettings & EnumDisplayDevices functions,

and I couldn't figure it out, it's obviously a complicated mess.

Here is the proposed USER32.DECLS addition

; .lib "user32.dll"
;
; EnumDisplaySettings%(lpszDeviceName$, iModeNum%, lpDevMode* ) : "EnumDisplaySettingsA"
; EnumDisplayDevices%(lpDevice$, iDevNum%, lpDisplayDevice*, dwFlags%) : "EnumDisplayDevicesA"

;----------------------------------------------------------------------


col(Posted 2013) [#17]
Hiya,

The string arrays are fixed length strings even if the returned value doesn't fill the array, so use the maximum length possible when calculating sizes. DWORD, int, uint are 4 bytes, WORD and short are 2 bytes. TCHAR are 1 byte each for ANSI strings and 2 bytes for UNICODE string. ANSI strings use the *A version of functions ( EnumDisplaySettingsA ), and UNICODE is for the *W version ( EnumDisplaySettingsW ).

So armed with that information and choosing to use EnumDisplaySettingsA, dmSize is at byte offset 36 which would be a value of 156.

To use the EnumDisplaySettings* function you don't really need a lpszDeviceName value for the default display so leave it as an integer value of 0 or Null. The iModeNum parameter you would start at zero and keep increasing the value each time you call the function and if it returns a value greater than 0 then DEVMODE struct will be filled with data, you increase this value by 1 for the next display mode. If the return value is 0 then the function has failed signifying that there is no mode at the index of iNumMode, so you exit/quit the loop.

My Blitz3D is so rusty that it's seized up nowadays so I apologise in advance, but here's a 'Max version to display all modes returned using that function :-



' EDIT:- Added DM.dmSize inside the While loop to re-initialise correctly.


virtlands(Posted 2013) [#18]
Thanks col, I shall try your code. Looks like you've figured it out.


Yue(Posted 2013) [#19]
Hello, I continuco struggling with Blitz3D, and apparently I have acceptable results as expected in the resolution change. User32 I only used to retrieve the height and width of the windows desktop.

I tested this on three machines, Windows XP / 7/8 and apparently is working correctly, let me know your opinion.

A greeting.



Download Here: http://www.mediafire.com/?5t7pwu74uaqax99

:)


Addi(Posted 2013) [#20]
I'm getting error code 000x9et


Yue(Posted 2013) [#21]
OMG i`m Crazy!!


col(Posted 2013) [#22]
Works well here.

Asus N56V, Intel i7, Windows8.


Yue(Posted 2013) [#23]
@Col
One concern, language change works correctly?, Are not oddly shaped buttons?

Greetings.


virtlands(Posted 2013) [#24]
For me, it completely skips the menus and goes directly to the rotating figure.


col(Posted 2013) [#25]

One concern, language change works correctly?, Are not oddly shaped buttons?



Pardon my ignorance for not another language other than English ( Yes I have traveled the world a little and I feel ignorant for only knowing English ). After choosing Ingles for 1 - the selected tab and the 3 buttons at the bottom have no text. Changing screen again and every thing is perfect, graphics are good, images are good, all text is good.

Google translate:- [Perdonen mi ignorancia por no otro idioma que no sea Inglés (sí he viajado por todo el mundo un poco y me siento ignorante sólo para saber Inglés). Después de elegir Inglés para 1 - la ficha seleccionada y los 3 botones en la parte inferior no tener ningún texto. Cambiando pantalla de nuevo y todo es perfecto, los gráficos son buenos, las imágenes son buenas, todo el texto es bueno]


Yue(Posted 2013) [#26]
Col@ Pardon my ignorance for not...


I appreciate your help, it is very important for me, well I also feel very ignorant of the world and my daily struggle is to learn something new, and kill the demons of ignorance. But greatly appreciate that you use the translator is a nice touch.

The problem seems to be related to ReadPixelFast happen and seek a solution.

new versión fix problem.

@VirtLands For me, it completely skips the menus and goes directly to the rotating figure.


Operating System? Bits 32-64?, Graphics Card?

@Addi I'm getting error code 000x9et


That error is a mav, but not in that place happens if after changing screen resolution, or at the beginning.


Yue(Posted 2013) [#27]
http://blitzbasic.com/Community/posts.php?topic=100496