OutputDebugString在Windows通用应用程序上的位置?以及如何从OutputDebugString捕获

Where does OutputDebugString go on Windows Universal Apps ? And how to capture messages from OutputDebugString?

本文关键字:OutputDebugString 捕获 位置 Windows 应用程序 应用 程序上      更新时间:2023-10-16

使用OutputDebugString是用户模式调试的常见调试技术。

在Windows10上的UWP/UAP/Metro应用程序开发中,此调试功能仍然可用。

但是,我希望在不附加Visual Studio调试器(EDIT:或WinDbg(的情况下观察OutputDebugString消息。

SysInternals的最新版本DbgViewer能够观察UWP调试输出,但我找不到该工具的源代码。

事实上,CobaltFusion的DebugViewPP似乎只适用于win32应用程序。

作为一种解决方法,我可以简单地使用LogginChannel.LogMessage,但我目前更感兴趣的是OutputDebugString API在UWP下的工作方式

OutputDebugString函数存在于Kernel32.dll文件中,如果您想在UWP中使用它,可以通过DllImport导入dll文件。

[DllImport("kernel32.dll", CharSet = CharSet.Auto)]
public static extern void OutputDebugString(string message);
private async void Button_Click(object sender, RoutedEventArgs e)
{
OutputDebugString("~~~OutputDebugString");
}
相关文章:
  • 没有找到相关文章