Accessing MONITORINFOEX values in Visual C++










-1















I'm perplexed trying to retrieve MONITORINFOEX values. I tried:



typedef struct tagMONITORINFO 
DWORD cbSize;
RECT rcMonitor;
RECT rcWork;
DWORD dwFlags;
MONITORINFO, *LPMONITORINFO;
typedef struct tagMONITORINFOEX
CHAR szDevice[CCHDEVICENAME];
MONITORINFO tagMONITORINFO;
MONITORINFOEX, *LPMONITORINFOEX;
MONITORINFOEX miea;
miea.tagMONITORINFO.cbSize = sizeof(MONITORINFOEX);
GetMonitorInfo(hMonitor, (&miea));


to no avail. I modified the last line to:



GetMonitorInfo(hMonitor, ((LPMONITORINFO) &miea));


again, no luck. I get compiler messages about the 2nd parameter of GetMonitorInfo.



Perhaps my recent inexperience with C++ is showing.



Thanks in advance for any help you may provide.










share|improve this question

















  • 1





    Why do you redefine the structures? Why not include the proper Windows header files and use the standard structures? And what is your problem with the code you show? Do you get build errors? Runtime errors or crashes? Invalid results?

    – Some programmer dude
    Nov 13 '18 at 13:20











  • I get compiler messages about the 2nd parameter of GetMonitorInfo. Add the error messages to the question.

    – Johnny Mopp
    Nov 13 '18 at 13:24











  • your definition of MONITORINFOEX is wrong. and anyway - it defined in MultiMon.h - struct tagMONITORINFOEXA : public tagMONITORINFO CHAR szDevice[CCHDEVICENAME]; MONITORINFOEXA, *LPMONITORINFOEXA;

    – RbMm
    Nov 13 '18 at 13:32











  • @som: It's only a redefinition, if you actually include the header files that define the structures. While common, there are reasons why you'd want to define those structures yourself. A library may not want to #include <Windows.h>, and rather define what it needs. C++/WinRT recently removed the dependency on Windows.h, for example.

    – IInspectable
    Nov 13 '18 at 17:04











  • @IInspectable It would be a redefinition if the structures were a byte-by-byte, character by character, exact duplicate. Otherwise it's undefined behavior as it breaks the one definition rule. And in this case it apparently isn't exact duplicates.

    – Some programmer dude
    Nov 13 '18 at 17:28
















-1















I'm perplexed trying to retrieve MONITORINFOEX values. I tried:



typedef struct tagMONITORINFO 
DWORD cbSize;
RECT rcMonitor;
RECT rcWork;
DWORD dwFlags;
MONITORINFO, *LPMONITORINFO;
typedef struct tagMONITORINFOEX
CHAR szDevice[CCHDEVICENAME];
MONITORINFO tagMONITORINFO;
MONITORINFOEX, *LPMONITORINFOEX;
MONITORINFOEX miea;
miea.tagMONITORINFO.cbSize = sizeof(MONITORINFOEX);
GetMonitorInfo(hMonitor, (&miea));


to no avail. I modified the last line to:



GetMonitorInfo(hMonitor, ((LPMONITORINFO) &miea));


again, no luck. I get compiler messages about the 2nd parameter of GetMonitorInfo.



Perhaps my recent inexperience with C++ is showing.



Thanks in advance for any help you may provide.










share|improve this question

















  • 1





    Why do you redefine the structures? Why not include the proper Windows header files and use the standard structures? And what is your problem with the code you show? Do you get build errors? Runtime errors or crashes? Invalid results?

    – Some programmer dude
    Nov 13 '18 at 13:20











  • I get compiler messages about the 2nd parameter of GetMonitorInfo. Add the error messages to the question.

    – Johnny Mopp
    Nov 13 '18 at 13:24











  • your definition of MONITORINFOEX is wrong. and anyway - it defined in MultiMon.h - struct tagMONITORINFOEXA : public tagMONITORINFO CHAR szDevice[CCHDEVICENAME]; MONITORINFOEXA, *LPMONITORINFOEXA;

    – RbMm
    Nov 13 '18 at 13:32











  • @som: It's only a redefinition, if you actually include the header files that define the structures. While common, there are reasons why you'd want to define those structures yourself. A library may not want to #include <Windows.h>, and rather define what it needs. C++/WinRT recently removed the dependency on Windows.h, for example.

    – IInspectable
    Nov 13 '18 at 17:04











  • @IInspectable It would be a redefinition if the structures were a byte-by-byte, character by character, exact duplicate. Otherwise it's undefined behavior as it breaks the one definition rule. And in this case it apparently isn't exact duplicates.

    – Some programmer dude
    Nov 13 '18 at 17:28














