News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

creating a window with F1 toggle for full screen

Started by hfheatherfox07, August 11, 2011, 08:38:52 PM

Previous topic - Next topic

hfheatherfox07

Hi,
I am trying to create 2 things;

1. creating a window with F1 toggle for full screen
2. creating a window with F1 toggle for full screen  and a message box at the beginning asking the user  "Would you like to run in fullscreen mode ?" Yes or No

here are the 2 windows that I am trying to make into this:

Blank Window.zip and Blank Executer Window.zip

Project.zip is my bad attempt ....

I used lesson01.zip from NeHe Productions  Creating an OpenGL Window (Win32)_files and

Direct draw that was posted here by Siekmanski -> http://www.masm32.com/board/index.php?PHPSESSID=43d48ba8df22eda20b351e7f68364200&action=dlattach;topic=16710.0;id=9354

I am not trying to do a OpenGL or a direct draw....

any help?  :(


baltoro

Here's an article written for C++ MFC programmers from MSDN: Full Screen Display and Implementing. You won't use the code, obviously, but the concept is fairly simple.
Baltoro

hfheatherfox07

Quote from: baltoro on August 11, 2011, 09:21:49 PM
Here's an article written for C++ MFC programmers from MSDN: Full Screen Display and Implementing. You won't use the code, obviously, but the concept is fairly simple.

Sorry no help to me ...I have 2 MASM examples DD and openGL and I have problems

baltoro

Yeah,...I read those four examples in your first post.
You're overthinking it,...it's actually quite simple,...
You don't need DirectX or OpenGL to display a graphic in full screen  mode.
That first blank window example just needs a few changes,...
Here is a MASM forum thread about: Processing Keyboard Input
Baltoro

hfheatherfox07

Quote from: baltoro on August 12, 2011, 12:43:19 AM
Yeah,...I read those four examples in your first post.
You're overthinking it,...it's actually quite simple,...
You don't need DirectX or OpenGL to display a graphic in full screen  mode.
That first blank window example just needs a few changes,...
Here is a MASM forum thread about: Processing Keyboard Input

any idea were I am going wrong? i tried about a dozen times

that is what I am trying to do... no  DirectX or OpenGL

baltoro

The only difficult part is handling the keyboard input. Here is the MSDN reference: Keyboard Input.
Essentially, you want to add a message handler to your Window Procedure. You've got it all already in place (with a few inconsequentials errors).
This is the way you've got it declared:
WndProc  PROC   uses edx ecx ebx esi edi  hWnd :HWND,uMsg :DWORD,wParam :DWORD,lParam :DWORD

Somewhere in that procedure you want to add a block of code that handles the: WM_KEYDOWN Message.   
There are other ways to do it,...but, that's the simplest.
The alternative is to call either, GetAsyncKeyState Function, or, GetKeyboardState Function, but, that requires a little more work.

You should probably read this for an overview: About Keyboard Input
Baltoro

hfheatherfox07

Quote from: baltoro on August 12, 2011, 01:20:41 AM
The only difficult part is handling the keyboard input. Here is the MSDN reference: Keyboard Input.
Essentially, you want to add a message handler to your Window Procedure. You've got it all already in place (with a few inconsequentials errors).
This is the way you've got it declared:
WndProc  PROC   uses edx ecx ebx esi edi  hWnd :HWND,uMsg :DWORD,wParam :DWORD,lParam :DWORD

Somewhere in that procedure you want to add a block of code that handles the: WM_KEYDOWN Message.   
There are other ways to do it,...but, that's the simplest.


that was just one of my trials that I uploaded like i said I tried a bout a dozen time... I have one with the WM_KEYDOWN ...I have no problems with that...I can not get the screen to become full ... I can get it to switch back and forth ... but I can not get it to show.....

All I want is to add a simple text saying  something like  "Press F1 to toggle to full screen and back".... and I want it to work ....

you keep focusing on key input -no problems there... problems showing the screen

baltoro

This is from that first article that i recommended:   
"There's nothing in MFC that does full-screen display explicitly; however, it's not hard to implement. The basic idea is to adjust the size and position of your main window so it's bigger than the screen by the exact amount to make the active view exactly fill the display. This will always require an origin (top-left corner) with negative x,y coordinates."

He shows a simple handler for switching from Maximized to Full Screen mode (I assume you don't understand C++ code). this he does by calling this sequence of Windows API functions:
GetWindowRect
GetSystemMetrics
SetWindowPos

I'm sitting at a public terminal, so I don't have access to MASM, here,...and, I can't provide you with a code example that I've tested to make sure it works. But, the general idea is to call (ijn MASM, invoke) GetWindowRect for the maximized rectangle (or, whatever size you want to toggle back to), and save these coordinates in a global RECT structure. Then you would call GetSystemMetrics to determine the width of the window frame, horizontally, and the height of the title bar and menu bar, vertically (if you have one). These values are then used to initialize another RECT structure that will hold the size of the larger window coordinates. Your origin coordinates will be negative values. Then invoke SetWindowPos for the fuul screen mode.

To show text to instruct the user how to toggle the screen, use: TextOut Function
Baltoro

dedndave

this seems to work fine under XP
i would be interested to see if it works as well under win7   :P
if so, it would give the forum members a way to go into a "pseudo-full-screen" mode where it is supposedly not available
you could also reply to WM_SETCURSOR or use SetWindowLong to hide it

NOTE:
the F1 key toggles full-screen mode
the window must have focus to get to full screen, of course

ToutEnMasm


What you have to do to go full screen is to hide the tray (task bar).Search this word in the forum and you will find the group of functions with the one who hide it.
When it is done,give the correct size to your window.


dedndave

this one covers the taskbar under XP
i used SetWindowPos to make it "topmost"
that may not fly under win 7, though

did you try it Yves ?
do you have XP ?

ToutEnMasm


dedndave

thanks Yves   :U

what version of windows do you use ?

ToutEnMasm

I have XP SP3
I try to build  sample  with ITaskbarList3.

zekyr

I'm on windows 7 and it works fine! :) I'm so glad that this forum exists!

If it weren't for this forum I wouldn't know that you could do this:

WinMain   PROC hInst :DWORD,hPrevInst :DWORD,CmdLine :DWORD,CmdShow :DWORD


does that really give you the commandline? i saw the xor edi, edi but im really curious now :)

    xor     edi,edi           
    invoke  GetModuleHandle,edi
    mov     hInstance, eax
    invoke  WinMain,hInstance,edi,edi,SW_SHOWDEFAULT