News:

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

Buttons don't move with SW_MAXIMIZE

Started by hfheatherfox07, August 31, 2011, 10:14:36 PM

Previous topic - Next topic

dedndave

i just realized that the box is the client
this one is a little simpler

on the first one, i got the window rectangle and converted the coordinate to a client coordinate
this one - i just get the client rectangle

qWord

maybe not exactly what ask for, but looks nice  :bg
FPU in a trice: SmplMath
It's that simple!

hfheatherfox07

Thank you all so much for your help...
If anything , I noticed a few posts about how to create a custom title bar ( a window without one) ....
at least now we have a bare bones example that people can work of off... add title , icon , etc...

I have a great example using .PNG to skin buttons with libs for minimal code in the asm ... but it is not ready yet ... I still have to figure how to crop the buttons with  2 corners on one side.... so far I can only crop square LOL
Well when I finish the vista window skin I will post it .....

I found something for VB in the Aero ( which is the name for the vista theme), to bad we do not have something like that for MASM http://www.remnantmods.com/forums/viewtopic.php?f=5&t=1650

I am not sure how that works yet ...

thank you for all your help  :U

dedndave


hfheatherfox07

This worked fine until I added buttons with bitmap ...why?

I am trying to ultimately do this example with re-size   http://www.masm32.com/board/index.php?topic=18823.0


I will also add the example from masm11 of skin3 if that helps

dedndave

i swear we already did this once   :lol

go back and review Reply #'s 6-9

better hurry before the attachment vanishes - lol

hfheatherfox07

yes all works fine with buttons in the resource but not with painted buttons and I don't know why .... :(
I will look at hutches example and try to see if I can make it work

dedndave

the problem(s) seems to be related to the .IF/.ELSEIF/.ENDIF structure

if you are going to use them - good idea to indent to match them up
personally - i don't care for either - lol

but.....
    .elseif  uMsg == WM_COMMAND
        mov eax,wParam
        mov edx,eax
        shr edx,16
        and eax,0ffffh
        .if edx == BN_CLICKED
            .if  eax ==IDC_BTN1 ; Minimize Window Button   
                invoke ShowWindow,hWnd,SW_MINIMIZE
            .endif
        .endif
    .if edx == BN_CLICKED
        .if  eax ==IDC_BTN2 ; MaximizeBox/MinimizeBox Button 
            .if WindowSz==1
                mov WindowSz,0
                invoke ShowWindow,hWnd,SW_MAXIMIZE
                invoke ImageButton,hWnd,244,2,403,401,402,IDC_BTN2 ;custom image button (JPG,BMP,PNG) Left,Up,DownID,UpID,OverID
                mov hMinBox,eax
                ;invoke SetFocus,hMinBox

            .elseif WindowSz==0
                mov WindowSz,1

                invoke ShowWindow,hWnd,SW_SHOWNORMAL ; Restore Window to defult size (MinimizeBox)
                invoke ImageButton,hWnd,244,2,603,601,602,IDC_BTN2 ;custom image button (JPG,BMP,PNG) Left,Up,DownID,UpID,OverID
                mov hMax,eax
            .endif
        .endif
    .endif
.endif
.if edx == BN_CLICKED
    .if  eax ==IDC_BTN3   ; Exit Button
        invoke SendMessage,hWnd,WM_CLOSE,0,0
    .endif

things aren't matched up, here
i don't think you ever get to the WM_SIZE test   :P

EDIT - ok - it does get there once when you call it in WM_INITDIALOG - but that's it
and - you call it before the buttons have been created, so the handles are all 0
i added message boxes for a quick check....
invoke  GetDlgItem,ebx,IDC_BTN3
push eax
invoke MessageBox,0,uhex$(eax),0,0
pop  eax
sub     esi,edi
invoke  MoveWindow,eax,esi,0,edi,edi,TRUE
invoke  GetDlgItem,ebx,IDC_BTN2
push eax
invoke MessageBox,0,uhex$(eax),0,0
pop  eax
sub     esi,23
invoke  MoveWindow,eax,esi,0,edi,edi,TRUE
invoke  GetDlgItem,ebx,IDC_BTN1 
push eax
invoke MessageBox,0,uhex$(eax),0,0
pop  eax
sub     esi,23
invoke  MoveWindow,eax,esi,0,edi,edi,TRUE

you can see that it doesn't get called for WM_SIZE
(you have to "include \masm32\macros\macros.asm" in order to use "uhex$")

hfheatherfox07

Thank you ....I will try this out  :U

hfheatherfox07

Arg ...
the buttons wont work  :(
I tried adding a separate flag 4 different ways .....


; ¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤*¤
.data?
ButoonFlag  dd  ?

invoke ImageButton,hWnd,244,2,603,601,602,IDC_BTN2 ;MaximizeBox ;custom image button (JPG,BMP,PNG) Left,Up,DownID,UpID,OverID
mov hMax,eax
mov ButoonFlag,TRUE

.elseif uMsg==WS_MAXIMIZEBOX
.if ButoonFlag == TRUE
invoke ImageButton,hWnd,244,2,603,601,602,IDC_BTN2 ;MaximizeBox ;custom image button (JPG,BMP,PNG) Left,Up,DownID,UpID,OverID
mov hMax,eax
mov ButoonFlag,FALSE
.elseif ButoonFlag == FALSE
invoke ImageButton,hWnd,244,2,403,401,402,IDC_BTN2 ;custom image button (JPG,BMP,PNG) Left,Up,DownID,UpID,OverID
mov hMinBox,eax
mov ButoonFlag,TRUE
.endif




why wont this work? is it the size-window proc?


hfheatherfox07

here is 2 more that I tried

dedndave

1st - the box with one box over another is called "restore"   :P

2nd - after you create the maximize button, you have...
        mov hMax,1
oops !

i renamed some of the picture files
re-organized the resource files and ID's

i indented and fixed all the if/else/endif stuff

another problem - in certain cases, you created a new button using the same ID without destroying the old one
now - you have several buttons with the same ID

the way to fix that problem is to create all 4 buttons to begin with
then - hide the one you do not want to show
also - you can set all their initial positions to 0 - and let the size code take care of it   :U

i used the IsZoomed function to see if the window is maximized
it is cleaner than using the WindowSz flag

hfheatherfox07

That is really clever I did not  think to do it that way .....  :U I even tried adding the button flags in the size box proc

Thank you so much !

I will add the Areo glass skin add this example to the Aero Glass Vista Buttons With Frame and Shadow thread so we have a template to use

http://www.masm32.com/board/index.php?PHPSESSID=88ace34383c3f8d9f0b6179143247cf8&topic=18823.0

dedndave

well - there might be another option....

you could create only 3 buttons, then switch the images
i did not try sending a BM_SETIMAGE message to the button to swap images
it seems a bit messy, because each button has 3 images associated with it   :P