BenQ UNIVERSAL 144Hz->220Hz OVERCLOCK for 1080p 144 Hz

Talk about overclocking displays at a higher refresh rate. This includes homebrew, 165Hz, QNIX, Catleap, Overlord Tempest, SEIKI displays, certain HDTVs, and other overclockable displays.
komic0
Posts: 3
Joined: 29 Dec 2019, 04:40

Re: BenQ UNIVERSAL 144Hz->220Hz OVERCLOCK for 1080p 144 Hz

Post by komic0 » 01 Jan 2020, 09:09

Boomchakadah wrote:
31 Dec 2019, 15:19
Is there a tool that can be used to remove the annoying ''out of range'' error that gets overlayed on a successful overclock?
In my case, when I use monitor menu this message appears, for fix this problem I just "alt+tab" the game.
Boomchakadah wrote:
01 Jan 2020, 07:17
Did you forget to enable instant mode?
No, It is enable.

User avatar
Chief Blur Buster
Site Admin
Posts: 6689
Joined: 05 Dec 2013, 15:44

Re: BenQ UNIVERSAL 144Hz->220Hz OVERCLOCK for 1080p 144 Hz

Post by Chief Blur Buster » 01 Jan 2020, 17:38

Boomchakadah wrote:
31 Dec 2019, 15:19
Is there a tool that can be used to remove the annoying ''out of range'' error that gets overlayed on a successful overclock?
Yes, a forum member developed a tool.
viewtopic.php?f=8&t=5544&start=40#p42811

It's in GitHub too:
https://github.com/hleVqq/AntiOutOfRange

The software is quite simple:
1. Detect mode switch to high-Hz (e.g. 220 Hz)
2. Automatically transmit some DDC commands from PC to monitor, to force-dismiss the Out Of Range
3. Success
Head of Blur Busters - BlurBusters.com | TestUFO.com | Follow @BlurBusters on Twitter

       To support Blur Busters:
       • Official List of Best Gaming Monitors
       • List of G-SYNC Monitors
       • List of FreeSync Monitors
       • List of Ultrawide Monitors

komic0
Posts: 3
Joined: 29 Dec 2019, 04:40

Re: BenQ UNIVERSAL 144Hz->220Hz OVERCLOCK for 1080p 144 Hz

Post by komic0 » 07 Jan 2020, 11:51

chumacher wrote:
27 Dec 2019, 00:51
1440x1080 @ 240hz with ok colors works, but it's always in "stretched" mode, does any know how to prevent this?

