I've made a small gdi proggie and would like to make it run fullscreen
in 640x480 mode.
i would like to know how to :
(A) make the program run in fullscreen
(B) how to set the screen-res to 640x480 so the program is not just
a tiny square on a nice 1024x768 screen ( kinda like stretch-to-fit, except not changing the aspect ratio )
any help/code/(ranting?) would be appreciated very much :)
How too:
http://msdn.microsoft.com/en-us/library/windows/desktop/dd183411(v=vs.85).aspx
Example:
http://www.quickersoft.com/examples/Resolution.zip
thanks. unfortunately - it doesnt look like I can get 640x480 in Win7 :( bummer.
and any examples on creating a fullscreen window?
and can it be done from a DialogBox? (i.e the kind that's in the resources called by DialogBoxParam )
If you mean full screen as in no window, I think you are restricted to directx.
you can use a window handle of HWND_DESKTOP, which is 0
of course, you mess up their desktop - lol
or - you can create a borderless window that is the size of the screen at coord 0,0
you can get the window size with GetSystemMetrics
but - if you want the workspace - SystemParametersInfo has that
the workspace excludes things like taskbars
then, there is always a borderless, captionless window that is maximized
oh - and you can use EnumDisplaySettings to get the supported screen resolutions
Quote from: kroz on July 25, 2012, 06:35:55 PM
thanks. unfortunately - it doesnt look like I can get 640x480 in Win7 :( bummer.
On both my Win7 and XP boxes 800x600 is the minimum resolution. I run both my machines in 1920x1080 resolution.
Hrmmm...
Yes, GDI can be done fullscreen i think, but getting fullscreen at 768p brings up lots of complications with the demo i'm making :/
and another question to save starting another thread,
if i create a timer using SetTimer to tick every 1000ms or whatever,
will the tick time be the same on all (or 99.9%) of computers?
(since one of my computers seems to be running too fast with a timer-operated animation)
I have never seen a system where the timer frequencies were off by any noticeable amount. I think there could be conditions where the timers might be slowed, for example a single-core system where the core is being monopolized by a very high-priority process, but I can't think of any conditions where the timers would speed up.
you may also have a condition where the machine in question cannot keep up with the code :P
Try this code, it worked on my XP, Visa and 7
Change_Screen_Resolution proc w:dword, h:dword, bitsPerPixel:dword
invoke RtlZeroMemory, addr _dmScreenSettings, sizeof DEVMODE
mov _dmScreenSettings.dmSize, sizeof DEVMODE
mov _dmScreenSettings.dmPelsWidth, CMEM(w)
mov _dmScreenSettings.dmPelsHeight, CMEM(h)
mov _dmScreenSettings.dmBitsPerPel, CMEM(bitsPerPixel)
mov _dmScreenSettings.dmFields, DM_BITSPERPEL or DM_PELSWIDTH or DM_PELSHEIGHT or DM_DISPLAYFREQUENCY
mov _dmScreenSettings.dmDisplayFrequency, 60
invoke ChangeDisplaySettings, addr _dmScreenSettings, 000000004h
.if eax != DISP_CHANGE_SUCCESSFUL
xor eax, eax
.else
mov eax, TRUE
.endif
ret
Change_Screen_Resolution endp
@ kroz I think we covered this in the old masm forum here http://www.masmforum.com/board/index.php?topic=17221.0
with this attachments you can go to either full desk top or window F1 to toggle in between them
I think this is what you are asking for :t
thanks all :)
problem fixed.
not that i understood that code ... :P
Oh yes , How can I set the window to be a fixed size (not user-changeable) when in windowed mode ?
i.e - if you choose NO for fullscreen then you cannot resize window.
(BlankWindow5) :)
For CreateWindowEx:
style=WS_OVERLAPPED or WS_CAPTION or WS_SYSMENU or WS_MINIMIZEBOX or WS_CLIPCHILDREN or WS_VISIBLE
i think WS_OVERLAPPEDWINDOW includes the WS_THICKFRAME bit
WS_THICKFRAME means the window has a sizing border around it
but - if you want to keep the border - and still disable sizing...
you can respond to the WM_GETMINMAXINFO messages in the main window WndProc
.elseif eax==WM_GETMINMAXINFO
mov edx,lParam
mov [edx].MINMAXINFO.ptMinTrackSize.x,MainWidth
mov [edx].MINMAXINFO.ptMinTrackSize.y,MainHeight
mov [edx].MINMAXINFO.ptMaxTrackSize.x,MainWidth
mov [edx].MINMAXINFO.ptMaxTrackSize.y,MainHeight
xor eax,eax
ret
i normally only use the "Min" sizes to set minimum window dimensions
but, if you set the "Min"s = "Max"s, the window is stuck at that size
EDIT: changed WS_BORDER to WS_THICKFRAME per Jochen :P
Quote from: dedndave on August 08, 2012, 09:10:29 PM
WS_BORDER means the window has a sizing border around it
That's WS_THICKFRAME, Dave
oops - right you are :biggrin:
and i think it's one of the WS_OVERLAPPEDWINDOW bits
WS_OVERLAPPEDWINDOW = 00CF0000h
WS_THICKFRAME = 00040000h
Quote from: dedndave on August 08, 2012, 10:25:01 PM
and i think it's one of the WS_OVERLAPPEDWINDOW bits
Yes it is but note I use WS_OVERLAPPED, not WS_OVERLAPPEDWINDOW ;)
:t
Quote from: kroz on August 08, 2012, 08:17:12 PM
Oh yes , How can I set the window to be a fixed size (not user-changeable) when in windowed mode ?
i.e - if you choose NO for fullscreen then you cannot resize window.
(BlankWindow5) :)
That is simple! Comment out lines 176, 177, and 179 in BlankWindow5 :t
P.S
I open the assembly file with NOTEPAD2 so much nicer
You can see line #'s
http://www.flos-freeware.ch/notepad2.html
By the way Kroz I love intro demos... I assume that is what you are
Making ... Is this something you can share for us to see? :icon_cool: