flat assembler
Message board for the users of flat assembler.

Index > Windows > Titleless Tool Windows

Author
Thread Post new topic Reply to topic
bitRAKE



Joined: 21 Jul 2003
Posts: 4043
Location: vpcmpistri
bitRAKE 30 Mar 2023, 18:52
The simple fact is that I don't like window decorations. MS has sought a look for Windows [as part of their branding] that isn't universally conducive to the effectiveness of the user, imho. Once I'm comfortable with an application I want the decoration to not imped my focus.

This examples is a simple step in that direction by using the tool menu to host icons for window control. The first problem is how to move the tool window. By holding a shift-key the menu can be grabbed to move the window. This is not as much a problem as it might seem - tool windows are put where they need to be and live there.

The icons are built into the system and just need to be added to the menu:
Code:
Main.mII MENUITEMINFO \
        cbSize:         sizeof MENUITEMINFO,\
        fMask:          MIIM_FTYPE or MIIM_BITMAP or MIIM_ID,\
        fType:          0,\
        fState:         MFS_ENABLED,\
        wID:            IDM_SYS_SYSTEM,\
        hbmpItem:       HBMMENU_SYSTEM

LoadMenuIndirectW ADDR .MenuTemplate
mov [g_hMenu], rax
InsertMenuItemW [g_hMenu], 0, TRUE, ADDR .mII
mov [.mII.fType], MFT_RIGHTJUSTIFY
iterate <BITMAP,                COMMAND>,\
        HBMMENU_MBAR_RESTORE,   IDM_SYS_RESTORE,\
        HBMMENU_MBAR_MINIMIZE,  IDM_SYS_MINIMIZE,\
        HBMMENU_MBAR_CLOSE,     IDM_SYS_CLOSE
        mov [.mII.hbmpItem], BITMAP
        mov [.mII.wID], COMMAND
        InsertMenuItemW [g_hMenu], -1, TRUE, ADDR .mII
end iterate


; HBITMAP
HBMMENU_SYSTEM:=1
HBMMENU_MBAR_RESTORE:=2
HBMMENU_MBAR_MINIMIZE:=3
; HBMMENU_MBAR_?:=4
HBMMENU_MBAR_CLOSE:=5
HBMMENU_MBAR_CLOSE_D:=6
HBMMENU_MBAR_MINIMIZE_D:=7
HBMMENU_POPUP_CLOSE:=8
HBMMENU_POPUP_RESTORE:=9
HBMMENU_POPUP_MAXIMIZE:=10
HBMMENU_POPUP_MINIMIZE:=11
HBMMENU_CALLBACK:=-1    
By using command ids that match the SYSMENU commands there is almost no code to support the functionality:
Code:
IDM_SYS_SYSTEM          := 0xF090 ; SC_MOUSEMENU | SC_KEYMENU
IDM_SYS_RESTORE         := 0xF120 ; SC_RESTORE
IDM_SYS_MINIMIZE        := 0xF020 ; SC_MINIMIZE
IDM_SYS_CLOSE           := 0xF060 ; SC_CLOSE

.WM_COMMAND:
        cmp r8w, IDM_FILE_QUIT
        jz .WM_DESTROY
        cmp r8w, 0xF000
        jc .default
        SendMessageW rcx, WM_SYSCOMMAND, r8, r9 ; mimic standard WS_SYSMENU use
        jmp .processed    
The code is on github.
(With supporting includes needed.)


Description:
Filesize: 3.43 KB
Viewed: 1551 Time(s)

titleless popup.png


Description: build to play with
Download
Filename: titleless.zip
Filesize: 4.96 KB
Downloaded: 202 Time(s)


_________________
¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup
Post 30 Mar 2023, 18:52
View user's profile Send private message Visit poster's website Reply with quote
ProMiNick



Joined: 24 Mar 2012
Posts: 799
Location: Russian Federation, Sochi
ProMiNick 04 Apr 2023, 19:46
same one but with working restore/maximize. but without win98like pictures for RESTORE,MINIMIZE & CLOSE.
And because variant for win11 already exist. my one is for win32 subsys with user32.dll (win98-win10,wine,reactos - they all fit requirement).


Description:
Download
Filename: NOTITLE.zip
Filesize: 3.5 KB
Downloaded: 194 Time(s)


_________________
I don`t like to refer by "you" to one person.
My soul requires acronim "thou" instead.
Post 04 Apr 2023, 19:46
View user's profile Send private message Send e-mail Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.