Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to connect a UWP app to pipe output to this? #2

Open
morness opened this issue Apr 21, 2017 · 13 comments
Open

How to connect a UWP app to pipe output to this? #2

morness opened this issue Apr 21, 2017 · 13 comments

Comments

@morness
Copy link

morness commented Apr 21, 2017

Sorry, not so much an issue as a question :)

I've got another standalone UWP C++ application and really just want to pipe output to a standalone console app without being attached to a debugger. I figured this would do the trick, but have no idea how to write code in my app to talk to this. Are you able to provide a brief example?

@mscherotter
Copy link
Owner

When you install the app, there are instructions and a code sample in C# in the console window showing how to use the app service. In your app you launch the tester via with the Windows.System.Launcher class and then send messages to it with the Windows.ApplicationModel.AppService.AppServiceConnection class.

@mscherotter
Copy link
Owner

The app is in the Windows Store now as "Console Output"

@morness
Copy link
Author

morness commented Apr 21, 2017

When I clicked on your link, the store said it couldn't be found. Also a manual search yields the same result. I'm in Canada, but not sure that would make a difference (locale availability of app?). That aside, I've downloaded and compiled the git project. When I run it, I see this.
image

I've been programming for over 20 years, mostly in C++, but really struggling to understand many UWP concepts. In order to run a UWP app for example, it needs to be deployed/installed -- but getting my other app to tell this app to launch is tripping me up. Also no idea how to communicate with your promising console output tester from a separate standalone C++ app.

First time in a long time I've felt like a total noob.

@mscherotter
Copy link
Owner

The source code here is a bit out of date - you should install this app http://www.microsoft.com/en-us/store/p/console-output/9nblggh515n5 from the Windows store and connect to that. To use the UWP platform with Win32 apps, you need to include specific libraries to enable the APIs. See this article https://blogs.windows.com/buildingapps/2017/01/25/calling-windows-10-apis-desktop-application/#XBc3u91Pm4XsFxso.97 to show how to enable the Windows Runtime Libraries from a standard C++ app.

@morness
Copy link
Author

morness commented Apr 21, 2017

The store still comes up dry for me. I can see the initial link:
image

but when I click on it, this happens.
image

Also my standalone app is a UWP 64-bit app. I guess if I am able to get access to a store app to "install", then I can launch it easier, or trigger something from my app to either install or run it (or even better, NuGet). But embedding your UWP app and launching it from another UWP app doesn't feel like a trivial possibility to me.

Btw, thanks for being so quick and responsive.

@mscherotter
Copy link
Owner

That's odd - can you download other apps from the store? What happens when you type "Console Output" into the search box in the upper right of the store app? Is your machine up-to-date? What version of Windows 10 are you running?

@morness
Copy link
Author

morness commented Apr 21, 2017

Oh geez. Okay. I can get it now. I was on a dev sandbox and didn't switch to retail. Okay I see the C# code now and can try to convert it to C++. Okay let me see what I can do now :)

@mscherotter
Copy link
Owner

I just updated the Git Repro with a C++ Sample: https://github.com/mscherotter/ConsoleOutputTester/tree/master/ConsoleOuptutTester/CPPTester.

@morness
Copy link
Author

morness commented Apr 21, 2017

Wow. Just wow! :)

@mscherotter
Copy link
Owner

Glad you like it! Please click on the Feedback button in the bottom appbar of the app if you have any suggestions.

@morness
Copy link
Author

morness commented Apr 21, 2017

Definitely will, thanks :)

@morness
Copy link
Author

morness commented Apr 24, 2017

Okay, I've got some code cleaned up on my side and it's working well enough, and here's my feedback so far... still early 👍

  1. As a test, I was sending one message per update loop, but that is enough to quickly cripple the ConsoleOutput app after about 1200 messages. When I stop my app, your console app becomes responsive, so I feel like SendMessageAsync might not be able to handle too many events. Do you have any recommendations on that?
  2. What do you think is the best way to terminate the Console Output app when shutting down my app? Is there an existing way I can do this, or would creating some sort of kill message be the best approach?
  3. Is there a way to tell a UWP app to install another UWP app or embed it so that I can run directly? Obviously we have sandbox issues, so I couldn't install it unless I went back to retail first. Just thinking of the best way to get this setup for other team members.
  4. The ability to click on the console output to save your spot and stop scrolling, much like in the output window in VS.
  5. Internally due to PLM debugging, I'm planning on queuing up events before the Console Output program spawns so I can blurt them out once it's ready, so I don't miss anything. Unless you have better thoughts on that too.

@mscherotter
Copy link
Owner

  1. I didn't design the app to be high-performance, accounting for that kind of output. You might want to look into the native logging APIs.
  2. I will look into this idea.
  3. No there is not.
  4. Good idea - I can look into it.
  5. That could work too.

Please create individual items in the Feedback Hub app for each of these for Console Output, so other users can see and vote on these great suggestions.
Thanks,
Michael

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants