While adding a temporary icon to a Dialog, before later replacing it with a changed icon, the following Alias was used:
ALIAS smallBMP {
; Creates 1 small bmp icon for pre-loading into the Dialog - so that the icon can be changed later
if ($window(@small.bmp.icon)) { window -c @small.bmp.icon }
window -pfh @small.bmp.icon 0 0 1 1
drawrect -f @small.bmp.icon $color(background) 1 0 0 1 1
var %c = $+(",$scriptdir,small.bmp,")
drawsave @small.bmp.icon %c
window -c @small.bmp.icon
}
After it was added, and the Dialog opened, it was found that mIRC versions 6.35 and earlier would randomly crash.
Oddly, the easiest way to crash mIRC was to run this alias, and then open one of the help files by typing /help
or by opening ircintro.chm
Both the help file, mirc.chm or ircintro.chm, and mIRC.exe would crash and close.
Very odd behaviour indeed.
As it was wanted that the script would run in versions 6.01 upwards, this bug was painstakingly traced out, and then narrowed down to this event occurring:
drawsave @small.bmp.icon %c
window -c @small.bmp.icon
It is assumed that somehow if the window is closed as the draw save is taking place, some kind of memory error occurs (as evidenced by various different crash reports).
It might be that in version 7.1, the save happens faster than the close, so that the bug does not show up generally, but it might at some later point.
The workaround for now has been to close to window with a timer:
.timer 1 1 window -c @small.bmp.icon
Perhaps, to ensure this behaviour does not inadvertently crop up again, it could be investigated and solved.
Thanks
Free` #mIRC