There is a glitch in \Masm32\MasmBasic\Res\MbSnippets.asc, line 624:
include \masm32\MasmBasic\MasmBasic.inc
; to run this demo, download the Excel package and extract the files to \Masm32\MasmBasic\Res\*
; click here to see a much more detailed demo, including writing formatted text to Excel
Init ; ## get data from a spreadsheet ##
xlsConnect ; no args=Excel, System
.if !Zero? ; non-zero means success
xlsOpen "\Masm32\MasmBasic\Res\LifeExOecd.xls" ; we open a sample spreadsheet
...
When selecting Init and hitting F6, lots of errors appear. To resolve the problem, move the include line after the two comments:
; to run this demo, download the Excel package and extract the files to \Masm32\MasmBasic\Res\*
; click here to see a much more detailed demo, including writing formatted text to Excel
include \masm32\MasmBasic\MasmBasic.inc
Init ; ## get data from a spreadsheet ##
...
The reason for this problem is that RichMasm, if Init is selected, searches backwards a hundred chars or so until it finds an include line. The two comments were a bit longer ;-)
Corrected version attached.
Aha, the old "SpecialCases" glitch ... I've programmed a few of those in my time ...
Quote from: jj2007 on November 02, 2023, 08:51:50 PMsearches backwards a hundred chars or so until it finds an include line.
:biggrin: Why don't begin from beginning?
Quote from: HSE on November 03, 2023, 07:29:53 AMWhy don't begin from beginning?
That is the standard build case when you hit F6 and Init (https://www.jj2007.eu/MasmBasicQuickReference.htm#Mb1009) is not selected.
The "select Init and build a snippet" feature allows to test snippets, i.e.
short complete examples (usually 5-20 lines), by selecting Init and building what starts with the include line before Init and ends with end start or EndOfCode. The MbSnippets.asc source has over 100 of such snippets for quick testing of language elements. Here are four of them:
include \masm32\MasmBasic\MasmBasic.inc
Init ; ## simple loop ##
Cls 9
mov ebx, "A"
Print "The alphabet from a loop: ", CrLf$
.Repeat
Let esi=esi+Chr$(ebx+32, " ") ; +32: make a lowercase alphabet
inc ebx
.Until ebx>"Z"
Print esi, CrLf$, Ltrim$(Mirror$(esi)) ; we need to trim it because the original ends with a space
Exit
end start ; exit process, then end of code - the usual way to quit Masm code
include \masm32\MasmBasic\MasmBasic.inc
Init ; ## Unicode file I/O ##
Let esi=wCL$()
.if wExist(esi)
wOpen "I", #1, esi
wLet edi=Input$(#1, Lof(#1))
Close
wMsgBox 0, edi, wCat$("Contents of "+LastFileName$+":"), MB_OK
.else
wMsgBox 0, esi, "No such file:", MB_OK
.endif
EndOfCode ; quit MasmBasic code (you may still use Exit to create space for other code below)
include \masm32\MasmBasic\MasmBasic.inc
Init ; ## nested For ... Next loops ##
m2m eax, 5
For_ ebx=0 To eax-1 ; using eax is allowed here
For_ ecx=1 To ebx+ebx ; the first iteration is 1 to 0 and will be rejected (2*ebx=0, 2, 4, ...)
call MyTest
Next
Print
Next
Print "ok"
Exit
MyTest proc
LOCAL ct
For_ ct=0 To 9
Print "*"
Next ct
Print Str$("\tebx=%i, ", ebx), Str$("ecx=%i\n", ecx)
ret
MyTest endp
EndOfCode
include \masm32\MasmBasic\MasmBasic.inc
Init ; ## COM demo: open Internet Explorer ##
invoke OleInitialize, NULL
.if eax==S_OK
push Chr$("ru.wikipedia.org/wiki/Заглавная_страница") ; Russian Wikipedia
call MyBrowser
.endif
invoke OleUninitialize
Exit
CLSID_IExplorer GuidFromString("0002DF01-0000-0000-C000-000000000046") ; either use quoted text syntax or...
IID_IWebBrowser2 GuidFromString({D30C1661-CDAF-11D0-8A3E-00C04FC9E26E}) ; ... paste copied registry key name
...
To identify the snippet, RichMasm goes back a few lines until it finds an include line that contains the string \MasmBasic\; then it searches forward until it hits
end start or EndOfCode (https://www.jj2007.eu/MasmBasicQuickReference.htm#Mb1337), and sends the snippet to TmpFile.asm to build it.
Many examples are also in the MasmBasic help file (in the Files menu) - here is a four-liner showing a GUID:
include \masm32\MasmBasic\MasmBasic.inc
Init ; << select Init and hit F6 to test this snippet
MsgBox 0, Cat$("A Guid: ["+Guid$ (https://www.jj2007.eu/MasmBasicQuickReference.htm#Mb1455)()+"]"), "Hi", MB_OK
EndOfCode
Rem returns a pointer to the string, plus a pointer to the GUID itself in edx
Quote from: jj2007 on November 03, 2023, 08:24:22 AMuntil it finds an include line that contains the string \MasmBasic\
Just sound more logic to select that line.
Quote from: HSE on November 03, 2023, 08:51:45 AMQuote from: jj2007 on November 03, 2023, 08:24:22 AMuntil it finds an include line that contains the string \MasmBasic\
Just sound more logic to select that line.
Perhaps you are right. However, many of my projects have the string \MasmBasic\ in the path of files e.g. when using Recall (https://www.jj2007.eu/MasmBasicQuickReference.htm#Mb1172) or FileRead$ (https://www.jj2007.eu/MasmBasicQuickReference.htm#Mb1075) or a simple Open (https://www.jj2007.eu/MasmBasicQuickReference.htm#Mb1034). If by accident a line with Open "I", #1, "\Masm32\MasmBasic\MbGuide.rc" is selected, RichMasm would mistakenly assume it was the include line; unlikely but not impossible. In contrast, the string
Init (case-sensitive, full word) is pretty unique.
To search "MasmBasic.inc" is more complex than the reverse thing?
It's probably the same. Anyway, I double-click on Init and hit F6, and it works. Too late to change that feature - call it organically grown code, OGC ;-)
But doesn't it make you a tiny bit embarassed to have to write up a bug report in your documentation? "Er, if you use Init with a snippet and have more than xxx bytes of comment text before it ...".
However, I can relate to your feeling of not wanting to go back and fix it. I hate stuff like that in my own code. The inertia to be overcome to sit down and fix it is considerable ...
Own the code, own the bugs.
Quote from: NoCforMe on November 03, 2023, 11:23:49 AMBut doesn't it make you a tiny bit embarassed to have to write up a bug report
Embarassed? Not at all. It's a rarely used feature in an almost bug-free editor with a 24k lines source - and it works fine unless you do strange things. Wanna talk about SDK bugs? Or, worse, Micros*t MASM bugs?
Btw the "downloaded 0 times" under the top post tells me you are here just to make a fuss. You've lost interest in coding? Poor boy.
Quote from: jj2007 on November 03, 2023, 11:12:16 AMcall it organically grown code, OGC ;-)
:biggrin: :biggrin: :thumbsup:
Quote from: jj2007 on November 03, 2023, 12:06:21 PMQuote from: NoCforMe on November 03, 2023, 11:23:49 AMBut doesn't it make you a tiny bit embarassed to have to write up a bug report
Embarassed? Not at all. It's a rarely used feature in an almost bug-free editor with a 24k lines source - and it works fine unless you do strange things. Wanna talk about SDK bugs? Or, worse, Micros*t MASM bugs?
Btw the "downloaded 0 times" under the top post tells me you are here just to make a fuss. You've lost interest in coding? Poor boy.
Do I detect a bit of testiness in your reply? No need; as I've said before, I'm impressed with your IDE, a great addition to the arsenal of programming tools. It's just that MasmBasic isn't my cup of tea. Not that I consider my ways of working superior by any means, just more to my liking.
Hey, I just like making comments from the peanut gallery, like a lot of the other hue-mons here.
And don't worry, I do plenty of coding. I see you haven't commented on my toolbar BMP creator. No problemo, maybe it isn't your cup of tea. But I did have fun writing it.
Quote from: NoCforMe on November 03, 2023, 02:49:00 PMI just like making comments from the peanut gallery, like a lot of the other hue-mons here.
(https://upload.wikimedia.org/wikipedia/en/thumb/f/fa/StatlerandWaldorf%282%29.JPG/315px-StatlerandWaldorf%282%29.JPG)
Are you the one on the left? Then the right guy must be Héctor :biggrin:
QuoteI see you haven't commented on my toolbar BMP creator. No problemo, maybe it isn't your cup of tea. But I did have fun writing it.
Guess what? I even
downloaded and
tested it!
Quote from: jj2007 on November 03, 2023, 07:42:51 PM(https://upload.wikimedia.org/wikipedia/en/thumb/f/fa/StatlerandWaldorf%282%29.JPG/315px-StatlerandWaldorf%282%29.JPG)
:biggrin: You have mustache now JJ !!
I think you can't post selfies with a friend. :eusa_naughty:
Somebody said COM was complicated: 17 lines of code for opening Internet Explorer :cool:
include \masm32\MasmBasic\MasmBasic.inc
.code
CLSID_IExplorer GuidFromString("0002DF01-0000-0000-C000-000000000046") ; either use quoted text syntax or...
IID_IWebBrowser2 GuidFromString({D30C1661-CDAF-11D0-8A3E-00C04FC9E26E}) ; ... paste copied registry key name
MyBrowser proc url
LOCAL WebInterface
.if rv(CoCreateInstance, addr CLSID_IExplorer, NULL, CLSCTX_LOCAL_SERVER, addr IID_IWebBrowser2, addr WebInterface)==S_OK
CoInvoke WebInterface, IWebBrowserVtbl.put_StatusBar, VARIANT_TRUE ; configure the browser
CoInvoke WebInterface, IWebBrowserVtbl.put_Visible, VARIANT_TRUE
CoInvoke WebInterface, IWebBrowserVtbl.Navigate, Ole$(url), 0, 0, 0, 0
.endif
ret
MyBrowser endp
Init ; ## COM demo: open Internet Explorer ##
If_ rv(OleInitialize, NULL)==S_OK Then invoke MyBrowser, Chr$("ru.wikipedia.org/wiki/Заглавная_страница") ; Russian Wikipedia
invoke OleUninitialize
EndOfCode
QuoteThe biggest ones to leave Windows in version 11 are the Timeline, Live Tiles, and Internet Explorer (https://www.pcmag.com/news/10-reasons-not-to-upgrade-to-windows-11).
Does anybody run Windows 11? I'd be curious to see whether the COM demo above still runs in Win11.
I've abandoned my Win7-64 machine and am now working on my Win10 notebook (which I bought two years ago). Now M$ invites me to upgrade to Win11, and I am trying to figure out whether it's worthwhile.
Isn't that in shdocvw.dll ?
Quote from: jj2007 on November 11, 2023, 01:12:37 AMDoes anybody run Windows 11? I'd be curious to see whether the COM demo above still runs in Win11.
IE still exists in Win 11, it isn't gone-gone. Double clcking IExpore.exe just runs Edge instead. Edge still has IE Mode and the IE control still exists. This is a nearly 18-month old version of Win11 by now so it might be different in the cutting-edge versions but I don't think so.
(https://img001.prntscr.com/file/img001/QlkexA6lQhyfARe30rPzjg.png)
(It wasn't connected to the Internet)
Quote from: adeyblue on November 17, 2023, 05:59:56 PMDouble clcking IExpore.exe just runs Edge instead. Edge still has IE Mode and the IE control still exists
Brilliant :biggrin:
Has M$
ever abandoned a feature? Lots of stuff got "deprecated" but still works a century later...