News:

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

Main Menu

is there a way to subclass or mod dialog box?

Started by daydreamer, May 15, 2020, 10:49:34 PM

Previous topic - Next topic

daydreamer

I have so far tried message box with yesno option
And seen there is dialog boxes with 3 buttons
So is it subclass one dialog box, to Get 4-5 custom buttons
I seen you can get exclamation mark,also possible to choose any icon?
I have console mode code that input 4-5 differ options from text menu,by key presses
Or maybe option to show/hide usual buttons when needed?

Message pump,is it possible to subclass it or something else, to have basic simple one in the main asm file and in different usage of window in. Inc files?
For example a paint program, has several different windows,acting very different, so my guess they have each their own "event handler", otherwise a single big wndproc will turn out messy switches and IF s nested

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

hutch--

Magnus,

A MessageBox() is generally not accessible for subclassing, I have long ago seen hack that seemed to work but they are ugly and unreliable. You will do much better with a dialog editor where you can more or less do anything you like. They are easy enough to code in both 32 and 64 bit so its no big deal.

daydreamer

Quote from: hutch-- on May 15, 2020, 11:01:37 PM
Magnus,

A MessageBox() is generally not accessible for subclassing, I have long ago seen hack that seemed to work but they are ugly and unreliable. You will do much better with a dialog editor where you can more or less do anything you like. They are easy enough to code in both 32 and 64 bit so its no big deal.
Thanks
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

Vortex

Hi daydreamer,

You can subclass a message box but Hutch is right, it's better to prefer a dialog box. Attached is a quick example.

daydreamer

Quote from: Vortex on May 15, 2020, 11:29:13 PM
Hi daydreamer,

You can subclass a message box but Hutch is right, it's better to prefer a dialog box. Attached is a quick example.
thanks
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

Vortex

Hi daydreamer,

Thanks. Again, defining a dialog box is more precise and practical. My example is just a coding exercise.

Custom message box with Windows hooks :

http://www.catch22.net/tuts/win32/custom-messagebox#

daydreamer

Quote from: Vortex on May 16, 2020, 06:13:27 PM
Hi daydreamer,

Thanks. Again, defining a dialog box is more precise and practical. My example is just a coding exercise.

Custom message box with Windows hooks :

http://www.catch22.net/tuts/win32/custom-messagebox#
thanks for the link :thumbsup:
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

apparantly you can do all kinds of things with popup window,tiny image instead of ok,multiple lines of text,something that looks like richedit control with scroll bar for lots of text
popup window with text mixed with several images
(inspiration from HMM III game)
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

Biterider

Hi daydreamer
Maybe this post is what you're looking for, or at least it comes close.
http://masm32.com/board/index.php?topic=8560.0

Biterider

daydreamer

dont know why button gets blank
first try at generate random items and gold in a chest,probably can do better ways todo it
sometimes funny mix of random items/materials

align 16
tchest  db "                                ",13,10
tchest2 db "random item2                    ",13,10
tchest3 db "random item3                    ",13,10
tchest4 db "random item4                    ",13,10
tmoney  db "0000 gold ",13,10
        db 0,0,0,0

quest1  db "Collect 00x Game pieces",13,10
        db "dropped in dungeon by M"
qsolved1  db 0,0 ;0,0 replaced with 13,10 when quest is solved
        db "solved quest ",13,10
        db "reward",13,10
        db "200 gold",13,10
        db "gold key",13,10
        db 0,0
;--------------------------------------------------------------------------------------------
;Messagebox captions
;--------------------------------------------------------------------------------------------
szDisplayquest db "Quest",0
szDisplaychest db "treasure chest",0
szDisplayhammer db "Hammer",0
szDisplayinvent db "Inventory",0
;--------------------------------------------------------------------------------------------
;random items
;--------------------------------------------------------------------------------------------
align 16
randitem db "cloak   "   ;0 random items list
            db "boots   "
            db "armour  "
            db "helmet  "
            db "shield  "
            db "sword   "     
            db "necklace"
            db "flute   "
            db "potion  "
            db "spirits "
            db "beer    "
            db "wine    "
            db "water   "
            db "ring    "
            db "bracelet"
            db "dress   "
            db "bones   "   

randmat     db "platinum" ;0 random material list
            db "leather "
            db "bronze  "
            db "iron    "
            db "steel   "
            db "silk    "
            db "magic   "
            db "gold    "
            db "tin     "
            db "flashy  "
            db "sparkly "
            db "wood    "
            db "wool    "
            db "mighty  "
            db "volfram "
            db "Diamond "
            db "ordinary"
            db 256 dup(32)

.code
tchestp proc
LOCAL cnt:DWORD
LOCAL tmpchest:DWORD
LOCAL tmpgold:DWORD
mov cnt,4
lea eax,tchest
mov tmpchest,eax
rdtsc
    invoke nseed, eax                   
   
    invoke nrandom,999999999   

    lea ebx,tmoney
;mov [ebx],eax
and eax,0F0F0F0Fh ;mask out to get lower nibbles
add eax,"0000" ;ascii gold
mov ecx,eax
and ecx,07070707h;balance numbers
add ecx,"0000"
;add ecx,01010101h
rol ecx,16
.IF al>"9"
sub al,6
;mov al,"9"
.ENDIF
.IF ah>"9"
sub ah,6
.ENDIF
rol ecx,16
rol eax,16
.IF al>"9"
sub al,6
.ENDIF
.IF ah>"9"
sub ah,6
.ENDIF
lea esi,tmoney
mov [esi],eax
@@L1:

invoke nrandom,999999999   
and eax,0F0F0F0Fh ;nibbles
;.IF al>7 ;conditionals if less than 16 items/materials
;mov al,8
;.ENDIF
;.IF ah>7
;mov ah,8
;.ENDIF
mov ebx,0
mov edx,0
mov bl,al
mov dl,ah
.IF cnt==3
lea edi,tchest3
.ENDIF
.IF cnt==2
lea edi,tchest2
.ENDIF
.IF cnt==1
lea edi,tchest
.ENDIF
.IF cnt==4
lea edi,tchest4
.ENDIF
                        ;lea edi,tchest ;tmpchest                ;tchest
lea eax,[randmat+ebx*8]
movq XMM0,[eax] ;random material for item
movq [edi],XMM0
add edi,8
lea eax,[randitem+edx*8]
movq XMM1,[eax]

movq [edi],XMM1




dec cnt
jne @@L1
invoke MessageBox,hWnd,
                                ADDR tchest,                                     
                                ADDR szDisplaychest,MB_OK
lea ebx,tmoney
mov eax,[ebx]
sub eax,"0000"
bswap eax   ;swap lowest digits with highest digits
mov esi,eax
and eax,0f0fh ;lowest digit(s)
aad ;ah*10+al
mov ebx,goldc
add ebx,eax ;add digit 1 and 2
mov eax,esi
rol eax,16
and eax,0f0fh
aad ;ah*10+al
mov edi,100
xor edx,edx
mul edi
add ebx,eax ;add digit 3 and 4
mov goldc,ebx
mov eax,numberit
add eax,4
mov numberit,eax

ret
tchestp endp
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