-1












-1








-1








I'm perplexed trying to retrieve MONITORINFOEX values. I tried:



typedef struct tagMONITORINFO 
DWORD cbSize;
RECT rcMonitor;
RECT rcWork;
DWORD dwFlags;
MONITORINFO, *LPMONITORINFO;
typedef struct tagMONITORINFOEX
CHAR szDevice[CCHDEVICENAME];
MONITORINFO tagMONITORINFO;
MONITORINFOEX, *LPMONITORINFOEX;
MONITORINFOEX miea;
miea.tagMONITORINFO.cbSize = sizeof(MONITORINFOEX);
GetMonitorInfo(hMonitor, (&miea));


to no avail. I modified the last line to:



GetMonitorInfo(hMonitor, ((LPMONITORINFO) &miea));


again, no luck. I get compiler messages about the 2nd parameter of GetMonitorInfo.



Perhaps my recent inexperience with C++ is showing.



Thanks in advance for any help you may provide.










share|improve this question














I'm perplexed trying to retrieve MONITORINFOEX values. I tried:



typedef struct tagMONITORINFO 
DWORD cbSize;
RECT rcMonitor;
RECT rcWork;
DWORD dwFlags;
MONITORINFO, *LPMONITORINFO;
typedef struct tagMONITORINFOEX
CHAR szDevice[CCHDEVICENAME];
MONITORINFO tagMONITORINFO;
MONITORINFOEX, *LPMONITORINFOEX;
MONITORINFOEX miea;
miea.tagMONITORINFO.cbSize = sizeof(MONITORINFOEX);
GetMonitorInfo(hMonitor, (&miea));


to no avail. I modified the last line to:



GetMonitorInfo(hMonitor, ((LPMONITORINFO) &miea));


again, no luck. I get compiler messages about the 2nd parameter of GetMonitorInfo.



Perhaps my recent inexperience with C++ is showing.



Thanks in advance for any help you may provide.







c++ winapi






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 13 '18 at 13:18









John-L_.John-L_.

66




66







  • 1





    Why do you redefine the structures? Why not include the proper Windows header files and use the standard structures? And what is your problem with the code you show? Do you get build errors? Runtime errors or crashes? Invalid results?

    – Some programmer dude
    Nov 13 '18 at 13:20











  • I get compiler messages about the 2nd parameter of GetMonitorInfo. Add the error messages to the question.

    – Johnny Mopp
    Nov 13 '18 at 13:24











  • your definition of MONITORINFOEX is wrong. and anyway - it defined in MultiMon.h - struct tagMONITORINFOEXA : public tagMONITORINFO CHAR szDevice[CCHDEVICENAME]; MONITORINFOEXA, *LPMONITORINFOEXA;

    – RbMm
    Nov 13 '18 at 13:32











  • @som: It's only a redefinition, if you actually include the header files that define the structures. While common, there are reasons why you'd want to define those structures yourself. A library may not want to #include <Windows.h>, and rather define what it needs. C++/WinRT recently removed the dependency on Windows.h, for example.

    – IInspectable
    Nov 13 '18 at 17:04











  • @IInspectable It would be a redefinition if the structures were a byte-by-byte, character by character, exact duplicate. Otherwise it's undefined behavior as it breaks the one definition rule. And in this case it apparently isn't exact duplicates.

    – Some programmer dude
    Nov 13 '18 at 17:28













  • 1





    Why do you redefine the structures? Why not include the proper Windows header files and use the standard structures? And what is your problem with the code you show? Do you get build errors? Runtime errors or crashes? Invalid results?

    – Some programmer dude
    Nov 13 '18 at 13:20











  • I get compiler messages about the 2nd parameter of GetMonitorInfo. Add the error messages to the question.

    – Johnny Mopp
    Nov 13 '18 at 13:24











  • your definition of MONITORINFOEX is wrong. and anyway - it defined in MultiMon.h - struct tagMONITORINFOEXA : public tagMONITORINFO CHAR szDevice[CCHDEVICENAME]; MONITORINFOEXA, *LPMONITORINFOEXA;

    – RbMm
    Nov 13 '18 at 13:32











  • @som: It's only a redefinition, if you actually include the header files that define the structures. While common, there are reasons why you'd want to define those structures yourself. A library may not want to #include <Windows.h>, and rather define what it needs. C++/WinRT recently removed the dependency on Windows.h, for example.

    – IInspectable
    Nov 13 '18 at 17:04











  • @IInspectable It would be a redefinition if the structures were a byte-by-byte, character by character, exact duplicate. Otherwise it's undefined behavior as it breaks the one definition rule. And in this case it apparently isn't exact duplicates.

    – Some programmer dude
    Nov 13 '18 at 17:28








