News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

MasmBasic

Started by jj2007, May 23, 2012, 10:16:07 PM

Previous topic - Next topic

jj2007

Version 2 October is online :biggrin:

It's over 500 macros now. Here are the additions since November 2020:
SetLaunchEnvironment
Ini$
Cls
_Passed$
Arctangens
rTangens
Tangens
rCotangens
Cotangens
ArcSinus
rArcSinus
Cosinus
rCosinus
Tangent
FontExist
WinByClass
WinFromID
WinFromID$
MbProfile
WarmUp
CyCtInit
CyCtStart
CyCtEnd
SetWatch
swShow
swEnd
StackWalk
SWalkP
SWalkE
@FP4
@FP8
@FP10
GuiImageSet


With a handful of exceptions, they are documented in \Masm32\MasmBasic\MbGuide.rtf; search e.g. for .MbWinByClass

The most recent addition are coloured pushbuttons:
GuiParas equ "Colourful buttons", w320, h110 ; 32% of window width, 11% of height
; GuiButtonPen equ <MakePen MbBtnPen, RgbCol(128, 255, 255, 255), width 3> ; white, half transparent
include \masm32\MasmBasic\Res\MbGui.asm ; select GuiParas and hit F6
  GuiControl Button1, "button", "That's a normal pushbutton", w250, h0+40 ; width 25% of client area, height 0%+40px
  GuiControl Button2, "button", "Lite Turquoise"/"Blue", bcol LiteBlueGreen/Blue, x250, w250, h0+40, font -14
  GuiControl Button3, "button", "Lite Yellow"/"Full Yellow", bcol LiteYellow/Yellow, fcol Red/Black, x500, w250, h0+40, font -14:FW_BOLD
  GuiControl Button4, "button", "Rounded button", bcol LiteGrey/Red, fcol Black/White, rr40, x750, w250, h0+40, font -12:FW_SEMIBOLD
GuiEnd

Rem To define a button, use:
- x, y, w, h for its position, followed by n 1000th of the window width or height
- bcol RgbCol(...) to define the background colour; bcol Blue/Red means "blue, but red if pressed"
- fcol Black/White to define the foreground (text) colour; white if pressed
- "normal text"/"pressed text"
- rr0=no rounded corners, rr100=a circle; use guiRoundRect=n to set the default rounding
- you may define a pen: put GuiButtonPen before the include line


With 7 lines of code, you can create this:



These buttons require an XP manifest, as shown in the attachment. When you size the window, the buttons size horizontally but not vertically, due to the w250, h0+40.

If you zoom in the image below, you may notice that the buttons' borders use antialiasing: under the hood, Gdi+ is at work.

jj2007

MasmBasic version 15 Nov 22 is online. The included RichMasm editor will now colourise plain text asm sources to a certain extent, like in this example from \Masm32\examples\threads\multhread\multhrd.asm:

WndProc proc hWin:DWORD,uMsg:DWORD,wParam:DWORD,lParam:DWORD

    LOCAL tID    :DWORD

    Switch uMsg
      Case WM_COMMAND
        Switch wParam
          Case 50
          ; ------------------------------------
          ; loop through starting 10 new threads
          ; ------------------------------------
            push esi
            push edi
            xor esi, esi
            xor edi, edi
          @@:
            add esi, 25
            add edi, 1
            fn CreateThread,0,0,ADDR CreateNewThread,esi,0,ADDR tID
            cmp edi, 10
            jl @B
            pop edi
            pop esi

          Case 51
          ; ----------------
          ; close all thread
          ; ----------------


All push arg and pop arg instructions are highlighted in red. Jumps to @@: labels are red for @B and blue for @F. Such a few red spots can help to recognise, for example, problems with stack balance. I am not a fan of Christmas trees aka automatic highlighting of each and every little feature, but I do use manual colouring in my sources, especially when doing little tricks, see below.

When saving the source code in RTF format (as *.asc), these changes are permanent.

jj2007

Install the latest MasmBasic version to get access to over 500 powerful macros, and in case you want to build the Simple Editor. Latest items:

Guid$():
Let edi=Guid$()
MsgBox 0, Cat$("A Guid: ["+edi+"]"), "Hi", MB_OK


Output: A Guid: [d6e3dc8a-f76a-4ec2-9163-65f8bdd0138f] (plus a pointer to the GUID itself in edx)

xCall for passing arguments to a label, invoke style:
include \masm32\MasmBasic\MasmBasic.inc
.code
somelabel:
mov ecx, [esp+4]
MsgBox 0, ecx, "Hi", MB_OK
retn 4
Init
xCall somelabel, Chr$("Hello World")
EndOfCode


MsgBox: see http://masm32.com/board/index.php?topic=10530.msg116251#msg116251, the new MsgBox will not make your controls lose the focus.

