MagicBox - Message Box Generator
Re: MagicBox - Message Box Generator
Thank you for this incredible work! Big time saver and also never knew about most of these msgbox possibilities
Re: MagicBox - Message Box Generator
Version 1.0.3:
- Fixed: minor corrections in the generated code.
- Fixed: the whole background of SoftModalMessageBox was being painted white under some unknown condition. Invoking the function by its address solved the issue.
- InputBoxEx: added the options Icon and IconIndex for the title bar.
- MsgBoxEx: compatibility with high DPI scaling.
Download
- Fixed: minor corrections in the generated code.
- Fixed: the whole background of SoftModalMessageBox was being painted white under some unknown condition. Invoking the function by its address solved the issue.
- InputBoxEx: added the options Icon and IconIndex for the title bar.
- MsgBoxEx: compatibility with high DPI scaling.
Download
Re: MagicBox - Message Box Generator
Thank you, just yesterday I had used previous version for one of my scripts. Very useful tool!
Part of my AHK work can be found here.
Re: MagicBox - Message Box Generator
FYI -- For the "Virtuose.ahk" example, the icon used for the correct answer is transparent for me.
I corrected this by using Icon57
hIcon := LoadPicture("ieframe.dll", "w32 Icon57", _)
I had to choose a higher index number and see which icon was displayed, and then find that icon's index number, and then decrease the number until it was the correct icon I wanted.
I corrected this by using Icon57
hIcon := LoadPicture("ieframe.dll", "w32 Icon57", _)
I had to choose a higher index number and see which icon was displayed, and then find that icon's index number, and then decrease the number until it was the correct icon I wanted.
Re: MagicBox - Message Box Generator
Since the icon indexes of ieframe.dll are subject to change, I'll use the checkmark icon from SyncCenter.dll, 19.TheDewd wrote:For the "Virtuose.ahk" example, the icon used for the correct answer is transparent for me.
hIcon := LoadPicture("SyncCenter.dll", "w32 Icon19", _)
Another approach is to retrieve the icon handle from the resource ID:
Code: Select all
hModule := DllCall("kernel32.dll\LoadLibraryEx", "Str", "ieframe.dll", "UInt", 0, "UInt", 0x2, "Ptr")
hIcon := DllCall("LoadIcon", "Ptr", hModule, "UInt", 18211, "Ptr")
DllCall("FreeLibrary", "Ptr", hModule)
- Delta Pythagorean
- Posts: 627
- Joined: 13 Feb 2017, 13:44
- Location: Somewhere in the US
- Contact:
Re: MagicBox - Message Box Generator
Can you do an alt download to this? I don't mind GitHub, META, or even DropBox.
Either one would work.
Sorry, I just don't like the way sourceforge does its downloads and it's a bit bothersome on my computer to try to load the dang website.
Either one would work.
Sorry, I just don't like the way sourceforge does its downloads and it's a bit bothersome on my computer to try to load the dang website.
[AHK]......: v2.0.12 | 64-bit
[OS].......: Windows 11 | 23H2 (OS Build: 22621.3296)
[GITHUB]...: github.com/DelPyth
[PAYPAL]...: paypal.me/DelPyth
[DISCORD]..: tophatcat
Re: MagicBox - Message Box Generator
I don't see what is wrong with SourceForge, but you can download from a mirror if you want:
https://sourceforge.mirrorservice.org/m ... ory/1.0.3/
It should also be noticed that MagicBox is now included with AutoGUI.
https://sourceforge.mirrorservice.org/m ... ory/1.0.3/
It should also be noticed that MagicBox is now included with AutoGUI.
- Delta Pythagorean
- Posts: 627
- Joined: 13 Feb 2017, 13:44
- Location: Somewhere in the US
- Contact:
Re: MagicBox - Message Box Generator
Ah! Sorry, I did not know of this. And thank you very much!Alguimist wrote:[...] but you can download from a mirror if you want [...]
[AHK]......: v2.0.12 | 64-bit
[OS].......: Windows 11 | 23H2 (OS Build: 22621.3296)
[GITHUB]...: github.com/DelPyth
[PAYPAL]...: paypal.me/DelPyth
[DISCORD]..: tophatcat
Re: MagicBox - Message Box Generator
SoftModalMessageBox x64 is working fine in MagicBox, but not when tested isolatedly. I found that the structure size was incorrect and the issue is now gone. I also changed LoadLibrary to GetModuleHandle, since the function is from user32.dll.
Code: Select all
SoftModalMessageBox(Text, Title, Buttons, DefBtn := 1, Options := 0x1, IconRes := "", IconID := 1, Timeout := -1, Owner := 0, Callback := "") {
If (IconRes != "") {
hModule := DllCall("GetModuleHandle", "Str", IconRes, "Ptr")
LoadLib := !hModule
&& hModule := DllCall("kernel32.dll\LoadLibraryEx", "Str", IconRes, "UInt", 0, "UInt", 0x2, "Ptr")
Options |= 0x80 ; MB_USERICON
} Else {
hModule := 0
LoadLib := False
}
cButtons := Buttons.Length()
VarSetCapacity(ButtonIDs, cButtons * A_PtrSize, 0)
VarSetCapacity(ButtonText, cButtons * A_PtrSize, 0)
Loop %cButtons% {
NumPut(Buttons[A_Index][1], ButtonIDs, 4 * (A_Index - 1), "UInt")
NumPut(&(b%A_Index% := Buttons[A_Index][2]), ButtonText, A_PtrSize * (A_Index - 1), "Ptr")
}
If (Callback != "") {
Callback := RegisterCallback(Callback, "F")
}
x64 := A_PtrSize == 8
Offsets := (A_Is64BitOS) ? (x64 ? [96, 104, 112, 116, 120, 124] : [52, 56, 60, 64, 68, 72]) : [48, 52, 56, 60, 64, 68]
; MSGBOXPARAMS and MSGBOXDATA structures
NumPut(VarSetCapacity(MBCONFIG, (x64) ? 136 : 76, 0), MBCONFIG, 0, "UInt")
NumPut(Owner, MBCONFIG, 1 * A_PtrSize, "Ptr") ; Owner window
NumPut(hModule, MBCONFIG, 2 * A_PtrSize, "Ptr") ; Icon resource
NumPut(&Text, MBCONFIG, 3 * A_PtrSize, "Ptr") ; Message
NumPut(&Title, MBCONFIG, 4 * A_PtrSize, "Ptr") ; Window title
NumPut(Options, MBCONFIG, 5 * A_PtrSize, "UInt") ; Options
NumPut(IconID, MBCONFIG, 6 * A_PtrSize, "Ptr") ; Icon resource ID
NumPut(Callback, MBCONFIG, 8 * A_PtrSize, "Ptr") ; Callback
NumPut(&ButtonIDs, MBCONFIG, Offsets[1], "Ptr") ; Button IDs
NumPut(&ButtonText, MBCONFIG, Offsets[2], "Ptr") ; Button texts
NumPut(cButtons, MBCONFIG, Offsets[3], "UInt") ; Number of buttons
NumPut(DefBtn - 1, MBCONFIG, Offsets[4], "UInt") ; Default button
NumPut(1, MBCONFIG, Offsets[5], "UInt") ; Allow cancellation
NumPut(Timeout, MBCONFIG, Offsets[6], "Int") ; Timeout (ms)
ProcAddr := DllCall("GetProcAddress", "Ptr", DllCall("GetModuleHandle", "Str", "User32.dll", "Ptr"), "AStr", "SoftModalMessageBox", "Ptr")
Ret := DllCall(ProcAddr, "Ptr", &MBCONFIG)
If (LoadLib) {
DllCall("FreeLibrary", "Ptr", hModule)
}
If (Callback != "") {
DllCall("GlobalFree", "Ptr", Callback)
}
Return Ret
}
Re: MagicBox - Message Box Generator
Version 1.0.4:
• More functions added.
• Minor bug fixes.
Download MagicBox
List of functions:
• MsgBox
• MsgBoxEx
• MessageBoxCheck (SHMessageBoxCheck)
• ShellMessageBox
• MessageBox
• MessageBoxTimeout
• MessageBoxIndirect
• SoftModalMessageBox
• WTSSendMessage
• MsiMessageBox
• FatalAppExit
• ShellAbout
• InputBoxEx
• TaskDialog
• TaskDialogEx (TaskDialogIndirect)
• And the dinamically generated TaskDialogIndirect (no wrapper function).
Legend:
Normal text: a wrapper function around a Windows API function with the same name.
Bold: custom function.
Gray text: MagicBox does not generate code for this function.
• More functions added.
• Minor bug fixes.
Download MagicBox
List of functions:
• MsgBox
• MsgBoxEx
• MessageBoxCheck (SHMessageBoxCheck)
• ShellMessageBox
• MessageBox
• MessageBoxTimeout
• MessageBoxIndirect
• SoftModalMessageBox
• WTSSendMessage
• MsiMessageBox
• FatalAppExit
• ShellAbout
• InputBoxEx
• TaskDialog
• TaskDialogEx (TaskDialogIndirect)
• And the dinamically generated TaskDialogIndirect (no wrapper function).
Legend:
Normal text: a wrapper function around a Windows API function with the same name.
Bold: custom function.
Gray text: MagicBox does not generate code for this function.
Re: MagicBox - Message Box Generator
I just downloaded MagicBox (MagicBox-1.0.4.7z) and there is documentation on how to install it -it's not an .exe file.
What am I missing?
Any help would be appreciated.
What am I missing?
Any help would be appreciated.
Re: MagicBox - Message Box Generator
.7z is an archive format, similar to .zip or .rar: https://en.wikipedia.org/wiki/7z
I, for example, use WinRAR to open it, but there are also 7-zip (https://en.wikipedia.org/wiki/7-Zip) and other unpackers that can handle it.
Just unpack the folder in the file and find MagicBox.ahk.
Re: MagicBox - Message Box Generator
Looks like a great tool but unfortunately it won't load for me.
Did I break it?
Note: I'm on windows 10 using AHK Version 1.1.30.03
OK, so after searching a salutation for hours i thought to myself, maybe i can find a compiled version... WAIT! what if i just compile myself?
and of course it works great.
Thanks for sharing.
But i still wonder why the .ahk would not run? Maybe the version os AHK im using?
Did I break it?
Code: Select all
>"C:\Program Files (x86)\AutoHotkey\AutoHotkey.exe" /ErrorStdOut "C:\Users\DuStiN\Desktop\MagicBox\MagicBox.ahk"
C:\Users\DuStiN\Desktop\MagicBox\Lib\GuiButtonIcon.ahk (36) : ==> Missing comma
Specifically: GuiButtonIcon(Handle, File, Index := 1, Options := "")
>Exit code: 2 Time: 0.4484
OK, so after searching a salutation for hours i thought to myself, maybe i can find a compiled version... WAIT! what if i just compile myself?
and of course it works great.
Thanks for sharing.
But i still wonder why the .ahk would not run? Maybe the version os AHK im using?
Re: MagicBox - Message Box Generator
@Milenko, I find myself having to add this code (from the docs) to scripts that work for me on Win7 to get them to work (uncompiled, that is), on Win10. Not all of them, but a fair amount.
Regards,
burque505
Code: Select all
full_command_line := DllCall("GetCommandLine", "str")
if not (A_IsAdmin or RegExMatch(full_command_line, " /restart(?!\S)"))
{
try
{
if A_IsCompiled
Run *RunAs "%A_ScriptFullPath%" /restart
else
Run *RunAs "%A_AhkPath%" /restart "%A_ScriptFullPath%"
}
ExitApp
}
burque505
Re: MagicBox - Message Box Generator
@Milenko and @burque505: It has nothing to do with Windows 10 or administrative privileges. An outdated version of AHK was used to execute the script, while a more recent one was used to compile it.
Re: MagicBox - Message Box Generator
That was my first thought but when i entered the AHK world just a few months ago, I'm pretty sure i clicked the lasted version. I may be wrong.
But all in all I got it to work and its a job well done.
But all in all I got it to work and its a job well done.
Re: MagicBox - Message Box Generator
@Alguimist, thanks for clearing that up.
-
- Posts: 42
- Joined: 18 Apr 2017, 14:39
- Contact:
Re: MagicBox - Message Box Generator
Just a message to say this is great @Alguimist !!
-
- Posts: 2
- Joined: 09 Apr 2021, 13:28
Re: MagicBox - Message Box Generator
I was doing my script, and I couldn't, but thanks to this I was able to do the msgbox. Thanks
Return to “Scripts and Functions (v1)”
Who is online
Users browsing this forum: No registered users and 110 guests