Click here to Skip to main content
15,844,011 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: "value optimized out " C++ error Pin
Richard Andrew x6418-Oct-23 15:38
professionalRichard Andrew x6418-Oct-23 15:38 
QuestionBuilding .dll files using Makefile Pin
JohnCodding13-Oct-23 0:59
JohnCodding13-Oct-23 0:59 
AnswerRe: Building .dll files using Makefile Pin
Mircea Neacsu13-Oct-23 1:31
Mircea Neacsu13-Oct-23 1:31 
GeneralRe: Building .dll files using Makefile Pin
JohnCodding13-Oct-23 1:59
JohnCodding13-Oct-23 1:59 
GeneralRe: Building .dll files using Makefile Pin
Mircea Neacsu13-Oct-23 2:21
Mircea Neacsu13-Oct-23 2:21 
GeneralRe: Building .dll files using Makefile Pin
JohnCodding13-Oct-23 7:13
JohnCodding13-Oct-23 7:13 
AnswerRe: Building .dll files using Makefile Pin
JohnCodding14-Oct-23 2:00
JohnCodding14-Oct-23 2:00 
QuestionGetVCPFeatureAndVCPFeatureReply fails when called Pin
Valentinor10-Oct-23 5:17
Valentinor10-Oct-23 5:17 
I was trying to get gamma value of monitor using GetVCPFeatureAndVCPFeatureReply[^] to have the default value, and later when using SetVCPFeature[^] to be able to revert to it. But when GetVCPFeatureAndVCPFeatureReply is called, it fails. What am I doing wrong? Here is the code test:

C++
#include <Windows.h>
#include <lowlevelmonitorconfigurationapi.h>
#include <iostream>
#include <chrono>
#include <thread>

#pragma comment(lib, "Dxva2.lib")

int main() {
	// Time to click on a different window to test on multiple monitors
	std::this_thread::sleep_for(std::chrono::milliseconds(2000));
	HWND hwnd = GetForegroundWindow();

	HMONITOR hMonitor = NULL;
	DWORD cPhysicalMonitors;
	LPPHYSICAL_MONITOR pPhysicalMonitors = NULL;

	hMonitor = MonitorFromWindow(hwnd, MONITOR_DEFAULTTONEAREST);

	BOOL bSuccess = GetNumberOfPhysicalMonitorsFromHMONITOR(hMonitor, &cPhysicalMonitors);
	if (bSuccess) {
		pPhysicalMonitors = (LPPHYSICAL_MONITOR)malloc(cPhysicalMonitors * sizeof(PHYSICAL_MONITOR));
		if (pPhysicalMonitors != NULL) {
			bSuccess = GetPhysicalMonitorsFromHMONITOR(hMonitor, cPhysicalMonitors, pPhysicalMonitors);
			if (bSuccess) {
				DWORD pdwCurrentValue;
				DWORD pdwMaximumValue;
				bSuccess = GetVCPFeatureAndVCPFeatureReply(pPhysicalMonitors->hPhysicalMonitor, 0x72, NULL, &pdwCurrentValue, &pdwMaximumValue);
				if (bSuccess) {
					std::cout << "Current value: " << pdwCurrentValue << " | MaximumValue: " << pdwMaximumValue;
				}
				else {
					std::cout << "Failed GetVCPFeatureAndVCPFeatureReply" << std::endl;
				}
			}
			else {
				std::cout << "Failed GetPhysicalMonitorsFromHMONITOR" << std::endl;
			}

			DestroyPhysicalMonitors(cPhysicalMonitors, pPhysicalMonitors);
			free(pPhysicalMonitors);
		}
		else {
			std::cout << "Is null" << std::endl;
		}
	}
	else {
		std::cout << "Failed GetNumberOfPhysicalMonitorsFromHMONITOR" << std::endl;
	}

	return 0;
}

QuestionRe: GetVCPFeatureAndVCPFeatureReply fails when called Pin
CPallini10-Oct-23 5:22
mveCPallini10-Oct-23 5:22 
AnswerRe: GetVCPFeatureAndVCPFeatureReply fails when called Pin
Valentinor10-Oct-23 5:29
Valentinor10-Oct-23 5:29 
GeneralRe: GetVCPFeatureAndVCPFeatureReply fails when called Pin
CPallini10-Oct-23 5:53
mveCPallini10-Oct-23 5:53 
GeneralRe: GetVCPFeatureAndVCPFeatureReply fails when called Pin
Valentinor10-Oct-23 7:51
Valentinor10-Oct-23 7:51 
QuestionI'm looking for review in terms of readability, approachability of this code Pin
honey the codewitch4-Oct-23 15:37
mvahoney the codewitch4-Oct-23 15:37 
AnswerRe: I'm looking for review in terms of readability, approachability of this code Pin
Gerry Schmitz4-Oct-23 19:32
mveGerry Schmitz4-Oct-23 19:32 
GeneralRe: I'm looking for review in terms of readability, approachability of this code Pin
honey the codewitch5-Oct-23 0:36
mvahoney the codewitch5-Oct-23 0:36 
GeneralRe: I'm looking for review in terms of readability, approachability of this code Pin
Gerry Schmitz5-Oct-23 6:51
mveGerry Schmitz5-Oct-23 6:51 
AnswerRe: I'm looking for review in terms of readability, approachability of this code Pin
Richard MacCutchan4-Oct-23 21:52
mveRichard MacCutchan4-Oct-23 21:52 
GeneralRe: I'm looking for review in terms of readability, approachability of this code Pin
honey the codewitch5-Oct-23 0:31
mvahoney the codewitch5-Oct-23 0:31 
AnswerRe: I'm looking for review in terms of readability, approachability of this code Pin
jschell5-Oct-23 6:28
jschell5-Oct-23 6:28 
GeneralRe: I'm looking for review in terms of readability, approachability of this code Pin
honey the codewitch5-Oct-23 6:30
mvahoney the codewitch5-Oct-23 6:30 
GeneralRe: I'm looking for review in terms of readability, approachability of this code Pin
honey the codewitch5-Oct-23 6:55
mvahoney the codewitch5-Oct-23 6:55 
GeneralRe: I'm looking for review in terms of readability, approachability of this code Pin
k50545-Oct-23 7:35
mvek50545-Oct-23 7:35 
GeneralRe: I'm looking for review in terms of readability, approachability of this code Pin
Gerry Schmitz5-Oct-23 8:54
mveGerry Schmitz5-Oct-23 8:54 
GeneralRe: I'm looking for review in terms of readability, approachability of this code Pin
Richard MacCutchan5-Oct-23 22:46
mveRichard MacCutchan5-Oct-23 22:46 
GeneralRe: I'm looking for review in terms of readability, approachability of this code Pin
jschell6-Oct-23 8:12
jschell6-Oct-23 8:12 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.