jj2007

I forgot this one: CenterWindow hWnd_, 400, 200  ; 400px wide, 200px high, right in the middle

LiaoMi

Quote from: jj2007 on December 06, 2022, 11:18:30 AM
Install the latest MasmBasic version to get access to over 500 powerful macros, and in case you want to build the Simple Editor. Latest items:

Guid$():
Let edi=Guid$()
MsgBox 0, Cat$("A Guid: ["+edi+"]"), "Hi", MB_OK


Output: A Guid: [d6e3dc8a-f76a-4ec2-9163-65f8bdd0138f] (plus a pointer to the GUID itself in edx)

xCall for passing arguments to a label, invoke style:
include \masm32\MasmBasic\MasmBasic.inc
.code
somelabel:
mov ecx, [esp+4]
MsgBox 0, ecx, "Hi", MB_OK
retn 4
Init
xCall somelabel, Chr$("Hello World")
EndOfCode


MsgBox: see http://masm32.com/board/index.php?topic=10530.msg116251#msg116251, the new MsgBox will not make your controls lose the focus.

Hi jj2007,

Bad DLL for R? - msftEdit.dll

jj2007

#560
Hi LiaoMi,

On my Win7-64, C:\Windows\System32\msftedit.dll accepts only RichEdit50W RichEdit60W as well as RichEdit20W. Which Windows version are you running?

Can you do me favour and test the attached version, which does an extra check? If you get it running, please hit F9 and give me the RichEdit??W version. Thanks :thup:

TimoVJL

My windows 7 x64 msftedit use RichEdit50W
File version: 5.41.21.2510
Inside dll is UNICODE string RichEdit50W
May the source be with you

jj2007

Quote from: TimoVJL on December 08, 2022, 10:07:29 AM
My windows 7 x64 msftedit use RichEdit50W
File version: 5.41.21.2510
Inside dll is UNICODE string RichEdit50W

RichEdit is driving me mad!

00000000        RichEdit20W
Impossibile trovare la classe della finestra.

001603E0        RichEdit50W
Operazione completata.

00000000        RichEdit60W
Impossibile trovare la classe della finestra.

00000000        RichEdit20A
Impossibile trovare la classe della finestra.

00000000        RichEdit50A
Impossibile trovare la classe della finestra.


Fun fact: RichMasm.exe runs just fine with RichEdit60W... and I just found out why - it loads the Office12 variant present on my machine :rolleyes:

Testbed attached, pure Masm32 SDK :cool:

LiaoMi

Quote from: jj2007 on December 08, 2022, 08:41:34 AM
Hi LiaoMi,

On my Win7-64, C:\Windows\System32\msftedit.dll accepts only RichEdit50W RichEdit60W as well as RichEdit20W. Which Windows version are you running?

Can you do me favour and test the attached version, which does an extra check? If you get it running, please hit F9 and give me the RichEdit??W version. Thanks :thup:

Hi jj2007,

I have windows 10 Ent 21h1  :rolleyes:

---------------------------
RichMasm editor version 07.12.2022, built with UAsm64:
---------------------------

RichEdit20W of msftEdit.dll, ComCtl32 version 6.16
---------------------------
Yes   No   Cancel   
---------------------------

jj2007

Thanks a lot, LiaoMi :thup:

zedd151

#565
Well MasmBasic (3March23) installed okay. But upon running RichMasm:
'Compatibilty Options' (Exporer Right Click)  did nothing to help resolve this. AVX code there I suppopse?
No AV software btw.
Have a recommendation for previous version that *might* work for me here?


Attached image removed as it has served its purpose.

jj2007

Quote from: zedd151 on June 21, 2023, 03:35:20 AM
Well MasmBasic (3March23) installed okay. But upon running RichMasm:
'Compatibilty Options' (Exporer Right Click)  did nothing to help resolve this. AVX code there I suppopse?
No AV software btw.

Have a recommendation for previous version that *might* work for me here?

This is the SSE 4.2 problem, sorry. Can you please run the attached test?

zedd151

Thanks for the reply. Not really urgent for me, was only going to play around with it for a bit - but for compatibility for other users might be a good idea at least to have a separate (dumbed down lol) version for users with same CPU issues ( old as dirt computer/CPU that is) and still keep the presumably high powered version for users with more modern hardware.

zedd151

Quote from: jj2007 on June 21, 2023, 04:18:47 AM
Can you please run the attached test?
Old cpu
MessageBox:
eax       7139135


:cool:

jj2007

Ok, bug found. It is more complicated than I thought, though. Please extract the attached exe as \Masm32\MasmBasic\RichMasm.exe and launch it. That should work fine, but it's a debug edition.