Repository: godotengine/godot
File: platform/windows/display_server_windows.cpp (C++)

Code before:
	info.dwTimeout = 0;
	info.uCount = 2;
	FlashWindowEx(&info);
}

void DisplayServerWindows::window_set_taskbar_progress_value(int p_value, int p_total, WindowID p_window) {
	_THREAD_SAFE_METHOD_

	ERR_FAIL_COND(!windows.has(p_window));
	const WindowData &wd = windows[p_window];

	CoInitialize(0);
	CoCreateInstance(CLSID_TaskbarList, 0, CLSCTX_INPROC_SERVER, IID_ITaskbarList, (void **)&pTaskbar);
	pTaskbar->HrInit();

	pTaskbar->SetProgressValue(wd.hWnd, (ULONGLONG)p_value, (ULONGLONG)p_total);
}

void DisplayServerWindows::window_set_taskbar_progress_state(ProgressState p_state, WindowID p_window) {
	_THREAD_SAFE_METHOD_

	ERR_FAIL_COND(!windows.has(p_window));
	const WindowData &wd = windows[p_window];

	CoInitialize(0);
	CoCreateInstance(CLSID_TaskbarList, 0, CLSCTX_INPROC_SERVER, IID_ITaskbarList, (void **)&pTaskbar);
	pTaskbar->HrInit();

	TBPFLAG tbpf = TBPF_NOPROGRESS;
	switch (p_state) {
		case PROGRESS_STATE_NOPROGRESS:
			tbpf = TBPF_NOPROGRESS;
			break;
		case PROGRESS_STATE_INDETERMINATE:
			tbpf = TBPF_INDETERMINATE;
			break;
		case PROGRESS_STATE_ERROR:
			tbpf = TBPF_ERROR;
			break;
		case PROGRESS_STATE_PAUSED:
			tbpf = TBPF_PAUSED;
			break;
		case PROGRESS_STATE_NORMAL:
			tbpf = TBPF_NORMAL;
			break;
		default:
			break;
	}

	pTaskbar->SetProgressState(wd.hWnd, tbpf);
}

Review comment (performance):
Ideally `CoCreateInstance` can be called once lazily the first time you need the taskbar list API and then cached. You're already caching the `pTaskbar`, so all that's needed here is a null check. But other places in Godot aren't caching either, not sure if there's a reason or if it doesn't matter enough.

Code after:
			wd.mpass = p_enabled;
		} break;
		case WINDOW_FLAG_EXCLUDE_FROM_CAPTURE: {
			wd.hide_from_capture = p_enabled;
			if (p_enabled) {
				if (os_ver.dwBuildNumber >= 19041) {
					SetWindowDisplayAffinity(wd.hWnd, WDA_EXCLUDEFROMCAPTURE);
				} else {
					SetWindowDisplayAffinity(wd.hWnd, WDA_MONITOR);
				}
			} else {
				SetWindowDisplayAffinity(wd.hWnd, WDA_NONE);
			}
		} break;
		case WINDOW_FLAG_POPUP: {
			ERR_FAIL_COND_MSG(p_window == MAIN_WINDOW_ID, "Main window can't be popup.");
			ERR_FAIL_COND_MSG(IsWindowVisible(wd.hWnd) && (wd.is_popup != p_enabled), "Popup flag can't changed while window is opened.");
			if (p_enabled && wd.parent_hwnd) {
				print_line("Embedded window can't be popup.");
				return;
			}
			wd.is_popup = p_enabled;
		} break;
		default:
			break;
	}
}

bool DisplayServerWindows::window_get_flag(WindowFlags p_flag, WindowID p_window) const {
	_THREAD_SAFE_METHOD_

	ERR_FAIL_COND_V(!windows.has(p_window), false);
	const WindowData &wd = windows[p_window];
	switch (p_flag) {
		case WINDOW_FLAG_MAXIMIZE_DISABLED: {
			return wd.no_max_btn;
		} break;
		case WINDOW_FLAG_MINIMIZE_DISABLED: {
			return wd.no_min_btn;
		} break;
		case WINDOW_FLAG_RESIZE_DISABLED: {
			return !wd.resizable;
		} break;
		case WINDOW_FLAG_BORDERLESS: {
			return wd.borderless;
		} break;
		case WINDOW_FLAG_ALWAYS_ON_TOP: {
			return wd.always_on_top;
		} break;
		case WINDOW_FLAG_SHARP_CORNERS: {
			return wd.sharp_corners;