Screen capturing based on Windows Magnification API fails on Windows 7 64 bit With Aero theme disabled










1















I'm trying to capture the desktop screen using Windows Magnification APIs based on code sample given in https://www.codeproject.com/Articles/607288/Screenshot-using-the-Magnification-library?msg=5570528#xx5570528xx.



The program (32bit executable) works pretty good on Windows8 and Windows10 but fails on Windows7 OS. I compiled the program into 64bit and the behavior is same even for the sample program mentioned in the above codeproject thread.



After debugging I figured out that the MagImageScalingCallback function returns image width and height as 4*4 instead of my monitor's size and that causes the program to crash or capture a blank screen on Windows7 machines (reference: https://docs.microsoft.com/en-us/windows/desktop/api/magnification/ns-magnification-tagmagimageheader).



All the API calls (MagInitialize, CreateWindow, MagSetWindowFilterList & MagSetWindowSource) are successful. There are no API call failures or mistakes in the code flow in terms of Initializing creating, setting desktop area & assigning filter list.



DWM (Aero theme) is turned off (as per reference: https://docs.microsoft.com/en-us/windows/desktop/api/magnification/nf-magnification-magsetimagescalingcallback)



I couldn't find any resources related to this topic even after researching for about 3 days. I have to use Magnification APIs because I have the need to capture windows that stays behind other windows on the desktop.



Any help would be appreciated.



Update 1:



I figured out that the application is able to capture the screen only when Aero theme is enabled and that contradicts with the statement in https://docs.microsoft.com/en-us/windows/desktop/api/magnification/nf-magnification-magsetimagescalingcallback.



I'm not sure how could I make it work on Operating systems with Aero theme disabled or not available by default.










share|improve this question



















  • 1





    Win7 is the new XP in many ways. "need to capture windows that stays behind..." is the killer detail. That can't work with the DWM disabled.

    – Hans Passant
    Nov 14 '18 at 10:54











  • @HansPassant you are absolutely right. This should be the answer, thanks.

    – Ram
    Nov 15 '18 at 12:51















1















I'm trying to capture the desktop screen using Windows Magnification APIs based on code sample given in https://www.codeproject.com/Articles/607288/Screenshot-using-the-Magnification-library?msg=5570528#xx5570528xx.



The program (32bit executable) works pretty good on Windows8 and Windows10 but fails on Windows7 OS. I compiled the program into 64bit and the behavior is same even for the sample program mentioned in the above codeproject thread.



After debugging I figured out that the MagImageScalingCallback function returns image width and height as 4*4 instead of my monitor's size and that causes the program to crash or capture a blank screen on Windows7 machines (reference: https://docs.microsoft.com/en-us/windows/desktop/api/magnification/ns-magnification-tagmagimageheader).



All the API calls (MagInitialize, CreateWindow, MagSetWindowFilterList & MagSetWindowSource) are successful. There are no API call failures or mistakes in the code flow in terms of Initializing creating, setting desktop area & assigning filter list.



DWM (Aero theme) is turned off (as per reference: https://docs.microsoft.com/en-us/windows/desktop/api/magnification/nf-magnification-magsetimagescalingcallback)



I couldn't find any resources related to this topic even after researching for about 3 days. I have to use Magnification APIs because I have the need to capture windows that stays behind other windows on the desktop.



Any help would be appreciated.



Update 1:



I figured out that the application is able to capture the screen only when Aero theme is enabled and that contradicts with the statement in https://docs.microsoft.com/en-us/windows/desktop/api/magnification/nf-magnification-magsetimagescalingcallback.



I'm not sure how could I make it work on Operating systems with Aero theme disabled or not available by default.










share|improve this question



















  • 1





    Win7 is the new XP in many ways. "need to capture windows that stays behind..." is the killer detail. That can't work with the DWM disabled.

    – Hans Passant
    Nov 14 '18 at 10:54











  • @HansPassant you are absolutely right. This should be the answer, thanks.

    – Ram
    Nov 15 '18 at 12:51













1












1








1


3






I'm trying to capture the desktop screen using Windows Magnification APIs based on code sample given in https://www.codeproject.com/Articles/607288/Screenshot-using-the-Magnification-library?msg=5570528#xx5570528xx.



The program (32bit executable) works pretty good on Windows8 and Windows10 but fails on Windows7 OS. I compiled the program into 64bit and the behavior is same even for the sample program mentioned in the above codeproject thread.



After debugging I figured out that the MagImageScalingCallback function returns image width and height as 4*4 instead of my monitor's size and that causes the program to crash or capture a blank screen on Windows7 machines (reference: https://docs.microsoft.com/en-us/windows/desktop/api/magnification/ns-magnification-tagmagimageheader).



All the API calls (MagInitialize, CreateWindow, MagSetWindowFilterList & MagSetWindowSource) are successful. There are no API call failures or mistakes in the code flow in terms of Initializing creating, setting desktop area & assigning filter list.



DWM (Aero theme) is turned off (as per reference: https://docs.microsoft.com/en-us/windows/desktop/api/magnification/nf-magnification-magsetimagescalingcallback)



I couldn't find any resources related to this topic even after researching for about 3 days. I have to use Magnification APIs because I have the need to capture windows that stays behind other windows on the desktop.



Any help would be appreciated.



Update 1:



I figured out that the application is able to capture the screen only when Aero theme is enabled and that contradicts with the statement in https://docs.microsoft.com/en-us/windows/desktop/api/magnification/nf-magnification-magsetimagescalingcallback.



I'm not sure how could I make it work on Operating systems with Aero theme disabled or not available by default.










share|improve this question
















I'm trying to capture the desktop screen using Windows Magnification APIs based on code sample given in https://www.codeproject.com/Articles/607288/Screenshot-using-the-Magnification-library?msg=5570528#xx5570528xx.



The program (32bit executable) works pretty good on Windows8 and Windows10 but fails on Windows7 OS. I compiled the program into 64bit and the behavior is same even for the sample program mentioned in the above codeproject thread.



After debugging I figured out that the MagImageScalingCallback function returns image width and height as 4*4 instead of my monitor's size and that causes the program to crash or capture a blank screen on Windows7 machines (reference: https://docs.microsoft.com/en-us/windows/desktop/api/magnification/ns-magnification-tagmagimageheader).



All the API calls (MagInitialize, CreateWindow, MagSetWindowFilterList & MagSetWindowSource) are successful. There are no API call failures or mistakes in the code flow in terms of Initializing creating, setting desktop area & assigning filter list.



DWM (Aero theme) is turned off (as per reference: https://docs.microsoft.com/en-us/windows/desktop/api/magnification/nf-magnification-magsetimagescalingcallback)



I couldn't find any resources related to this topic even after researching for about 3 days. I have to use Magnification APIs because I have the need to capture windows that stays behind other windows on the desktop.



Any help would be appreciated.



Update 1:



I figured out that the application is able to capture the screen only when Aero theme is enabled and that contradicts with the statement in https://docs.microsoft.com/en-us/windows/desktop/api/magnification/nf-magnification-magsetimagescalingcallback.



I'm not sure how could I make it work on Operating systems with Aero theme disabled or not available by default.







visual-c++ screenshot screen-capture dwm magnification-api






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 14 '18 at 10:15







Ram

















asked Nov 14 '18 at 8:31









RamRam

276315




276315







  • 1





    Win7 is the new XP in many ways. "need to capture windows that stays behind..." is the killer detail. That can't work with the DWM disabled.

    – Hans Passant
    Nov 14 '18 at 10:54











  • @HansPassant you are absolutely right. This should be the answer, thanks.

    – Ram
    Nov 15 '18 at 12:51












  • 1





    Win7 is the new XP in many ways. "need to capture windows that stays behind..." is the killer detail. That can't work with the DWM disabled.

    – Hans Passant
    Nov 14 '18 at 10:54











  • @HansPassant you are absolutely right. This should be the answer, thanks.

    – Ram
    Nov 15 '18 at 12:51







1




1





Win7 is the new XP in many ways. "need to capture windows that stays behind..." is the killer detail. That can't work with the DWM disabled.

– Hans Passant
Nov 14 '18 at 10:54





Win7 is the new XP in many ways. "need to capture windows that stays behind..." is the killer detail. That can't work with the DWM disabled.

– Hans Passant
Nov 14 '18 at 10:54













@HansPassant you are absolutely right. This should be the answer, thanks.

– Ram
Nov 15 '18 at 12:51





@HansPassant you are absolutely right. This should be the answer, thanks.

– Ram
Nov 15 '18 at 12:51












0






active

oldest

votes











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%2f53295895%2fscreen-capturing-based-on-windows-magnification-api-fails-on-windows-7-64-bit-wi%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















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%2f53295895%2fscreen-capturing-based-on-windows-magnification-api-fails-on-windows-7-64-bit-wi%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







Popular posts from this blog

Top Tejano songwriter Luis Silva dead of heart attack at 64

政党

天津地下鉄3号線