Skip to content

Commit 5a74998

Browse files
committed
use warning icon in some cases on error message
1 parent 0c92b47 commit 5a74998

File tree

3 files changed

+24
-9
lines changed

3 files changed

+24
-9
lines changed

src/c/error_gcmz.c

+4-1
Original file line numberDiff line numberDiff line change
@@ -180,21 +180,23 @@ gcmz_error_format(error e, struct wstr *const dest, wchar_t const *const referen
180180

181181
struct error_message_box_task_data {
182182
HWND window;
183+
UINT flags;
183184

184185
struct wstr msg;
185186
struct wstr title;
186187
};
187188

188189
static void error_message_box_task(void *userdata) {
189190
struct error_message_box_task_data *d = userdata;
190-
message_box(d->window, d->msg.ptr, d->title.ptr, MB_ICONERROR);
191+
message_box(d->window, d->msg.ptr, d->title.ptr, d->flags);
191192
ereport(sfree(&d->title));
192193
ereport(sfree(&d->msg));
193194
ereport(mem_free(&d));
194195
}
195196

196197
void gcmz_error_message_box(error e,
197198
HWND const window,
199+
UINT const flags,
198200
bool const deferred,
199201
char const *const title,
200202
wchar_t const *const reference,
@@ -223,6 +225,7 @@ void gcmz_error_message_box(error e,
223225
goto cleanup;
224226
}
225227
d->window = window;
228+
d->flags = flags;
226229
d->msg = msg;
227230
msg = (struct wstr){0};
228231
d->title = wide_title;

src/c/error_gcmz.h

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ NODISCARD error
3838
gcmz_error_format(error e, struct wstr *const dest, wchar_t const *const reference, char const *const format, ...);
3939
void gcmz_error_message_box(error e,
4040
HWND const window,
41+
UINT const flags,
4142
bool const deferred,
4243
char const *const title,
4344
wchar_t const *const reference,

src/c/gcmzdrops.c

+19-8
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ static void generic_lua_error_handler(error e, char const *const default_msg) {
6060
msg = default_msg;
6161
cleanup:
6262
if (msg) {
63-
gcmz_error_message_box(e, aviutl_get_exedit_window_must(), true, gettext("Error"), NULL, "%1$s", msg);
63+
gcmz_error_message_box(e, aviutl_get_exedit_window_must(), MB_ICONERROR, true, gettext("Error"), NULL, "%1$s", msg);
6464
}
6565
files_cleanup(true);
6666
}
@@ -674,6 +674,7 @@ static void request_callback(struct api_request_params *const params, api_reques
674674
if (efailed(err)) {
675675
gcmz_error_message_box(err,
676676
(HWND)params->userdata,
677+
MB_ICONERROR,
677678
false,
678679
gettext("Error"),
679680
NULL,
@@ -717,7 +718,7 @@ static BOOL wndproc_init(HWND const window) {
717718
efree(&err);
718719
}
719720
gui_lock();
720-
gcmz_error_message_box(err, window, false, title, NULL, msg ? "%1$s\n\n%2$s" : "%1$s", msg_head, msg);
721+
gcmz_error_message_box(err, window, MB_ICONERROR, false, title, NULL, msg ? "%1$s\n\n%2$s" : "%1$s", msg_head, msg);
721722
return FALSE;
722723
}
723724

@@ -734,8 +735,15 @@ static BOOL wndproc_init(HWND const window) {
734735
err = drop_target_new(&dt);
735736
if (efailed(err)) {
736737
gui_lock();
737-
gcmz_error_message_box(
738-
err, window, false, title, L"%1$s%2$s", "%1$s\n\n%2$s", msg_head, gettext("Failed to create IDropTarget."));
738+
gcmz_error_message_box(err,
739+
window,
740+
MB_ICONERROR,
741+
false,
742+
title,
743+
L"%1$s%2$s",
744+
"%1$s\n\n%2$s",
745+
msg_head,
746+
gettext("Failed to create IDropTarget."));
739747
return FALSE;
740748
}
741749
dt->super.lpVtbl->AddRef((void *)dt);
@@ -759,7 +767,7 @@ static BOOL wndproc_init(HWND const window) {
759767
efree(&err);
760768
}
761769
gui_lock();
762-
gcmz_error_message_box(err, window, false, title, NULL, msg ? "%1$s\n\n%2$s" : "%1$s", msg_head, msg);
770+
gcmz_error_message_box(err, window, MB_ICONERROR, false, title, NULL, msg ? "%1$s\n\n%2$s" : "%1$s", msg_head, msg);
763771
return FALSE;
764772
}
765773
g_drop_target_registered = SUCCEEDED(hr);
@@ -768,6 +776,7 @@ static BOOL wndproc_init(HWND const window) {
768776
if (efailed(err)) {
769777
gcmz_error_message_box(err,
770778
window,
779+
MB_ICONWARNING,
771780
false,
772781
title,
773782
NULL,
@@ -782,13 +791,15 @@ static BOOL wndproc_init(HWND const window) {
782791
if (efailed(err)) {
783792
char const *apimsg = NULL;
784793
if (eis_hr(err, HRESULT_FROM_WIN32(ERROR_ALREADY_EXISTS))) {
785-
apimsg = gettext("This error mainly occurs when multiple instances of AviUtl are running.\n"
786-
"If you need external integration API, please close all instances of AviUtl and start only one instance.\n"
787-
"If you do not need external integration API, you can ignore this message.");
794+
apimsg = gettext(
795+
"This error mainly occurs when multiple instances of AviUtl are running.\n"
796+
"If you need external integration API, please close all instances of AviUtl and start only one instance.\n"
797+
"If you do not need external integration API, you can ignore this message.");
788798
efree(&err);
789799
}
790800
gcmz_error_message_box(err,
791801
window,
802+
MB_ICONWARNING,
792803
false,
793804
title,
794805
NULL,

0 commit comments

Comments
 (0)