Should I do something with CRU while creating the custom resolution. (porch etc settings, polarity and so on, what causes the GPU scaling to be active in 210hz but not in 240hz
Hi.
You must overclock your native resolution (1920 x 1080) in CRU,
and after that create and overclock 1440 x 1080 in CRU.
This will solve your problem.
Annotation 2020-01-07 201902.jpg
Annotation 2020-01-07 201902.jpg (73.8 KiB) Viewed 877 times

chumacher
Posts: 3
Joined: 10 Dec 2019, 22:23

Re: BenQ UNIVERSAL 144Hz->220Hz OVERCLOCK for 1080p 144 Hz

Post by chumacher » 10 Jan 2020, 18:14

komic0 wrote:
07 Jan 2020, 11:51
chumacher wrote:
27 Dec 2019, 00:51
1440x1080 @ 240hz with ok colors works, but it's always in "stretched" mode, does any know how to prevent this?

Should I do something with CRU while creating the custom resolution. (porch etc settings, polarity and so on, what causes the GPU scaling to be active in 210hz but not in 240hz
Hi.
You must overclock your native resolution (1920 x 1080) in CRU,
and after that create and overclock 1440 x 1080 in CRU.
This will solve your problem.

Annotation 2020-01-07 201902.jpg
Hi! thanks! it worked, 240hz is working with 1440x1080 but i have low quality mini displayport -> displayport cable, and the connection is lost after random amount of testing, what do you could better quality cable fix this? (in my cable it's not gold plated, could better quality cable solve this?)

Amoxap1ne
Posts: 2
Joined: 05 Mar 2019, 15:29

Re: BenQ UNIVERSAL 144Hz->220Hz OVERCLOCK for 1080p 144 Hz

Post by Amoxap1ne » 12 Jan 2020, 11:46

I have an issue with CRU because with it I got ycbcr422 limited for some reason, instead if I do it from the nvidia cotrol pannel everything looks kinda fine, any guess?

imPriDex
Posts: 1
Joined: 29 Jan 2020, 08:45

Re: BenQ UNIVERSAL 144Hz->220Hz OVERCLOCK for 1080p 144 Hz

Post by imPriDex » 29 Jan 2020, 09:03

Zowie XL2411, currently running 200hz with AMA @high via DVI! I have a question though, should I turn off AMA? Because I don't know if it causes input lag... I checked Frame Skipping and Strobe Crosstalk and it looks blurrier with it off, the only downside of using it at high that I can see is a bit of tearing at the top half of the screen (not really noticeable while playing). I'm also using movie preset with 50 brightness/contrast, Sharpness 5 and RGB at 100. Thanks in advance! :D

User avatar
Chief Blur Buster
Site Admin
Posts: 6689
Joined: 05 Dec 2013, 15:44

Re: BenQ UNIVERSAL 144Hz->220Hz OVERCLOCK for 1080p 144 Hz

Post by Chief Blur Buster » 29 Jan 2020, 12:12

As far as I know, AMA is processed in realtime, so turning on AMA won't add lag.

Overdrive processing in modern gaming monitors do not add lag, as they rely on simple lookbehind processing.
Head of Blur Busters - BlurBusters.com | TestUFO.com | Follow @BlurBusters on Twitter

       To support Blur Busters:
       • Official List of Best Gaming Monitors
       • List of G-SYNC Monitors
       • List of FreeSync Monitors
       • List of Ultrawide Monitors

User avatar
hleV
Posts: 54
Joined: 27 May 2017, 10:31

Re: BenQ UNIVERSAL 144Hz->220Hz OVERCLOCK for 1080p 144 Hz

Post by hleV » 29 Jan 2020, 12:30

(This was posted on the wrong thread, so re-posting this where it belongs.)

In case anyone needs it, here's a slightly updated OOR Buster (V1.4). Been using it for over a week now and it seems to work well. I couldn't be bothered to upload the whole Visual Studio project to GitHub (I'm updating and compiling the code on work PC) but here's the binary:
https://github.com/hleVqq/OorBuster/rel ... Buster.exe
Mirror: https://we.tl/t-yF8K0egzvB

Changelogs:

Code: Select all

1.1

- Alt + Home hotkey added.

Code: Select all

1.2

- Added previous/next picture mode buttons.

Code: Select all

1.3

- Added monitor handle re-check for most scenarios
- Reload button now removes the Out of Range notification if present
- Removes other "OorBuster.exe" instance(s) upon launch

Code: Select all

1.4

- Fixed current monitor settings not being read before applying fix on app launch
- When removing other instances, it will check for current file name rather than hardcoded "OorBuster.exe"
- Removed initial delay when using Alt + Home hotkey
In order to start OOR Buster upon boot faster, use Windows' Task Scheduler and create a basic task:
  • Name: OOR Buster
  • Trigger: When I log on
  • Action: Start a program
  • specify path and optional params
C++ code (covers most of the program except resources code generated by Visual Studio):

Code: Select all

#include <Windows.h>
#include <tchar.h>
#include <shellapi.h>
#include <lowlevelmonitorconfigurationapi.h>
#include <string>
#include <Tlhelp32.h>

#include "resource.h"

const BYTE VCP_OSD_LANGUAGE = 0xCC;
const BYTE VCP_PICTURE_MODE = 0xDC;
const BYTE VCP_AMA = 0xF0;

enum
{
	WM_APP_RELOAD = WM_APP + 1,
	WM_APP_EXIT,
	WM_APP_NEXT_MODE,
	WM_APP_PREV_MODE
};

DWORD CachedOsdLanguage = 2;
DWORD CachedPictureMode = 0;
DWORD CachedAma = 1;

DWORD OorDelay = 2000;
DWORD PicDelay = 500;
DWORD AmaDelay = 250;
DWORD WakeDelay = 3000;

NOTIFYICONDATA TrayIcon;
HANDLE Monitor;

int GetRefreshRate()
{
	DEVMODE dm;
	dm.dmSize = sizeof(DEVMODE);
	EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &dm);

	return dm.dmDisplayFrequency;
}

HANDLE GetPhysicalMonitor()
{
	HMONITOR monitor = MonitorFromWindow(GetActiveWindow(), MONITOR_DEFAULTTOPRIMARY);
	LPPHYSICAL_MONITOR monitors = (LPPHYSICAL_MONITOR)malloc(sizeof(PHYSICAL_MONITOR));
	HANDLE pm = nullptr;

	if (monitors && GetPhysicalMonitorsFromHMONITOR(monitor, 1, monitors))
		pm = monitors[0].hPhysicalMonitor;

	free(monitors);

	return pm;
}

void CachePhysicalMonitor()
{
	Monitor = GetPhysicalMonitor();
}

void CacheVcpValues()
{
	GetVCPFeatureAndVCPFeatureReply(Monitor, VCP_OSD_LANGUAGE, NULL, &CachedOsdLanguage, NULL);
	GetVCPFeatureAndVCPFeatureReply(Monitor, VCP_PICTURE_MODE, NULL, &CachedPictureMode, NULL);
	GetVCPFeatureAndVCPFeatureReply(Monitor, VCP_AMA, NULL, &CachedAma, NULL);
}

void ReadLaunchParams()
{
	int argCount;
	LPWSTR* args = CommandLineToArgvW(GetCommandLine(), &argCount);

	if (args && argCount > 1)
	{
		OorDelay = (DWORD)wcstod(args[1], L'\0');
		PicDelay = (DWORD)wcstod(args[2], L'\0');
		AmaDelay = (DWORD)wcstod(args[3], L'\0');
		WakeDelay = (DWORD)wcstod(args[4], L'\0');
	}
}

inline void FixOor() {SetVCPFeature(Monitor, VCP_OSD_LANGUAGE, CachedOsdLanguage);}
inline void FixPic() {SetVCPFeature(Monitor, VCP_PICTURE_MODE, CachedPictureMode);}
inline void FixAma() {SetVCPFeature(Monitor, VCP_AMA, CachedAma);}

void NextMode()
{
	CachePhysicalMonitor();
	CacheVcpValues();
	CachedPictureMode++;
	FixPic();
}

void PrevMode()
{
	CachePhysicalMonitor();
	CacheVcpValues();
	CachedPictureMode--;
	FixPic();
}

void ApplyVcpValues(bool wake = false)
{
	if (GetRefreshRate() <= 144)
		return;

	if (wake)
		Sleep(WakeDelay);

	Sleep(OorDelay); FixOor();
	Sleep(PicDelay); FixPic();
	Sleep(AmaDelay); FixAma();
}

void ShowTrayMenu(HWND wnd)
{
	POINT pos;
	GetCursorPos(&pos);

	HMENU menu = CreatePopupMenu();
	InsertMenu(menu, -1, MF_BYPOSITION, WM_APP_RELOAD, L"Reload");
	InsertMenu(menu, -1, MF_BYPOSITION, WM_APP_NEXT_MODE, L"Next Mode");
	InsertMenu(menu, -1, MF_BYPOSITION, WM_APP_PREV_MODE, L"Prev Mode");
	InsertMenu(menu, -1, MF_BYPOSITION, WM_APP_EXIT, L"Exit");
	SetForegroundWindow(wnd);
	TrackPopupMenu(menu, TPM_BOTTOMALIGN, pos.x, pos.y, 0, wnd, NULL);
	DestroyMenu(menu);
}

LRESULT CALLBACK WindowProc(_In_ HWND wnd, _In_ UINT msg, _In_ WPARAM wParam, _In_ LPARAM lParam)
{
	switch (msg)
	{
	case WM_DISPLAYCHANGE:
		CachePhysicalMonitor();
		ApplyVcpValues();

		break;
	case WM_POWERBROADCAST:
		if (wParam == PBT_POWERSETTINGCHANGE)
		{
			const DWORD DISPLAY_ON = 0x1;

			POWERBROADCAST_SETTING* pbs = (POWERBROADCAST_SETTING *)lParam;
			DWORD status = *(DWORD*)(pbs->Data);

			if (status == DISPLAY_ON)
			{
				CachePhysicalMonitor();
				ApplyVcpValues(true);
			}
		}

		break;
	case WM_APP:
		switch (lParam)
		{
		case WM_RBUTTONDOWN:
		case WM_CONTEXTMENU:
			ShowTrayMenu(wnd);

			break;
		}

		break;
	case WM_COMMAND:
		switch (LOWORD(wParam))
		{
		case WM_APP_RELOAD:
			CachePhysicalMonitor();
			FixOor();
			CacheVcpValues();

			break;
		case WM_APP_NEXT_MODE:
			NextMode();
			break;
		case WM_APP_PREV_MODE:
			PrevMode();
			break;
		case WM_APP_EXIT:
			Shell_NotifyIcon(NIM_DELETE, &TrayIcon);
			PostQuitMessage(0);

			break;
		}

		break;
	case WM_DESTROY:
		Shell_NotifyIcon(NIM_DELETE, &TrayIcon);
		PostQuitMessage(0);

		break;
	case WM_HOTKEY:
		switch (wParam)
		{
		case 1000:
			{
				OutputDebugString(L"[DEBUG] HOTKEY!\n");
				CachePhysicalMonitor();

				DWORD origOorDelay = OorDelay;
				OorDelay = 0;
				ApplyVcpValues();
				OorDelay = origOorDelay;
			}

			break;
		}
	}

	return DefWindowProc(wnd, msg, wParam, lParam);
}

HWND CreateMainWindow(HINSTANCE instance)
{
	WNDCLASS wc = { };
	wc.lpfnWndProc = WindowProc;
	wc.hInstance = instance;
	wc.lpszClassName = L"Main";
	RegisterClass(&wc);

	HWND wnd = CreateWindow(L"Main", L"OOR Buster", WS_OVERLAPPEDWINDOW & ~WS_SIZEBOX & ~WS_MAXIMIZEBOX, CW_USEDEFAULT, CW_USEDEFAULT, 0, 0, NULL, NULL, instance, NULL);

	return wnd;
}

void CreateTrayIcon(HWND wnd, HICON icon)
{
	ZeroMemory(&TrayIcon, sizeof(NOTIFYICONDATA));
	TrayIcon.cbSize = sizeof(NOTIFYICONDATA);
	TrayIcon.uID = 1;
	TrayIcon.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP;
	TrayIcon.hIcon = icon;
	TrayIcon.hWnd = wnd;
	TrayIcon.uCallbackMessage = WM_APP;
	wcscpy_s(TrayIcon.szTip, L"OOR Buster");
	Shell_NotifyIcon(NIM_ADD, &TrayIcon);
}

void KillOtherInstances()
{
	DWORD id = GetCurrentProcessId();

	WCHAR path[MAX_PATH]; 
	GetModuleFileName(NULL, path, MAX_PATH);

	WCHAR file[_MAX_FNAME]; 
	_wsplitpath_s(path, NULL, 0, NULL, 0, file, ARRAYSIZE(file), NULL, 0); 
	wcscat_s(file, ARRAYSIZE(file), L".exe");

	HANDLE snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPALL, NULL);

	PROCESSENTRY32 entry; 
	entry.dwSize = sizeof(entry);

	for (BOOL res = Process32First(snapshot, &entry); res; res = Process32Next(snapshot, &entry))
	{
		if (wcscmp(entry.szExeFile, file) == 0)
		{
			HANDLE process = OpenProcess(PROCESS_TERMINATE, FALSE, entry.th32ProcessID);

			if (process != nullptr && entry.th32ProcessID != id)
			{
				TerminateProcess(process, 9);
				CloseHandle(process);
			}
		}
	}

	CloseHandle(snapshot);
}

int WINAPI WinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE, _In_ LPSTR, _In_ int)
{
	KillOtherInstances();
	CachePhysicalMonitor();
	CacheVcpValues();
	ReadLaunchParams();

	HWND wnd = CreateMainWindow(instance);
	CreateTrayIcon(wnd, LoadIcon(instance, MAKEINTRESOURCE(IDI_ICON1)));
	RegisterPowerSettingNotification(wnd, &GUID_CONSOLE_DISPLAY_STATE, DEVICE_NOTIFY_WINDOW_HANDLE);
	RegisterHotKey(wnd, 1000, MOD_ALT, VK_HOME);

	MSG msg;

	while (GetMessage(&msg, nullptr, 0, 0))
	{
		TranslateMessage(&msg);
		DispatchMessage(&msg);
	}

	return (int)msg.wParam;
}
Last edited by hleV on 16 Feb 2020, 06:58, edited 1 time in total.

The_System
Posts: 3
Joined: 08 Feb 2019, 04:55

Re: BenQ UNIVERSAL 144Hz->220Hz OVERCLOCK for 1080p 144 Hz

Post by The_System » 30 Jan 2020, 11:49

hleV wrote:
29 Jan 2020, 12:30
(This was posted on the wrong thread, so re-posting this where it belongs.)

In case anyone needs it, here's a slightly updated OOR Buster (V1.4). Been using it for over a week now and it seems to work well. I couldn't be bothered to upload the whole Visual Studio project to GitHub (I'm updating and compiling the code on work PC) but here's the binary:
https://github.com/hleVqq/OorBuster/rel ... Buster.exe

Changelogs:

Code: Select all

1.1

- Alt + Home hotkey added.

Code: Select all

1.2

- Added previous/next picture mode buttons.

Code: Select all

1.3

- Added monitor handle re-check for most scenarios
- Reload button now removes the Out of Range notification if present
- Removes other "OorBuster.exe" instance(s) upon launch

Code: Select all

1.4

- Fixed current monitor settings not being read before applying fix on app launch
- When removing other instances, it will check for current file name rather than hardcoded "OorBuster.exe"
- Removed initial delay when using Alt + Home hotkey
In order to start OOR Buster upon boot faster, use Windows' Task Scheduler and create a basic task:
  • Name: OOR Buster
  • Trigger: When I log on
  • Action: Start a program
  • specify path and optional params
C++ code (covers most of the program except resources code generated by Visual Studio):

Code: Select all

#include <Windows.h>
#include <tchar.h>
#include <shellapi.h>
#include <lowlevelmonitorconfigurationapi.h>
#include <string>
#include <Tlhelp32.h>

#include "resource.h"

const BYTE VCP_OSD_LANGUAGE = 0xCC;
const BYTE VCP_PICTURE_MODE = 0xDC;
const BYTE VCP_AMA = 0xF0;

enum
{
	WM_APP_RELOAD = WM_APP + 1,
	WM_APP_EXIT,
	WM_APP_NEXT_MODE,
	WM_APP_PREV_MODE
};

DWORD CachedOsdLanguage = 2;
DWORD CachedPictureMode = 0;
DWORD CachedAma = 1;

DWORD OorDelay = 2000;
DWORD PicDelay = 500;
DWORD AmaDelay = 250;
DWORD WakeDelay = 3000;

NOTIFYICONDATA TrayIcon;
HANDLE Monitor;

int GetRefreshRate()
{
	DEVMODE dm;
	dm.dmSize = sizeof(DEVMODE);
	EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &dm);

	return dm.dmDisplayFrequency;
}

HANDLE GetPhysicalMonitor()
{
	HMONITOR monitor = MonitorFromWindow(GetActiveWindow(), MONITOR_DEFAULTTOPRIMARY);
	LPPHYSICAL_MONITOR monitors = (LPPHYSICAL_MONITOR)malloc(sizeof(PHYSICAL_MONITOR));
	HANDLE pm = nullptr;

	if (monitors && GetPhysicalMonitorsFromHMONITOR(monitor, 1, monitors))
		pm = monitors[0].hPhysicalMonitor;

	free(monitors);

	return pm;
}

void CachePhysicalMonitor()
{
	Monitor = GetPhysicalMonitor();
}

void CacheVcpValues()
{
	GetVCPFeatureAndVCPFeatureReply(Monitor, VCP_OSD_LANGUAGE, NULL, &CachedOsdLanguage, NULL);
	GetVCPFeatureAndVCPFeatureReply(Monitor, VCP_PICTURE_MODE, NULL, &CachedPictureMode, NULL);
	GetVCPFeatureAndVCPFeatureReply(Monitor, VCP_AMA, NULL, &CachedAma, NULL);
}

void ReadLaunchParams()
{
	int argCount;
	LPWSTR* args = CommandLineToArgvW(GetCommandLine(), &argCount);

	if (args && argCount > 1)
	{
		OorDelay = (DWORD)wcstod(args[1], L'\0');
		PicDelay = (DWORD)wcstod(args[2], L'\0');
		AmaDelay = (DWORD)wcstod(args[3], L'\0');
		WakeDelay = (DWORD)wcstod(args[4], L'\0');
	}
}

inline void FixOor() {SetVCPFeature(Monitor, VCP_OSD_LANGUAGE, CachedOsdLanguage);}
inline void FixPic() {SetVCPFeature(Monitor, VCP_PICTURE_MODE, CachedPictureMode);}
inline void FixAma() {SetVCPFeature(Monitor, VCP_AMA, CachedAma);}

void NextMode()
{
	CachePhysicalMonitor();
	CacheVcpValues();
	CachedPictureMode++;
	FixPic();
}

void PrevMode()
{
	CachePhysicalMonitor();
	CacheVcpValues();
	CachedPictureMode--;
	FixPic();
}

void ApplyVcpValues(bool wake = false)
{
	if (GetRefreshRate() <= 144)
		return;

	if (wake)
		Sleep(WakeDelay);

	Sleep(OorDelay); FixOor();
	Sleep(PicDelay); FixPic();
	Sleep(AmaDelay); FixAma();
}

void ShowTrayMenu(HWND wnd)
{
	POINT pos;
	GetCursorPos(&pos);

	HMENU menu = CreatePopupMenu();
	InsertMenu(menu, -1, MF_BYPOSITION, WM_APP_RELOAD, L"Reload");
	InsertMenu(menu, -1, MF_BYPOSITION, WM_APP_NEXT_MODE, L"Next Mode");
	InsertMenu(menu, -1, MF_BYPOSITION, WM_APP_PREV_MODE, L"Prev Mode");
	InsertMenu(menu, -1, MF_BYPOSITION, WM_APP_EXIT, L"Exit");
	SetForegroundWindow(wnd);
	TrackPopupMenu(menu, TPM_BOTTOMALIGN, pos.x, pos.y, 0, wnd, NULL);
	DestroyMenu(menu);
}

LRESULT CALLBACK WindowProc(_In_ HWND wnd, _In_ UINT msg, _In_ WPARAM wParam, _In_ LPARAM lParam)
{
	switch (msg)
	{
	case WM_DISPLAYCHANGE:
		CachePhysicalMonitor();
		ApplyVcpValues();

		break;
	case WM_POWERBROADCAST:
		if (wParam == PBT_POWERSETTINGCHANGE)
		{
			const DWORD DISPLAY_ON = 0x1;

			POWERBROADCAST_SETTING* pbs = (POWERBROADCAST_SETTING *)lParam;
			DWORD status = *(DWORD*)(pbs->Data);

			if (status == DISPLAY_ON)
			{
				CachePhysicalMonitor();
				ApplyVcpValues(true);
			}
		}

		break;
	case WM_APP:
		switch (lParam)
		{
		case WM_RBUTTONDOWN:
		case WM_CONTEXTMENU:
			ShowTrayMenu(wnd);

			break;
		}

		break;
	case WM_COMMAND:
		switch (LOWORD(wParam))
		{
		case WM_APP_RELOAD:
			CachePhysicalMonitor();
			FixOor();
			CacheVcpValues();

			break;
		case WM_APP_NEXT_MODE:
			NextMode();
			break;
		case WM_APP_PREV_MODE:
			PrevMode();
			break;
		case WM_APP_EXIT:
			Shell_NotifyIcon(NIM_DELETE, &TrayIcon);
			PostQuitMessage(0);

			break;
		}

		break;
	case WM_DESTROY:
		Shell_NotifyIcon(NIM_DELETE, &TrayIcon);
		PostQuitMessage(0);

		break;
	case WM_HOTKEY:
		switch (wParam)
		{
		case 1000:
			{
				OutputDebugString(L"[DEBUG] HOTKEY!\n");
				CachePhysicalMonitor();

				DWORD origOorDelay = OorDelay;
				OorDelay = 0;
				ApplyVcpValues();
				OorDelay = origOorDelay;
			}

			break;
		}
	}

	return DefWindowProc(wnd, msg, wParam, lParam);
}

HWND CreateMainWindow(HINSTANCE instance)
{
	WNDCLASS wc = { };
	wc.lpfnWndProc = WindowProc;
	wc.hInstance = instance;
	wc.lpszClassName = L"Main";
	RegisterClass(&wc);

	HWND wnd = CreateWindow(L"Main", L"OOR Buster", WS_OVERLAPPEDWINDOW & ~WS_SIZEBOX & ~WS_MAXIMIZEBOX, CW_USEDEFAULT, CW_USEDEFAULT, 0, 0, NULL, NULL, instance, NULL);

	return wnd;
}

void CreateTrayIcon(HWND wnd, HICON icon)
{
	ZeroMemory(&TrayIcon, sizeof(NOTIFYICONDATA));
	TrayIcon.cbSize = sizeof(NOTIFYICONDATA);
	TrayIcon.uID = 1;
	TrayIcon.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP;
	TrayIcon.hIcon = icon;
	TrayIcon.hWnd = wnd;
	TrayIcon.uCallbackMessage = WM_APP;
	wcscpy_s(TrayIcon.szTip, L"OOR Buster");
	Shell_NotifyIcon(NIM_ADD, &TrayIcon);
}

void KillOtherInstances()
{
	DWORD id = GetCurrentProcessId();

	WCHAR path[MAX_PATH]; 
	GetModuleFileName(NULL, path, MAX_PATH);

	WCHAR file[_MAX_FNAME]; 
	_wsplitpath_s(path, NULL, 0, NULL, 0, file, ARRAYSIZE(file), NULL, 0); 
	wcscat_s(file, ARRAYSIZE(file), L".exe");

	HANDLE snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPALL, NULL);

	PROCESSENTRY32 entry; 
	entry.dwSize = sizeof(entry);

	for (BOOL res = Process32First(snapshot, &entry); res; res = Process32Next(snapshot, &entry))
	{
		if (wcscmp(entry.szExeFile, file) == 0)
		{
			HANDLE process = OpenProcess(PROCESS_TERMINATE, FALSE, entry.th32ProcessID);

			if (process != nullptr && entry.th32ProcessID != id)
			{
				TerminateProcess(process, 9);
				CloseHandle(process);
			}
		}
	}

	CloseHandle(snapshot);
}

