News:

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

Image button demo.

Started by hutch--, August 08, 2011, 01:40:36 AM

Previous topic - Next topic

hutch--

This is just a test piece using the masm32 library module "BmpButton" to test if it would handle RGB/Alpha bitmaps. The test piece requires a manifest file to display the images correctly but on my XP dev box it works fine. Note that with the 64 pixel button size the RGB/A images are 16k each so each button has 32k of image data. The Stopwatch button uses a different image from up to down to show why its useful to have 2 image buttons, even at the expense of a much larger resource section. If you use Jeremy Collake's PECompact it drops the file size from 203k to about 32k which is OK by todays Vista/Win7 standards.

This demo will work on Win2000 but the images do not have RGB/A support and will have black backgrounds.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

dedndave

i get nothing
it hangs, i guess, there is no system-menu close box
i am guessing that means it never gets past create

hutch--

Unusual, from memory you are running XP SP2 on a PIV, does the window show at all ? It should show 6 buttons stacked vertically.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

dedndave

prescot w/htt - 1 gb ram
XP MCE 2005 SP3

i know - i need to buy some ram   :P





the attachment is the above PNG image renamed to ZIP

dedndave

i changed WS_OVERLAPPED to WS_OVERLAPPEDWINDOW
now i can close it without the task manager

i commented out the BmpButton calls
everything seems to be ok with the WndProc and message loop

the BmpButton calls don't hang - they just don't make buttons

the ones in \masm32\examples work ok

FORTRANS

Hi,

   Works as described on my Win 2000 machine.  Large icons
that report numbers when clicked or exit.  Works(?) as Dave
describes on an XP machine, blank.

Regards,

Steve N.

hutch--

#6
OK, on my XP SP3 box it looks like this.



If you have the software to open them, try opening any of the paired bitmaps that make up the buttons. The images are all RGB/Alpha channel bitmaps and on this dev box I run the 32 bit colour depth for normal display.

this is what it looks like on Win7 64 bit with its cheesy Aero interface.

Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

hutch--

 have done a couple of minor changes to see what the problem may be on Daves box. I added a titlebar exit button and placed a messagebox after each button create function call to see if the button is actually being created rather than if it does or does not display correctly. It should show 6 message boxes with 6 handles before the main window shows.

It would be useful to know what screen colour depth is being used as these images are all RGB/Alpha and I don't have a machine set up with low resolution display. All of my boxes have half gig video cards that run 32 bit colour.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

dedndave

same thing, Hutch
i have made a test program with the BmpButton and ButtonProc functions internal
let me see what the return values are.....

hutch--

Dave,

The handles displayed in the 6 message boxes will tell you if the control was created or not.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

jj2007

Hutch,

XP SP2: Blank box, BmpButton errors with INVALID_WINDOW_HANDLE.

dedndave

ok - you'll be happy to know that there is no problem with the BmpButton function   :bg

here is the mod i made to the main program...
start:
        push    ICC_WIN95_CLASSES
        push    sizeof INITCOMMONCONTROLSEX
        INVOKE  InitCommonControlsEx,esp
        pop     ecx
        pop     edx


it works as requested, now   :U

dedndave

what we need is a little routine to make the second image from the first...
        INVOKE  MakeBtnPair,nIdBitmap,nIdNew,nXoffset,nYoffset
        INVOKE  BmpButton,hWnd,50,50,edx,eax,900

that would cut the size in half   :U

dedndave

by the way, InitCommonControls works also
it does not have to be InitCommonControlsEx

hutch--

Thanks,

So it is an InitCommonControls() problem, I have seen this before and Erol helped out with his Turkish version. Strange that it does not occur on my US English XP SP3 or US version of Win7 64.

I don't get the idea of copying the up image to the down image, all of the ones used shifted 1 pixel down and across.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php