1




1





Why do you redefine the structures? Why not include the proper Windows header files and use the standard structures? And what is your problem with the code you show? Do you get build errors? Runtime errors or crashes? Invalid results?

– Some programmer dude
Nov 13 '18 at 13:20





Why do you redefine the structures? Why not include the proper Windows header files and use the standard structures? And what is your problem with the code you show? Do you get build errors? Runtime errors or crashes? Invalid results?

– Some programmer dude
Nov 13 '18 at 13:20













I get compiler messages about the 2nd parameter of GetMonitorInfo. Add the error messages to the question.

– Johnny Mopp
Nov 13 '18 at 13:24





I get compiler messages about the 2nd parameter of GetMonitorInfo. Add the error messages to the question.

– Johnny Mopp
Nov 13 '18 at 13:24













your definition of MONITORINFOEX is wrong. and anyway - it defined in MultiMon.h - struct tagMONITORINFOEXA : public tagMONITORINFO CHAR szDevice[CCHDEVICENAME]; MONITORINFOEXA, *LPMONITORINFOEXA;

– RbMm
Nov 13 '18 at 13:32





your definition of MONITORINFOEX is wrong. and anyway - it defined in MultiMon.h - struct tagMONITORINFOEXA : public tagMONITORINFO CHAR szDevice[CCHDEVICENAME]; MONITORINFOEXA, *LPMONITORINFOEXA;

– RbMm
Nov 13 '18 at 13:32













@som: It's only a redefinition, if you actually include the header files that define the structures. While common, there are reasons why you'd want to define those structures yourself. A library may not want to #include <Windows.h>, and rather define what it needs. C++/WinRT recently removed the dependency on Windows.h, for example.

– IInspectable
Nov 13 '18 at 17:04





@som: It's only a redefinition, if you actually include the header files that define the structures. While common, there are reasons why you'd want to define those structures yourself. A library may not want to #include <Windows.h>, and rather define what it needs. C++/WinRT recently removed the dependency on Windows.h, for example.

– IInspectable
Nov 13 '18 at 17:04













@IInspectable It would be a redefinition if the structures were a byte-by-byte, character by character, exact duplicate. Otherwise it's undefined behavior as it breaks the one definition rule. And in this case it apparently isn't exact duplicates.

– Some programmer dude
Nov 13 '18 at 17:28






@IInspectable It would be a redefinition if the structures were a byte-by-byte, character by character, exact duplicate. Otherwise it's undefined behavior as it breaks the one definition rule. And in this case it apparently isn't exact duplicates.

– Some programmer dude
Nov 13 '18 at 17:28













1 Answer
1






active

oldest

votes


















3














In the code you have shown you try to define structs that are part of WinAPI yourself. Don't do that, there is no need to. Include the appropriate header files instead.



Simple sample:



#include <cstdlib>
#include <iostream>

#include <windows.h>

int main()

// just a cheap way to get a handle
auto monitor MonitorFromWindow(GetConsoleWindow(), MONITOR_DEFAULTTONEAREST) ;

