locked
Windows Store applications, Can I get screenshots of it?

    Question

  •  What other way can get the screen image?
    Composed by a lot of graphics programs, such as highcharts, d3.

    Need to intercept into a jpg graphic files, you can do it?


    赵召


    • Edited by 赵召 Wednesday, November 13, 2013 7:58 AM
    Friday, November 8, 2013 8:08 AM

Answers

  • Hi 赵召,

    I just answered you in another thread, take a look at this blog: http://blogs.msdn.com/b/lighthouse/archive/2013/10/18/capturing-snapshot-in-windows-8-1-store-app.aspx

    some code you could use:

    function captureToImage() {
         var webviewControl = document.getElementById("webview");
         Windows.Storage.ApplicationData.current.localFolder.createFileAsync("test.png", Windows.Storage.CreationCollisionOption.replaceExisting).then(function (file) {
             file.openAsync(Windows.Storage.FileAccessMode.readWrite).then(function (stream) {
                 var captureOperation = webviewControl.capturePreviewToBlobAsync();
                 captureOperation.oncomplete = function (completeEvent) {
                     var inputStream = completeEvent.target.result.msDetachStream();
                     Windows.Storage.Streams.RandomAccessStream.copyAsync(inputStream, stream).then(function () {
                         stream.flushAsync().done(function () {
                             inputStream.close();
                             stream.close();
                         });
                     });
                 };
                 captureOperation.start();
             });
         });
     }

    Hope it will help you.

    Best Regards,

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.



    • Edited by Jamles HezModerator Friday, November 8, 2013 8:41 AM
    • Marked as answer by 赵召 Wednesday, November 13, 2013 7:58 AM
    Friday, November 8, 2013 8:39 AM
    Moderator