How to invoke Snipping Tool or Snip & Sketch to open my screenshot

Tom JD1 Xue 21 Reputation points
2022-04-18T09:23:52.937+00:00

I am developing my own screenshot app. And I hope when I take a screenshot, which is in my app, then I could invoke Snipping Tool or Snip & Sketch to open the screenshot in them. So that I could further edit it in them. Is it possible and how?

I tried Snip & Sketch, it can do so. When it takes a screenshot, then use its "Open With", it can invoke any other app, like Paint, Photos or another Snip & Sketch to open the screenshot in them and then do edit work.

Follow above process, Snip & Sketch can also invoke Snipping Tool. But the invoked Snipping Tool won't open the screenshot.

Windows Presentation Foundation
Windows Presentation Foundation
A part of the .NET Framework that provides a unified programming model for building line-of-business desktop applications on Windows.
2,667 questions
0 comments No comments
{count} votes

Accepted answer
  1. Castorix31 81,461 Reputation points
    2022-04-19T12:31:55.1+00:00

    I did a test from MSDN UWP sample which worked in WPF, at least on my OS (Windows 10 21H1)

    Change the SDK version in those paths if it is different in your installation (mine is 10.0.19041.0):

    // Add reference to : "C:\Program Files (x86)\Windows Kits\10\References\10.0.19041.0\Windows.Foundation.UniversalApiContract\10.0.0.0\Windows.Foundation.UniversalApiContract.winmd"  
    // Add reference to : "C:\Program Files (x86)\Windows Kits\10\References\10.0.19041.0\Windows.Foundation.FoundationContract\4.0.0.0\Windows.Foundation.FoundationContract.winmd"  
    // Add reference to : "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETCore\v4.5\System.Runtime.WindowsRuntime.dll"  
    // Add reference to : "C:\Program Files (x86)\Windows Kits\10\UnionMetadata\10.0.19041.0\Facade\Windows.winmd"  
    

    Test with a random file "E:\butterfly.png", in a Button click :

        private void Button_Click(object sender, RoutedEventArgs e)  
        {  
            LaunchUri();  
        }  
    
        private async void LaunchUri()  
        {  
            string sPath = @"E:\butterfly.png";  
            var file = await Windows.Storage.StorageFile.GetFileFromPathAsync(sPath);  
            var sToken = Windows.ApplicationModel.DataTransfer.SharedStorageAccessManager.AddFile(file);  
      
            var sUri = String.Format("ms-screensketch:edit?source=MyApp&isTemporary=false&sharedAccessToken={0}", sToken);  
            bool bResult = await Windows.System.Launcher.LaunchUriAsync(new Uri(sUri));  
    
            if (bResult)  
            {  
                // URI launched  
            }  
            else  
            {  
                // URI launch failed  
            }  
        }  
    

    and I get the file correctly opened (french version of Snip & Sketch) :

    194314-screensketch.jpg

    0 comments No comments

4 additional answers

Sort by: Most helpful
  1. Castorix31 81,461 Reputation points
    2022-04-18T11:25:10.797+00:00

    Did you see Launch screen snipping ?

    1 person found this answer helpful.

  2. Tom JD1 Xue 21 Reputation points
    2022-04-19T06:36:02.693+00:00

    Another thing is that "Launch screen snipping" works by share a file based on UWP. While Snip & Sketch can share its screenshot (in memory) via "Open With" to other app.
    Do we have this in memory screenshot sharing method?
    And do we have WPF based method?

    0 comments No comments

  3. Tom JD1 Xue 21 Reputation points
    2022-04-20T05:42:42.307+00:00

    @Castorix31
    Thank you for your reply!
    I tried your code, but get below error.
    And my application is WPF based, do you know how to achieve it in WPF?

    194510-image.png


  4. Tom JD1 Xue 21 Reputation points
    2022-05-06T11:10:26.63+00:00

    @Castorix31 Thank you for your answer! I verified that your code works in WPF.
    The only thing unclear to me now is that Snip & Sketch seems to have ability to "Open With" its screenshot in memory with other apps.
    Maybe it saves the screenshot as a file and then share it with other app...

    0 comments No comments