MONITORINFOEXW miex sizeof miex ; // set cbSize member
if (!GetMonitorInfoW(monitor, &miex))
std::cerr << "GetMonitorInfo() failed :(nn";
return EXIT_FAILURE;


std::wcout << miex.szDevice << ": "
<< miex.rcMonitor.right - miex.rcMonitor.left << " x "
<< miex.rcMonitor.bottom - miex.rcMonitor.top << 'n';



Sample output:



\.DISPLAY1: 2560 x 1440





share|improve this answer




















  • 1





    not need static_cast<LPMONITORINFO>(&miex) can simply use &miex because MONITORINFOEXW : public MONITORINFO

    – RbMm
    Nov 13 '18 at 13:40











  • @RbMm Right. Was a little surprised though since most WinAPI structs don't use inheritance.

    – Swordfish
    Nov 13 '18 at 13:45











  • The winapi targets the C language, not C++. I think the core advice is that the OP must not declare the structs by himself, that's not going to end well since these identifiers are macros and not structs. Be sure to point that out.

    – Hans Passant
    Nov 13 '18 at 14:02












  • @HansPassant "The winapi targets the C language, not C++." thats why i was surprised.

    – Swordfish
    Nov 13 '18 at 14:06











  • MONITORINFOEX deriving from MONITORINFO is wrapped in a #ifdef __cplusplus preprocessor guard. The C implementation uses composition, where MONITORINFO is the first member of MONITORINFOEX. The entirety of the Windows API (and Windows Runtime) is still exposed as a C interface, with occasional convenience wrappers and declarations in C++.

    – IInspectable
    Nov 13 '18 at 17:26










Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53281896%2faccessing-monitorinfoex-values-in-visual-c%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









3














In the code you have shown you try to define structs that are part of WinAPI yourself. Don't do that, there is no need to. Include the appropriate header files instead.



Simple sample:



#include <cstdlib>
#include <iostream>

#include <windows.h>

int main()

// just a cheap way to get a handle
auto monitor MonitorFromWindow(GetConsoleWindow(), MONITOR_DEFAULTTONEAREST) ;

MONITORINFOEXW miex sizeof miex ; // set cbSize member
if (!GetMonitorInfoW(monitor, &miex))
std::cerr << "GetMonitorInfo() failed :(nn";
return EXIT_FAILURE;


std::wcout << miex.szDevice << ": "
<< miex.rcMonitor.right - miex.rcMonitor.left << " x "
<< miex.rcMonitor.bottom - miex.rcMonitor.top << 'n';



Sample output:



\.DISPLAY1: 2560 x 1440





share|improve this answer




















  • 1





    not need static_cast<LPMONITORINFO>(&miex) can simply use &miex because MONITORINFOEXW : public MONITORINFO

    – RbMm
    Nov 13 '18 at 13:40











  • @RbMm Right. Was a little surprised though since most WinAPI structs don't use inheritance.

    – Swordfish
    Nov 13 '18 at 13:45











  • The winapi targets the C language, not C++. I think the core advice is that the OP must not declare the structs by himself, that's not going to end well since these identifiers are macros and not structs. Be sure to point that out.

    – Hans Passant
    Nov 13 '18 at 14:02












  • @HansPassant "The winapi targets the C language, not C++." thats why i was surprised.

    – Swordfish
    Nov 13 '18 at 14:06











  • MONITORINFOEX deriving from MONITORINFO is wrapped in a #ifdef __cplusplus preprocessor guard. The C implementation uses composition, where MONITORINFO is the first member of MONITORINFOEX. The entirety of the Windows API (and Windows Runtime) is still exposed as a C interface, with occasional convenience wrappers and declarations in C++.

    – IInspectable
    Nov 13 '18 at 17:26















3














In the code you have shown you try to define structs that are part of WinAPI yourself. Don't do that, there is no need to. Include the appropriate header files instead.



Simple sample:



#include <cstdlib>
#include <iostream>

#include <windows.h>

int main()

// just a cheap way to get a handle
auto monitor MonitorFromWindow(GetConsoleWindow(), MONITOR_DEFAULTTONEAREST) ;

