Windows Phone:登录到控制台 [英] Windows Phone: Log to console

查看:147
本文介绍了Windows Phone:登录到控制台的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

免责声明:

我对MSFT技术世界很陌生,而且只在一个月前开始了Windows Phone开发。我无法弄清楚如何在C#和C ++(Direct3D)Windows Phone 8应用程序中记录信息到Visual Studio输出窗口。这是可能吗?

I am unable to figure out how to log information to the Visual Studio Output window from within a C# and C++ (Direct3D) Windows Phone 8 App. Is this possible?

我在调试模式下构建,目标是Windows Phone 8,在XDE模拟器中运行,我的开发机器是安装了VS2012 Ultimate的Windows 8框。我的应用程序运行良好,我的Direct3D场景正常渲染,但我不能记录任何东西!这使得跟踪代码执行困难,并迫使我使用断点(这在许多情况下可能是过分的)。

I am building in debug mode, targeting Windows Phone 8, running in the XDE emulator and my development machine is a Windows 8 box with VS2012 Ultimate installed. My App runs fine, my Direct3D scene renders normally, but I can't log anything! This makes tracing code execution difficult and forces me to use breakpoints (which can be overkill in many situations).

我一直在寻找广泛,并尝试了许多方法(OutputDebugString是其中之一)。我不能在MSDN上看到任何东西,为什么这不在任何地方记录?

I've been searching far and wide and have tried many methods (OutputDebugString being one of them). I can't see anything on MSDN about this - why is this not documented anywhere?

推荐答案

字符串从WP8 C ++到VS2012中的输出窗口。我实际上有一个此处的示例。

Yep, it's possible to write debug strings from WP8 C++ to the output window in VS2012. I actually have an example of that here.

1)从C ++调用 OutputDebugString

1) Invoke OutputDebugString from C++.

void Direct3DInterop::MyButtonWasClicked()
{
    OutputDebugString(L"Button was clicked!");
} 

2)在运行应用程序之前,确保更改为本机调试器在项目的属性中管理调试器。

2) Before running the app make sure to change to the native debugger from the managed debugger in the project's properties.

这篇关于Windows Phone:登录到控制台的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