News:

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

New version of MACROS.ASM dated 6th January 2005

Started by hutch--, January 06, 2005, 04:32:18 AM

Previous topic - Next topic

hutch--

Sorry about the fast turnover of the file but I forgot to put in a macro system for flat text based toolbars. I have attached the updated macros.asm file along with a small demo on the text style toolbar in a dialog. I have yet to do the documentation for the new macros but they are simple enough to use.

1. The "rv" macro. Another invoke enhancement that takes quoted text and return a value with function style notation.

          cmp rv(MessageBox,hWnd,"Leaving ?","Confirmation",MB_YESNO), IDYES
          je @F
          return 0
        @@:

The interesting part with this macro as with the FUNC macro is it can be used like a register as it in fact always returns the result in the EAX register as normal. This allows a very efficient notation so you can do things like,

    test rv(yourfunc,arg,var), eax
    jz @F

You can of course do the normal assignments like a higher level language.

    mov variable, rv(yourfunc,arg,var)


The new version contains the new "switch$" macro designed by Michael Webster which makes sequential string comparisons fast to code while producing good quality assembler code below it.


The example with the macros.asm file show how to use the text toolbar which is set up either for minimalist interfaces or as a component of a more complex interface.

LATER : The attached file has had the example fixed.   :red

[attachment deleted by admin]
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

Jimg

Anyone else having problems getting the demo to work in XP?  Runs ok, just no toolbar.

hutch--

Jim,

Did it run as it came from the ZIP file or did you build it after ? I have it tested on win2k sp4 and it works fine.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

Jimg

Both.  First I tried the included exe, then I tried assembling it myself to see if I could find the problem.  Like I say, it runs just fine, there just isn't any toolbar on the dialog.  I'm sure I'm missing something here.

John

It doesn't work for me either on XP... wish I could help you figure out why.

I'm using windows classic style if that helps.

Jimg

QuoteI'm using windows classic style if that helps.
I am also, perhaps this is a clue.

Also Hutch-
Was there some reason txtseperator was spelled this way?  I thought there might have been a conflict but I couldn't find any instances of txtseparator.  Just curious.

hutch--

There is the possibility that Microsoft changed something in the common control library. I will have to check a few names but their should not be any conflicts that I know about.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

Vortex

Hi Hutch,

Thanks for the latest release of macros.asm. I faced the same problem, the dialog box appears with no toolbar.

O.S: Win Xp HE Sp2

jimh

I run XP pro and the sample didn't work for me, either with the provided .exe or with me compiling my own copy.

But it works fine when I added to the top of the main proc:


invoke InitCommonControls

-- OR --

LOCAL icc:INITCOMMONCONTROLSEX

mov icc.dwSize, sizeof INITCOMMONCONTROLSEX
mov icc.dwICC, ICC_BAR_CLASSES
invoke InitCommonControlsEx, ADDR icc


Either way, it works fine and thanks for the new set of macros. I'm still working through them to get their structure stuck in my head.

Vortex

Hi jimh,

Yes, that works fine :U Initializing common controls is the key to solve the problem.

Relvinian

I was just going to report that about the InitCommonControls.  ;-)

How I found that out was walking the code in a debugger and noticing the CreateWindowEx call failed when trying to create the toolbar. The error code was 0x57f (which was a 'unknown class type').  Then when I saw that I remembered that you must initialize the common control interface first before trying to create toolbars and other certain controls.

NOTE:
The InitCommonControls has been superceeded by InitCommonControlsEX (according to current MSDN information). And in that same thing there is this for XP users:
   Windows XP: If a manifest is used, InitCommonControlsEx is not required.

But how many of us are programming with the Manifest yet?

Relvinian

hutch--

#11
 :U

Thanks a lot guys for tracking that one down, it means the macro works OK but my example had a mistake in it which is fine, I can just fiz the example.

LATER : I reposted the zip file with the demo fixed so it included the correct common control values.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

Ghirai

@hutch, works fine on XP Pro SP2.

@Relvinian, i use manifests in pretty much every app that has a GUI.
MASM32 Project/RadASM mirror - http://ghirai.com/hutch/mmi.html

Kestrel

Recommend:

; RGB MACRO

;================================================
RGB_BIT_REC RECORD red:8, green:8, blue:8

RGB    MACRO   red, green, blue
    color = RGB_BIT_REC<blue, green, red>
    EXITM <color>
ENDM

LDRGB     MACRO   red, green, blue
    mov eax, RGB_BIT_REC<blue,green,red>
ENDM

    .code
;================================================
        align 8
Test122   proc

    mov eax, RGB(44h,55h,66h)
    LDRGB   44h, 55h, 66h
    ret

Test122   endp
;================================================