MONITORINFOEXW miex sizeof miex ; // set cbSize member
if (!GetMonitorInfoW(monitor, &miex))
std::cerr << "GetMonitorInfo() failed :(nn";
return EXIT_FAILURE;


std::wcout << miex.szDevice << ": "
<< miex.rcMonitor.right - miex.rcMonitor.left << " x "
<< miex.rcMonitor.bottom - miex.rcMonitor.top << 'n';



Sample output:



\.DISPLAY1: 2560 x 1440





share|improve this answer




















  • 1





    not need static_cast<LPMONITORINFO>(&miex) can simply use &miex because MONITORINFOEXW : public MONITORINFO

    – RbMm
    Nov 13 '18 at 13:40











  • @RbMm Right. Was a little surprised though since most WinAPI structs don't use inheritance.

    – Swordfish
    Nov 13 '18 at 13:45











  • The winapi targets the C language, not C++. I think the core advice is that the OP must not declare the structs by himself, that's not going to end well since these identifiers are macros and not structs. Be sure to point that out.

    – Hans Passant
    Nov 13 '18 at 14:02












  • @HansPassant "The winapi targets the C language, not C++." thats why i was surprised.

    – Swordfish
    Nov 13 '18 at 14:06











  • MONITORINFOEX deriving from MONITORINFO is wrapped in a #ifdef __cplusplus preprocessor guard. The C implementation uses composition, where MONITORINFO is the first member of MONITORINFOEX. The entirety of the Windows API (and Windows Runtime) is still exposed as a C interface, with occasional convenience wrappers and declarations in C++.

    – IInspectable
    Nov 13 '18 at 17:26













3












3








3







In the code you have shown you try to define structs that are part of WinAPI yourself. Don't do that, there is no need to. Include the appropriate header files instead.



Simple sample:



#include <cstdlib>
#include <iostream>

#include <windows.h>

int main()

// just a cheap way to get a handle
auto monitor MonitorFromWindow(GetConsoleWindow(), MONITOR_DEFAULTTONEAREST) ;

MONITORINFOEXW miex sizeof miex ; // set cbSize member
if (!GetMonitorInfoW(monitor, &miex))
std::cerr << "GetMonitorInfo() failed :(nn";
return EXIT_FAILURE;


std::wcout << miex.szDevice << ": "
<< miex.rcMonitor.right - miex.rcMonitor.left << " x "
<< miex.rcMonitor.bottom - miex.rcMonitor.top << 'n';



Sample output:



\.DISPLAY1: 2560 x 1440





share|improve this answer















In the code you have shown you try to define structs that are part of WinAPI yourself. Don't do that, there is no need to. Include the appropriate header files instead.



Simple sample:



#include <cstdlib>
#include <iostream>

#include <windows.h>

int main()

// just a cheap way to get a handle
auto monitor MonitorFromWindow(GetConsoleWindow(), MONITOR_DEFAULTTONEAREST) ;

MONITORINFOEXW miex sizeof miex ; // set cbSize member
if (!GetMonitorInfoW(monitor, &miex))
std::cerr << "GetMonitorInfo() failed :(nn";
return EXIT_FAILURE;


std::wcout << miex.szDevice << ": "
<< miex.rcMonitor.right - miex.rcMonitor.left << " x "
<< miex.rcMonitor.bottom - miex.rcMonitor.top << 'n';



Sample output:



\.DISPLAY1: 2560 x 1440






share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 13 '18 at 14:05

























answered Nov 13 '18 at 13:30









SwordfishSwordfish

9,19511335




