+ -
当前位置:首页 → 问答吧 → ATLTRACE怎么输出宽字符串?

ATLTRACE怎么输出宽字符串?

时间:2011-12-02

来源:互联网

我打印过,ATLTRACE输出宽字符串有问题。怎么办?

宽字符串怎么打印到调试输出窗口中?

作者: qianwen36   发布时间: 2011-12-02

先用W2A转换成多字节
AtlBase.h

USES_CONVERSION;

LPCSTR x = W2A(lpsz);

作者: fishion   发布时间: 2011-12-02

C/C++ code
OutputDebugStringW(L"xxxx");

作者: WaistCoat06   发布时间: 2011-12-02

为什么我这段代码执行不下去,报异常了。求助

C/C++ code

            m_ToolTip.UpdateTipText(nItemID, m_hWnd);
            CRect rc;
            UINT nPos =0, nItemCount = menu.GetMenuItemCount();
            // Get Item Position
            for (; nPos < nItemCount; nPos++)
            {
                if (menu.GetMenuItemID(nPos) == nItemID)
                {
                    break;
                }
            }
            int nRes = menu.GetMenuItemRect(NULL, nPos, &rc);
            ATLTRACE("GetMenuItemRect() return %d \nMenu item coordinate(right,top):(%d,%d)\n", nRes, rc.right, rc.top);
            CRect rcTip;
            CToolInfo toolInfo(TTF_TRACK, m_hWnd);
            m_ToolTip.GetToolInfo(&toolInfo);

            m_ToolTip.GetWindowRect(&rcTip);
            rcTip.MoveToXY(rc.right + 5, rc.top);

            m_ToolTip.TrackActivate(&toolInfo, TRUE);
            m_ToolTip.MoveWindow(&rcTip);
            OutputDebugString(toolInfo.lpsztext);

作者: qianwen36   发布时间: 2011-12-02