Problem changing screen resolution.

Blitz3D Forums/Blitz3D Programming/Problem changing screen resolution.

Yue(Posted 2014) [#1]




Not to do, whenever you make a change screen resolution in either full screen or windows mode, the application is behind other windows, for example if you run from your root directory, when changing screen resolution remaining after the application window.

Any suggestions?


RemiD(Posted 2014) [#2]
There is a windows command to give a window the focus, i don't remmember exactly how to do it...
SetWindowPos()
Here :
http://msdn.microsoft.com/en-us/library/windows/desktop/ms633545(v=vs.85).aspx


Guy Fawkes(Posted 2014) [#3]


is easier & faster :P

And yes, before you ask, you CAN infact use another window handle in place of "hwnd" IF it actually IS equal to a window ID. :)

Regards,

~GF


Yue(Posted 2014) [#4]
The translator does not help me, ?, how that goes in a file userlibs ?, A more detailed example please.


Guy Fawkes(Posted 2014) [#5]
user32.decls



Save the above code into a blank text file called "user32.decls" inside your "blitz3d/userlibs" folder.

Then call the "api_setfocus()" function, & follow all the directions that are already in my 1st post. :)

Sorry for the inconvenience, Yue!

Good luck with Pawn, it's looking GOOD! Keep up the great work, Yue! :)

Sincerely,

~GF


Yue(Posted 2014) [#6]
Thank you very much, I just feel I'm like a salmon struggling upstream, I have always something to learn and improve. :)


Yue(Posted 2014) [#7]
Oops, no run Editor Ideal... :(


Yue(Posted 2014) [#8]
and put the file in usr libs, however not start Blitz3D editor or Ideal, which may be?




Guy Fawkes(Posted 2014) [#9]
Put the user32.decls file in the blitz3d/userlibs folder, and use Blitz3D IDE. If it works in the Blitz3D IDE, then it should work in IDeal.


Yue(Posted 2014) [#10]
It does not work, neither with nor Blitz3D Ideal if the file Userlibs off everything returns to normal.


Guy Fawkes(Posted 2014) [#11]
Ok, then open "C:\Archivos de programa\IDEal\Conf\Blitz3D.lng" & post the log so I can see what's going on.


Yue(Posted 2014) [#12]
I'm on Windows 8-64 bits ?, will that cause the problem?


Guy Fawkes(Posted 2014) [#13]
Possibly. Try running it in Windows 7 compatibility mode.


Yue(Posted 2014) [#14]
Now, the problem is resolved, the Draw3D2 lib makes calls to User32.dll from Userlibs directory, then within that file where the calls are made've pasted all the commands and User32 and all is well.

.lib "user32.dll"

Draw3D2_GCP% (lpPoint*) : "GetCursorPos"
Draw3D2_GWR% (hwnd%,lpRect*) : "GetWindowRect"
api_SetFocus% (hwnd%) : "SetFocus"
.lib " "

MouseX3D( )
MouseY3D( )
MouseXOld3D( )
MouseYOld3D( )
MouseXSpeed3D( )
MouseYSpeed3D( )
MouseHit3D( )
MousePit3D( )
MouseDown3D( )
MouseOver3D( )
MouseTest3D( )
ProjectedX3D( )
ProjectedY3D( )
GetMOW3D( )
...



Guy Fawkes(Posted 2014) [#15]
I'm glad you fixed the problem, Yue! :) See, we ALL feel like "fish upstream" most times, but we keep pushing til' we reach the top of the stream! ;)


Yue(Posted 2014) [#16]
New problem, when I launch the application in debug mode it works correctly, the window has focus and if I try to go somewhere else is impossible, but I think if the executable does not work properly.

I have the api command within the main loop.


Yue(Posted 2014) [#17]
Only seems to work if the application is launched from the Windows desktop, if the application from a directory such launches DirPawn \ Pawn.exe not work and after the resolution change is behind the DirPawn directory ...

Any idea?


Yue(Posted 2014) [#18]
Graphics3D 800,600,32,2

Global hwnd = SystemProperty$("AppHWND")

Repeat 
	
	api_SetFocus(hwnd)
	
	RenderWorld
	
	Flip
	
Forever 



Work Perfect on Ideal debugger true, this works fine in debug mode, but the executable does not work
Is there any way to make a change screen resolution from a lib?


Guy Fawkes(Posted 2014) [#19]
Yue, set focus is to give focus to the selected window handle.

SetWindowPos() is to move and / or resize the window.




Yue(Posted 2014) [#20]
But as I do to make it above other windows and not behind the directory where the application is running?


Yue(Posted 2014) [#21]
Ok, I get it, I am a brute in this, my greatest difficulty is not speaking English .... :(
Now everything works perfectly, I just need to know what the api that returns the width and height of the desk desk to position the window in the middle of the desk.
Thanks for your patience ...


Guy Fawkes(Posted 2014) [#22]
api_SetActiveWindow(hWnd)


?


Guy Fawkes(Posted 2014) [#23]
No problem, Yue. :) You're doing JUST fine bud. :) Keep on pushing along & don't even let TROLLS stop you! The rewards will be GREATLY worth it in the end. Just remember that.

As for the commands you need for the Desktop resolutions, just use:



Hope that helps! :)

Good luck, buddy! :)

Sincerely,

~GF


Yue(Posted 2014) [#24]
Global hwnd = SystemProperty$("AppHWND")
Init_ObjEscena%() ; Init Graphics3D Object G3D.Graphics3D Witht, height
Init_Sistemas%()

api_SetWindowPos(hwnd, -1, api_GetSystemMetrics(0)/2-G3D\Ancho/2, api_GetSystemMetrics(1)/2-G3D\Alto/2, G3D\Ancho, G3D\Alto, 1)
api_SetActiveWindow% (hwnd%)


Thank you very much, everything works perfect here, and the window does not stay back after the change of resolution and is active in the main desktop mode.

:)


Guy Fawkes(Posted 2014) [#25]
Glad to see all is well, Yue! Don't you EVER give up again. I do NOT want to see that. Nothing in life worth having is easy. REMEMBER that! :) Don't even let the trolls bring you down, otherwise, you will never succeed! :)

Sincerely,

~GF


Yue(Posted 2014) [#26]
This is incredible, let me recognize the screen resolution of the end user's desktop, and if less than the highest display resolution supported by my application only shows the first two, to avoid the application to be much larger than the windows desktop. :). This increasingly looks better and I think if I can make a game.

Desk is at 1024x768 in windowed mode, the maximum resolution is 1280 x 800 is not shown




Guy Fawkes(Posted 2014) [#27]
WOH! You're right, Yue! This IS incredible! :O

GREAT job! DO NOT quit!

Keep up the GREAT work!

Sincerely,

~GF


Guy Fawkes(Posted 2014) [#28]
Also, if you need a beta tester / english translator, I can help with either OR both if you like! Count me in! :D This looks like it could be some fun to test! :D

Way to go, Yue! :D

Sincerely,

~GF


stayne(Posted 2014) [#29]
Good job bud.


Guy Fawkes(Posted 2014) [#30]
Yue, just ignore him. He follows me around like a lost puppy dog & tries to troll me but I took away his power. :)


stayne(Posted 2014) [#31]
I was talking to you.


Guy Fawkes(Posted 2014) [#32]
No one cares. :)


Yue(Posted 2014) [#33]
Guy Fawkes, I use google translator to translate the English language for GUI, if not fine.




xlsior(Posted 2014) [#34]
"Accion" is not an English word -- Depending on what you need it to actually do, it should probably be either "Action" or "Task" ?


Yue(Posted 2014) [#35]
That word I use for the user by pressing the E key, Realize an event, such as trying to open a door, kicking a box.




Bobysait(Posted 2014) [#36]
Add this, it's ... amust have in any games ;)




Und, auf Wieder Sehen :)