9,19511335







  • 1





    not need static_cast<LPMONITORINFO>(&miex) can simply use &miex because MONITORINFOEXW : public MONITORINFO

    – RbMm
    Nov 13 '18 at 13:40











  • @RbMm Right. Was a little surprised though since most WinAPI structs don't use inheritance.

    – Swordfish
    Nov 13 '18 at 13:45











  • The winapi targets the C language, not C++. I think the core advice is that the OP must not declare the structs by himself, that's not going to end well since these identifiers are macros and not structs. Be sure to point that out.

    – Hans Passant
    Nov 13 '18 at 14:02












  • @HansPassant "The winapi targets the C language, not C++." thats why i was surprised.

    – Swordfish
    Nov 13 '18 at 14:06











  • MONITORINFOEX deriving from MONITORINFO is wrapped in a #ifdef __cplusplus preprocessor guard. The C implementation uses composition, where MONITORINFO is the first member of MONITORINFOEX. The entirety of the Windows API (and Windows Runtime) is still exposed as a C interface, with occasional convenience wrappers and declarations in C++.

    – IInspectable
    Nov 13 '18 at 17:26












  • 1





    not need static_cast<LPMONITORINFO>(&miex) can simply use &miex because MONITORINFOEXW : public MONITORINFO

    – RbMm
    Nov 13 '18 at 13:40











  • @RbMm Right. Was a little surprised though since most WinAPI structs don't use inheritance.

    – Swordfish
    Nov 13 '18 at 13:45











  • The winapi targets the C language, not C++. I think the core advice is that the OP must not declare the structs by himself, that's not going to end well since these identifiers are macros and not structs. Be sure to point that out.

    – Hans Passant
    Nov 13 '18 at 14:02












  • @HansPassant "The winapi targets the C language, not C++." thats why i was surprised.

    – Swordfish
    Nov 13 '18 at 14:06











  • MONITORINFOEX deriving from MONITORINFO is wrapped in a #ifdef __cplusplus preprocessor guard. The C implementation uses composition, where MONITORINFO is the first member of MONITORINFOEX. The entirety of the Windows API (and Windows Runtime) is still exposed as a C interface, with occasional convenience wrappers and declarations in C++.

    – IInspectable
    Nov 13 '18 at 17:26







1




1





not need static_cast<LPMONITORINFO>(&miex) can simply use &miex because MONITORINFOEXW : public MONITORINFO

– RbMm
Nov 13 '18 at 13:40





not need static_cast<LPMONITORINFO>(&miex) can simply use &miex because MONITORINFOEXW : public MONITORINFO

– RbMm
Nov 13 '18 at 13:40













@RbMm Right. Was a little surprised though since most WinAPI structs don't use inheritance.

– Swordfish
Nov 13 '18 at 13:45





@RbMm Right. Was a little surprised though since most WinAPI structs don't use inheritance.

– Swordfish
Nov 13 '18 at 13:45













The winapi targets the C language, not C++. I think the core advice is that the OP must not declare the structs by himself, that's not going to end well since these identifiers are macros and not structs. Be sure to point that out.

– Hans Passant
Nov 13 '18 at 14:02






The winapi targets the C language, not C++. I think the core advice is that the OP must not declare the structs by himself, that's not going to end well since these identifiers are macros and not structs. Be sure to point that out.

– Hans Passant
Nov 13 '18 at 14:02














@HansPassant "The winapi targets the C language, not C++." thats why i was surprised.

– Swordfish
Nov 13 '18 at 14:06





@HansPassant "The winapi targets the C language, not C++." thats why i was surprised.

– Swordfish
Nov 13 '18 at 14:06













MONITORINFOEX deriving from MONITORINFO is wrapped in a #ifdef __cplusplus preprocessor guard. The C implementation uses composition, where MONITORINFO is the first member of MONITORINFOEX. The entirety of the Windows API (and Windows Runtime) is still exposed as a C interface, with occasional convenience wrappers and declarations in C++.

– IInspectable
Nov 13 '18 at 17:26





MONITORINFOEX deriving from MONITORINFO is wrapped in a #ifdef __cplusplus preprocessor guard. The C implementation uses composition, where MONITORINFO is the first member of MONITORINFOEX. The entirety of the Windows API (and Windows Runtime) is still exposed as a C interface, with occasional convenience wrappers and declarations in C++.

– IInspectable
Nov 13 '18 at 17:26

















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53281896%2faccessing-monitorinfoex-values-in-visual-c%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







這個網誌中的熱門文章

How to read a connectionString WITH PROVIDER in .NET Core?

In R, how to develop a multiplot heatmap.2 figure showing key labels successfully

Museum of Modern and Contemporary Art of Trento and Rovereto