Finishing off Share Target RRS feed

  • Question

  • I have the following share target that gets hit when receiving a share from IE.  When I try to close the app it claims that the share has not completed, even though the function and the task have completed.  What am I missing to finish the share?

    void App::OnShareTargetActivated(ShareTargetActivatedEventArgs^ args)
    	auto share_op = args->ShareOperation;
    	if (share_op->Data->Contains(StandardDataFormats::Uri))
    		concurrency::create_task(share_op->Data->GetUriAsync()).then([](Uri^ uri){
    			auto absolute = uri->AbsoluteUri;
    			std::wstring str(absolute->Data(), absolute->Length());
    	else if (share_op->Data->Contains(StandardDataFormats::Html))
    		concurrency::create_task(share_op->Data->GetHtmlFormatAsync()).then([](String^ html){
    			std::wstring str(html->Data(), html->Length());

    Wednesday, August 1, 2012 5:06 AM


  • Hi,

    Did you forget to call share_op->reportCompleted();

    After your app finishes processing the shared content, call ReportCompleted. You must call this method so that Windows 8 knows that your app is no longer needed.

    Note  If you're going to test the code in this section, we recommend that you do not immediately add the code that calls ReportCompleted. This is because the system closes your app after ReportCompleted is called, which prevents the test from proceeding. When you move your code into production, make sure you add the call to ReportCompleted.

    Best regards,

    Jesse Jiang [MSFT]
    MSDN Community Support | Feedback to us

    • Marked as answer by diltsman Thursday, August 2, 2012 11:57 PM
    Thursday, August 2, 2012 8:54 AM