Change AHK Menu window style (MNS_...)

Get help with using AutoHotkey and its commands and hotkeys
gwarble
Posts: 233
Joined: 30 Sep 2013, 15:01

Change AHK Menu window style (MNS_...)

15 Dec 2016, 18:30

Hey all,
Anyone have any tricks to set the AHK menu's window style?

My goal is to remove MNS_CHECKORBMP to display both an icon and a checkbox.

This does not work:
MI_SetMenuStyle(MenuNameOrHandle, 0x0)

but this does to remove the space for icon/check altogether
MI_SetMenuStyle(MenuNameOrHandle, 0x80000000)

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

EitherMouse - Multiple mice, individual settings . . . . www.EitherMouse.com . . . . forum . . . .
lexikos
Posts: 6130
Joined: 30 Sep 2013, 04:07
GitHub: Lexikos

Re: Change AHK Menu window style (MNS_...)

16 Dec 2016, 04:18

If you remove MNS_CHECKORBMP, whether it displays both side by side depends on the OS and theme. Windows 7 with classic theme or Windows XP will put both side by side, but other themes on Windows 7 or Windows 10 will not. My tests showed that when they are put side by side, there is zero space between the icon and the text.

The code you posted, which comes from my Menu Icons library, is outdated and not compatible with x64. You may use this instead:

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus


It is poor style (no pun intended) to put quotes around a number when it is used as a number, not a string of characters.
gwarble
Posts: 233
Joined: 30 Sep 2013, 15:01

Re: Change AHK Menu window style (MNS_...)

16 Dec 2016, 08:58

Ah thanks for the info... I think i'll try to overlay a check onto the icon with gdip instead, don't want to fight dependencies on themes


I think that at the time you wrote MI() function definitions were still required to use quotes and "=" for default parameter values
EitherMouse - Multiple mice, individual settings . . . . www.EitherMouse.com . . . . forum . . . .
lexikos
Posts: 6130
Joined: 30 Sep 2013, 04:07
GitHub: Lexikos

Re: Change AHK Menu window style (MNS_...)

16 Dec 2016, 16:47

Are you saying that you added the parameter default right after I wrote the function over nine years ago? I did not give that parameter a default value.

Quotes were never required. Literal numbers were supported in v1.0.35 when optional parameters were added, whereas non-empty quoted strings weren't supported until v1.0.46.13. I posted MI several months after that.
gwarble
Posts: 233
Joined: 30 Sep 2013, 15:01

Re: Change AHK Menu window style (MNS_...)

16 Dec 2016, 17:54

I didn't realize it but apparently i must have edited in (erroneously apparently, at the time i might have even thought that i really wanted that string to be passed and not an integer) a default parameter sometime in the past nine years, actually most likely between 1.0.48 when i started using ahk and 1.0.90 when menu icons were added natively when i don't think i would have had a reason for MI()... Probably haven't looked at it since, just dug it out of my Lib\ yesterday to try to get the icon and check
EitherMouse - Multiple mice, individual settings . . . . www.EitherMouse.com . . . . forum . . . .

Return to “Ask For Help”

Who is online

Users browsing this forum: truekefir and 72 guests