VS 调试经验
使用OutputDebugStringW(LPCWSTR lpOutputString)在output输出指定点的调试状态,可代替断点调试
调试开始行:
1 WCHAR szLine[1024] = { 0 };//定义输出行 2 { 3 //调试输出开始 4 swprintf_s(szLine, _countof(szLine), L"WriteClipboard() start...\n"); 5 ::OutputDebugStringW(szLine); 6 }
调试行:
1 //输出调试点变量值或者函数返回值 2 { 3 swprintf_s(szLine, _countof(szLine), L"after GlobalUnlock, %d, errcode: %lu, hGlobalm: %08X, content: %s\n", bgu, GetLastError(), hGlobalMemory, A2W(dataBuffer)); 4 ::OutputDebugStringW(szLine); 5 }
调试完成:
1 //调试输出结束
2 { 2 swprintf_s(szLine, _countof(szLine), L"WriteClipboard() completed...\n"); 3 ::OutputDebugStringW(szLine); 4 }