51
General (but related to Code::Blocks) / Re: Display resolution issue
« Last post by ollydbg on March 07, 2026, 07:56:37 am »AI helps:
I can compile and run the program under msys2/mingw64/gcc.
Code
#include <windows.h>
#include <iostream>
typedef HRESULT (WINAPI *GetIntegratedDisplaySize_t)(double*);
int main()
{
HMODULE hKernelBase = LoadLibraryW(L"kernelbase.dll");
if (!hKernelBase)
{
std::wcout << L"Failed to load kernelbase.dll\n";
return 1;
}
auto GetIntegratedDisplaySize =
(GetIntegratedDisplaySize_t)GetProcAddress(
hKernelBase,
"GetIntegratedDisplaySize"
);
if (!GetIntegratedDisplaySize)
{
std::wcout << L"API not available\n";
return 1;
}
double size = 0.0;
HRESULT hr = GetIntegratedDisplaySize(&size);
if (SUCCEEDED(hr))
{
std::wcout << L"Integrated display size: "
<< size
<< L" inches\n";
}
FreeLibrary(hKernelBase);
}
I can compile and run the program under msys2/mingw64/gcc.
Recent Posts
It's a solution given by chatgpt to solve this building problem: