News:

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

Main Menu

Miscellaneous snippets

Started by jj2007, August 20, 2017, 08:02:31 AM

Previous topic - Next topic

jj2007

Quote from: Caché GB on September 15, 2023, 08:30:34 AMHi JJ

I am always willing to learn. As I have told you a few times, I have learnt to much from you.
However it would be quicker for me to drop your .exe into IDA to try and find out what is giong
on then to waddle through a billion lines of MasmBasic's macros.

So maybe a pure MASM demo would be nice.

Thanks.

I would probably have shown how it's done in Win32, but an overly zealous moderator killed my desire to be kind, sorry.

Maybe tomorrow.

Quote from: jj2007 on September 15, 2023, 06:17:00 AM
Quote from: NoCforMe on September 15, 2023, 06:10:01 AMThe two are identical. But Jochen, these are 16x16 icons.

Yes and no. It's a 128x128 icon, but Windows scales it down to 16x16 to let it fit into the caption. And it scales it down to 32x32 if you use Alt Tab.

I'd like to see one example where Windows uses the full 128x128. And don't come up with an icon editor, because I would consider that cheating. I mean an actual use of this icon beyond 32x32.

#EDIT# This kind of squabbling is not helpful to the OP. Not in the Campus, please.

Caché GB

Hi JJ

No worries.

Incidentally, how do we get the icons of the two apps on the right to behave
like the four on the left when Explorer is in Extra Large Icons View.



Caché GB's 1 and 0-nly language:MASM

jj2007

Good question :thumbsup:

WinMain, wc is WNDCLASSEX:
    mov wc.hIcon, rv(LoadImage, eax, IDI_APPLICATION, IMAGE_ICON, 0, 0, 0)
    mov wc.hIcon, rv(LoadIcon, eax, IDI_APPLICATION)

Both work, but they yield the same result. In contrast, as mentioned here, LoadImage behaves much better with a static control. Demo attached - you can actually size it!

Caché GB

Hi JJ

The only way I've bean able to achieve a solution to this Extra Large Icons View quetion.

1. The icon must be a 256x256 bmp or png. (To reduce binary bloatware, use png),
2. If this 256x256 icon is in an ICON GROUP, it mush be the first icon in the group.
3  This icon / icon group's Resource ID must be the lowest value (numeral) in the
   Resource File's (*.rc) ICON listings.

What makes testing cumbersome is that Windows Explorer builds an icon caché. Therefore even if you
change the icon that Windows Explorer uses to display your app's Icon, the first icon you weiwed
that *.exe file with is the one that will be displayed. Until you, a) restart your PC, b) restart
Windows Explorer or delete Windows Explorer's icon caché file (Not recomended).

To avoid doing any of the above, for testing this icon qustion, you could create a head folder called "TEST ICON".
Within this folder "TEST ICON" create a bunch of folders calling them say "AA", "AB", ->, "AZ". Now each time you
reassemle your *.exe file, you copy this file and past it in a new ABC folder to veiw. When done testing new icon
arangments, remove all ABC folders.

The two runtime icons set in wc.hIcon and  wc.hIconSm of your window class (WNDCLASSEX) are not affected by the Windows
Explorer's icon caché.

If you have two separate icon files, the one you set in the .hIcon member of WNDCLASSEX is the icon that will be displayed
in the Desktop's Taskbar at runtime. The icon file you set in .hIconSm, will be displayed in the your app's Window Title Bar.

Note:
Testing was performed using the Resource Compiler supplied by Visual Studio.
Caché GB's 1 and 0-nly language:MASM

jj2007

Quote from: Caché GB on September 17, 2023, 10:26:04 PMHi JJ

The only way I've bean able to achieve a solution to this Extra Large Icons View quetion.

1. The icon must be a 256x256 bmp or png. (To reduce binary bloatware, use png),
2. If this 256x256 icon is in an ICON GROUP, it mush be the first icon in the group.
3  This icon / icon group's Resource ID must be the lowest value (numeral) in the
   Resource File's (*.rc) ICON listings...

Thanks, Caché - interesting stuff :thumbsup:

I don't normally use Explorer for file operations (I use FreeCommander XE). If I use it, it's with the details view, i.e. with the smallest possible icons. But it's good to know how to display one's icons in the XXL view, thanks :thup:

TimoVJL

Not so small ?
With Setup program
FreeCommanderXE-32-public_setup.zip 16.12.2022 14.36 MB 9330AED7FA563A76C489FB0445905153CAE93CC591DE3B98B30C84DD468E75E4
May the source be with you

jj2007

Yes, Timo, it's a bit bloated. But it offers ten times as many functions as the SASM "IDE" at 20% of its size. Ok for me. If you have a better alternative, please let me know.

TimoVJL

I am Pelles C user, so i poide have been best for me.
I am now retired from all work, so now i just try keep nature around me in good condition.
I just spend my time with lawnmower and grass trimmers, and shovel and scythe before a scythe man release me from this ugly world  :biggrin:
May the source be with you

jj2007

How to get the size of a sector on disk:

include \masm32\MasmBasic\MasmBasic.inc
SectorSize MACRO drv, inx:=<2>
  StringToArray Launch$(Cat$("fsutil fsInfo sectorInfo "+repargA(drv))), SecInfo$()
  .if Instr_(SecInfo$(inx), ":")
    inc eax
    void Val(eax)
  .endif
  EXITM <eax>
ENDM
Enum #SECINFO_, 0:LOGBYTES, PHYSBYTESA, PHYSBYTESP, PHYSBYTESV
  Init
  PrintLine Str$("Drive C: has %i logical bytes per sector", SectorSize("C:", SECINFO_LOGBYTES))
  PrintLine Str$("Drive C: has %i physical bytes per sector", SectorSize("C:", SECINFO_PHYSBYTESA))
EndOfCode

Output:
Drive C: has 512 logical bytes per sector
Drive C: has 4096 physical bytes per sector

StringToArray graps fsutil output to create the SecInfo$() array; the rest is easy. You must run the exe as admin to see the result.

Just for fun - forget it immediately, it's only useful to demonstrate the use of some MasmBasic macros :biggrin:

jj2007

CISDLs:
CSIDL_ALTSTARTUP              C:\Users\Jochen\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
CSIDL_APPDATA                 C:\Users\Jochen\AppData\Roaming
Error   x:eax           80004005
CSIDL_BITBUCKET
CSIDL_CDBURN_AREA             C:\Users\Jochen\AppData\Local\Microsoft\Windows\Burn\Burn
CSIDL_COMMON_ADMINTOOLS       C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Administrative Tools
CSIDL_COMMON_ALTSTARTUP       C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup
CSIDL_COMMON_APPDATA          C:\ProgramData
CSIDL_COMMON_DESKTOPDIRECTOR  C:\Users\Public\Desktop
CSIDL_COMMON_DOCUMENTS        C:\Users\Public\Documents
...
CSIDL_SYSTEM                  C:\Windows\system32
CSIDL_SYSTEMX86               C:\Windows\SysWOW64
CSIDL_TEMPLATES               C:\Users\Jochen\AppData\Roaming\Microsoft\Windows\Templates
CSIDL_WINDOWS                 C:\Windows
63 values displayed - hit any key

Full project attached. Latest list is here, but WinExtra.inc seems pretty up-to-date :thumbsup:

jj2007

MasmBasic 17 March 2024 is online. Plus a collection of miscellaneous non-essential files that don't fit into the main archive any more: check reply #1 for SetupMbExtras.zip.