int WINAPI WinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE, _In_ LPSTR, _In_ int)
{
	KillOtherInstances();
	CachePhysicalMonitor();
	CacheVcpValues();
	ReadLaunchParams();

	HWND wnd = CreateMainWindow(instance);
	CreateTrayIcon(wnd, LoadIcon(instance, MAKEINTRESOURCE(IDI_ICON1)));
	RegisterPowerSettingNotification(wnd, &GUID_CONSOLE_DISPLAY_STATE, DEVICE_NOTIFY_WINDOW_HANDLE);
	RegisterHotKey(wnd, 1000, MOD_ALT, VK_HOME);

	MSG msg;

	while (GetMessage(&msg, nullptr, 0, 0))
	{
		TranslateMessage(&msg);
		DispatchMessage(&msg);
	}

	return (int)msg.wParam;
}
The link is not working

User avatar
Chief Blur Buster
Site Admin
Posts: 6689
Joined: 05 Dec 2013, 15:44

Re: BenQ UNIVERSAL 144Hz->220Hz OVERCLOCK for 1080p 144 Hz

Post by Chief Blur Buster » 30 Jan 2020, 13:33

hleV wrote:
29 Jan 2020, 12:30
(This was posted on the wrong thread, so re-posting this where it belongs.)
For various reasons, two threads were created, one being the sequel to the other -- back at the time there were good reasons.
Unfortunately the two threads are a bit fuzzied into each other --

I may close (one of them) or merge (both) the threads later -- to reduce confusion -- but there are cons of either route. So right now it is okay for you to crosspost high-importance information/software (new breakthroughs, important utilities) in both threads for now until these threads' final "happily ever after" destiny is humbly knighted unto them.
Head of Blur Busters - BlurBusters.com | TestUFO.com | Follow @BlurBusters on Twitter

       To support Blur Busters:
       • Official List of Best Gaming Monitors
       • List of G-SYNC Monitors
       • List of FreeSync Monitors
       • List of Ultrawide Monitors

Post Reply