News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

what's wrong create window+ change screen resolution looks wrong

Started by daydreamer, June 26, 2020, 08:07:04 PM

Previous topic - Next topic

daydreamer

Hi
First I have windows program create window based on constants
SCREENHEIGHT, SCREENWIDTH Which later reuse in winapi's version of change screen resolution instead of earlier I only have used directx set screen resolution
Using 800x600 the window is few pixels smaller on left side and right side of window is seen the other windows in the background?
now when I made screenshot I see the image of window is only 786 wide???
Am I using wrong create windows settings?
this is testrun on win10
hWnd = CreateWindowW(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW,
   0,0,SCREENWIDTH,SCREENHEIGHT, nullptr, nullptr, hInstance, nullptr);


ase WM_CREATE:

DEVMODEA dm;
//EnumDisplaySettingsA()
memset(&dm, 0, sizeof(dm));
dm.dmSize = sizeof(dm);
dm.dmBitsPerPel = 32; dm.dmPelsWidth = SCREENWIDTH; dm.dmPelsHeight =SCREENHEIGHT;
dm.dmDisplayFrequency = 60;
dm.dmFields =
DM_PELSWIDTH |
DM_PELSHEIGHT |
DM_BITSPERPEL |
DM_DISPLAYFREQUENCY;
if (fullscr==1){/////// (FULLSCREEN == 1) {
ChangeDisplaySettingsA(
&dm,
CDS_FULLSCREEN
);
}

my none asm creations
https://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding

fearless

The style of the window or dialog will effect the sizing due to bordering - even if border or dialog frame border isnt visible/shown it still effects the sizing of the window panel from what I remember

Caché GB

Hi daydreamer

By hitchhikr from somewhere in here
http://www.masmforum.com/board/index.php?board=41.0

\OpenGLFramework_Asm.zip\Cube

Try it out.


.data?

      dmScreenSettings         DEVMODE <>
      g_ScreenFrequency        dd  ?

.code

;############################################################################################################

; Name: Change_Screen_Resolution
; Desc: Resize the screen with given dimensions and depth

ChangeScreenResolution proc w:dword, h:dword, bitsPerPixel:dword

         invoke  RtlZeroMemory, addr dmScreenSettings, sizeof(DEVMODE)
            mov  dmScreenSettings.dmSize, sizeof DEVMODE
            m2m  dmScreenSettings.dmPelsWidth, w
            m2m  dmScreenSettings.dmPelsHeight, h
            m2m  dmScreenSettings.dmBitsPerPel, bitsPerPixel

            mov  eax, (DM_BITSPERPEL or DM_PELSWIDTH or DM_PELSHEIGHT)  ;; (040000h or 080000h or 0100000h)

            mov  dmScreenSettings.dmFields, DM_BITSPERPEL or DM_PELSWIDTH or DM_PELSHEIGHT or DM_DISPLAYFREQUENCY
            mov  dmScreenSettings.dmDisplayFrequency, 60
         invoke  ChangeDisplaySettings, addr dmScreenSettings, CDS_FULLSCREEN
        .if(eax != DISP_CHANGE_SUCCESSFUL)
            xor  eax, eax
        .else
            mov  eax, true
        .endif
            ret

ChangeScreenResolution endp

;############################################################################################################

; -----------------------------------------------------------------------
; Name: Get_Current_Frequency
; Desc: Retrieve the monitor frequency set by the user

GetCurrentFrequency proc

         invoke  EnumDisplaySettings, null, ENUM_CURRENT_SETTINGS, addr dmScreenSettings
            mov  eax, dmScreenSettings.dmDisplayFrequency
            mov  g_ScreenFrequency, eax
            ret

GetCurrentFrequency endp

;############################################################################################################


The video adaptor must support the resolution you set
Caché GB's 1 and 0-nly language:MASM

daydreamer

Quote from: Caché GB on June 26, 2020, 09:23:34 PM
Hi daydreamer

By hitchhikr from somewhere in here
http://www.masmforum.com/board/index.php?board=41.0

\OpenGLFramework_Asm.zip\Cube

Try it out.


.data?

      dmScreenSettings         DEVMODE <>
      g_ScreenFrequency        dd  ?

.code

;############################################################################################################

; Name: Change_Screen_Resolution
; Desc: Resize the screen with given dimensions and depth

ChangeScreenResolution proc w:dword, h:dword, bitsPerPixel:dword

         invoke  RtlZeroMemory, addr dmScreenSettings, sizeof(DEVMODE)
            mov  dmScreenSettings.dmSize, sizeof DEVMODE
            m2m  dmScreenSettings.dmPelsWidth, w
            m2m  dmScreenSettings.dmPelsHeight, h
            m2m  dmScreenSettings.dmBitsPerPel, bitsPerPixel

            mov  eax, (DM_BITSPERPEL or DM_PELSWIDTH or DM_PELSHEIGHT)  ;; (040000h or 080000h or 0100000h)

            mov  dmScreenSettings.dmFields, DM_BITSPERPEL or DM_PELSWIDTH or DM_PELSHEIGHT or DM_DISPLAYFREQUENCY
            mov  dmScreenSettings.dmDisplayFrequency, 60
         invoke  ChangeDisplaySettings, addr dmScreenSettings, CDS_FULLSCREEN
        .if(eax != DISP_CHANGE_SUCCESSFUL)
            xor  eax, eax
        .else
            mov  eax, true
        .endif
            ret

ChangeScreenResolution endp

;############################################################################################################

; -----------------------------------------------------------------------
; Name: Get_Current_Frequency
; Desc: Retrieve the monitor frequency set by the user

GetCurrentFrequency proc

         invoke  EnumDisplaySettings, null, ENUM_CURRENT_SETTINGS, addr dmScreenSettings
            mov  eax, dmScreenSettings.dmDisplayFrequency
            mov  g_ScreenFrequency, eax
            ret

GetCurrentFrequency endp

;############################################################################################################


The video adaptor must support the resolution you set
Thanks :thumbsup:

Maybe I should use other kind of window than popup?

SendMessage maximise right after change screen resolution?
my none asm creations
https://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding

daydreamer

asm program now have window with grey border that fills window sides,it works better change window to start at x y 0,0

my none asm creations
https://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding