zoukankan      html  css  js  c++  java
  • 【windows + DebugView】 -- 通过DebugView工具调试窗口程序

    简述

    对windows窗口程序调试时,如果没有或不能用log4cplus之类的日志打印的情况下,可以使用DebugView工具进行日志打印辅助调试

    用到的工具

    DebugView

    用法

    #include "debugapi.h"
    /* API 定义:
    WINBASEAPI VOID WINAPI OutputDebugStringA(_In_opt_ LPCSTR lpOutputString);
    WINBASEAPI VOID WINAPI OutputDebugStringW(_In_opt_ LPCWSTR lpOutputString);
    #ifdef UNICODE
    #define OutputDebugString  OutputDebugStringW
    #else
    #define OutputDebugString  OutputDebugStringA
    #endif // !UNICODE
    */
    
    /* 简单打印示例*/
    OutputDebugString("Hello World!");
    
    uint32_t nums = 100;
    /* 输出变量的示例1(UNICODE编码 + c++标准库的一种用法)*/
    std::wstringstream stream;
    stream << "The Nums: " << nums << std::endl;
    OutputDebugString(stream.str().c_str()); 
    
    /* 输出变量的示例2 (UNICODE编码 + C语言的一种用法) */
    WCHAR szLog[128] = {0};
    StringCbPrintf(szLog, 128, L"The Nums: %u
    ", nums);
    OutputDebugString(szLog);
    
  • 相关阅读:
    反射和内置方法重写
    封装
    接口与抽象类 、多态
    面向对象--继承和组合
    python对象
    模块导入
    python序列化模块
    time random sys os 模块
    python re模块和collections
    python各种推导式
  • 原文地址:https://www.cnblogs.com/mooooonlight/p/13789050.html
Copyright © 2011-2022 走看看