Back to home page

DOS ain't dead

Forum index page

Log in | Register

Back to the forum
Board view  Mix view

The Doszip Commander version 2.50 available (Announce)

posted by nidud E-mail, Norway, 01.10.2013, 11:21

>
> To find out the current screen dimensions, you have to call
> GetConsoleScreenBufferInfo(). Actually, this should be done in both
> full-screen text mode and windowed GUI mode.

Yes, that is what I'm currently using to get the metrics of the screen:

consinit proc
local ci:CONSOLE_SCREEN_BUFFER_INFO
        invoke  GetConsoleScreenBufferInfo,hStdOutput,addr ci
        test    eax,eax
        jz      toend
        mov     eax,ci.dwSize
        movzx   ecx,ax
        mov     _scrcol,ecx
        shr     eax,16
        dec     eax
        mov     _scrrow,eax
        invoke  cursorget,addr console_cu
        invoke  free,console_dl.dl_wp
        mov     eax,_scrrow     ; save init screen
        mov     ah,byte ptr _scrcol
        inc     al
        invoke  rcpush,eax
        mov     console_dl.dl_wp,eax
        mov     console_dl.dl_flag,_D_DOPEN
        mov     eax,_scrrow
        inc     eax
        mov     console_dl.dl_rect.rc_row,al
        mov     eax,_scrcol
        mov     console_dl.dl_rect.rc_col,al
  toend:
        ret
consinit endp


However, setting the screen metrics is a different matter (I think), and it seems to involve some graphical functions of getting/setting the client window using pixels as measure. I assume you then have to calculate the size of the desktop by measure the font size currently used.

The current approach for doing this is rather simplistic:

.data
mode db 'MODE CON LINES=%d',0

.code

conssetl proc l:dword   ; line: 0..max
local cmd[64]:byte
local ci:CONSOLE_SCREEN_BUFFER_INFO
        mov edx,l
        .if edx != _scrrow
            inc edx
            invoke sprintf,addr cmd,addr mode,edx
            invoke command,addr cmd
            .if GetConsoleScreenBufferInfo(hStdOutput,addr ci)
                mov eax,ci.dwSize
                shr eax,16
                dec eax
                mov _scrrow,eax
            .endif
        .endif
        ret
conssetl endp


This only assume vertical changes where the width is static (80), so I need to add the a line with COLS=%d to get back to the "good old" 80x25 mode.

I extended the buffering for the functions that handle text in/out-put from 80 to 256. But this is the limit on "graphics" used since the definition of a RECT is BYTE sized. By doing so the program is able to adapt to larger screen metrics, but the panels and text viewer is still (v3.03) using 80. However, the editor is able to adapt to a larger line width.

Now I have changed the width of the panels and text viewer as well, so the program is now capable of adapting but still not able to set and move the client window. The current solution to this is to do this manually by having a short-cut (.LNK) to DZ on the desktop. You may then set the metric there to fill the whole desktop, and remove the "Startup: [x] Restore Screen Mode" in the system option dialog. DZ will then adapt to this metrics, and also adapt to the metrics if executed from FM, but flipping from a window to text mode (Alt-Enter) will be a problem.

A single (large) panel:
[image]

 

Complete thread:

Back to the forum
Board view  Mix view
22632 Postings in 2109 Threads, 402 registered users, 402 users online (0 registered, 402 guests)
DOS ain't dead | Admin contact
RSS Feed
powered by my little forum