• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            穩(wěn)定盈利的期貨交易方法-量化趨勢(shì)交易

            alantop -專業(yè)量化投資者

            愛(ài)好:量化投資,逆向工程,滲透
            隨筆 - 595, 文章 - 0, 評(píng)論 - 921, 引用 - 0
            數(shù)據(jù)加載中……

            調(diào)試程序的一種方法:

            用了一下dbwin很方便。

            下載的地方: http://dilascia.com/TraceWin.htm

            我用vc6, 所以下載 3.0

            用的時(shí)候非常方便,在使用的文件前#include "TraceWin.h"

            這樣,后afxDump和Trace的字符串,都輸入到TraceWin.exe這個(gè)程序中了。

            調(diào)試ole, c/s的程序非常方便。



            后面附上源碼:

            ////////////////////////////////////////////////////////////////
            //?TraceWin?Copyright?1995-1999?Paul?DiLascia
            //?If?this?program?works,?it?was?written?by?Paul?DiLascia.
            //?If?not,?I?don't?know?who?wrote?it.
            //
            //?NOTE:?If?you're?using?PixieLib,?you?don't?need?to?include?this?file.
            //?It's?already?included?by?the?library.
            //
            //?***************************************************************************
            //?TraceWin?is?a?tool?that?displays?MFC?diagnostic?(afxDump,?TRACE)?output
            //?in?the?window?of?the?TraceWin?applet.
            //
            //?To?use?TraceWin,?you?must?#include?this?file?somewhere?in?your?main?program
            //?file?(typically?where?you?implement?your?CWinApp).?Since?this?file?contains
            //?code,?you?should?#include?it?in?only?once--i.e.?NOT?in?StdAfx.h--or?you'll
            //?get?multiply-defined?symbol?errors?in?the?linker.?This?file?contains?an
            //?auto-initializing?static?variable?that?works?in?most?cases;?but?you?may?miss
            //?some?TRACE?output?from?constructors?of?static?objects.?If?so,?you?can
            //?manually?call?PxlTraceInit?before?your?first?TRACE?call.
            //
            //?To?see?the?output,?you?also?need?the?TraceWin?applet,?TraceWin.exe,?which
            //?you?can?download?http://pobox.com/~dilascia
            //
            //?***************************************************************************
            //
            #ifdef?_DEBUG

            //?Window?class?name?used?by?the?main?window?of?the?TRACEWIN?applet.
            #define?TRACEWND_CLASSNAME?_T("TraceWin?TRACE?Window")
            #define?OLDTRACEWND_CLASSNAME?_T("MfxTraceWindow")?//?backwards?compat

            //?ID?sent?as?COPYDATASRUCT::dwData?to?identify?the?WM_COPYDATA?message
            //?as?coming?from?an?app?using?TraceWin.
            #define?ID_COPYDATA_TRACEMSG?MAKELONG(MAKEWORD('t','w'),MAKEWORD('i','n'))

            //////////////////
            //?CFileTrace?is?a?CFile?that?"writes"?to?the?trace?window
            //
            class?CFileTrace?:?public?CFile?{
            ????DECLARE_DYNAMIC(CFileTrace)
            ????CFileTrace()?
            {?m_strFileName?=?_T("Mfx?File?Tracer");?}
            ????
            static?BOOL?autoInit;
            ????
            virtual?void?Write(const?void*?lpBuf,?UINT?nCount);
            public:
            ????
            static??BOOL?Init();????
            }
            ;
            IMPLEMENT_DYNAMIC(CFileTrace,?CFile)

            //////////////////
            //?Override?to?write?to?TraceWin?applet?instead?of?file.
            //
            void?CFileTrace::Write(const?void*?lpBuf,?UINT?nCount)
            {
            ????
            if?(!afxTraceEnabled)
            ????????
            return;????//?MFC?tracing?not?enabled

            ????HWND?hTraceWnd?
            =?::FindWindow(TRACEWND_CLASSNAME,?NULL);
            ????
            if?(hTraceWnd==NULL)
            ????????hTraceWnd?
            =?::FindWindow(OLDTRACEWND_CLASSNAME,?NULL);
            ????
            if?(hTraceWnd)?{
            ????????
            //?Found?Trace?window:?send?string?with?WM_COPYDATA
            ????????
            //?Must?copy?to?make?me?the?owner?of?the?string;?otherwise
            ????????
            //?barfs?when?called?from?MFC?with?traceMultiApp?on
            ????????
            //
            ????????static?char?mybuf[1024];

            #ifdef?_UNICODE
            ????????BOOL?bDefCharUsed;
            ????????::WideCharToMultiByte(CP_ACP,
            0,LPCWSTR(lpBuf),
            ????????????
            -1,?mybuf,?1024,?NULL,?&bDefCharUsed);
            #else
            ????????memcpy(mybuf,?lpBuf,?nCount);
            #endif

            ????????COPYDATASTRUCT?cds;
            ????????cds.dwData?
            =?ID_COPYDATA_TRACEMSG;
            ????????cds.cbData?
            =?nCount;
            ????????cds.lpData?
            =?mybuf;
            ????????CWinApp
            *?pApp?=?AfxGetApp();
            ????????HWND?hWnd?
            =?pApp???pApp->m_pMainWnd->GetSafeHwnd()?:?NULL;
            ????????::SendMessage(hTraceWnd,?WM_COPYDATA,?(WPARAM)hWnd,?(LPARAM)
            &cds);
            ????}

            ????
            //?Also?do?normal?debug?thing
            ????::OutputDebugString((LPCTSTR)lpBuf);
            }


            /////////////////
            //?Initialize?tracing.?Replace?global?afxDump.m_pFile?with?CFileTrace?object.
            //?In?VC?5.0,?you?shouldn't?need?to?call?this,?since?it's?called?from?an
            //?auto-initializing?static?object?autoInit?below.?But?if?you?don't?see
            //?any?TRACE?output?in?the?TraceWin?window,?you?should?try?calling
            //?PxlTraceInit?any?time?before?your?first?TRACE?message.
            //
            BOOL?CFileTrace::Init()
            {
            ????
            if?(afxDump.m_pFile==NULL)?{
            ????????
            //?Initialize?tracing:?replace?afxDump.m_pFile?w/my?own?CFile?object
            ????????
            //
            ????????
            //?It's?important?to?allocate?with?"new"?here,?not?a?static?object,
            ????????
            //?because?CFileTrace?is?virtual--i.e.,?called?through?a?pointer?in
            ????????
            //?the?object's?vtbl--and?the?compiler?will?zero?out?the?virtual
            ????????
            //?function?table?with?a?NOP?function?when?a?static?object
            ????????
            //?goes?out?of?scope.?But?I?want?my?CFileTrace?to?stay?around?to
            ????????
            //?display?memory?leak?diagnostics?even?after?all?static?objects
            ????????
            //?have?been?destructed.?So?I?allocate?the?object?with?new?and
            ????????
            //?never?delete?it.?I?don't?want?this?allocation?to?itself?generate
            ????????
            //?a?reported?memory?leak,?so?I?turn?off?memory?tracking?before?I
            ????????
            //?allocate,?then?on?again?after.
            ????????
            //
            ????????BOOL?bEnable?=?AfxEnableMemoryTracking(FALSE);
            ????????afxDump.m_pFile?
            =?new?CFileTrace;
            ????????AfxEnableMemoryTracking(bEnable);
            ????????
            return?TRUE;
            ????}

            ????
            return?FALSE;
            }


            //////////////////
            //?This?object?does?nothing?but?call?CFileTrace::Init,?so?all?you?have?to
            //?do?is?#include?this?file.?Because?afxDump?is?defined?in?a?module?with
            //
            //?#pragma?init_seg(lib)
            //
            //?afxDump?gets?initialized?before?the?"user"?segment?which?is?where?your
            //?app?(and?autoInit)?is?by?default.?If?you?need?to?use?init_seg(lib),
            //?or?you?have?other?objects?whose?constructors?call?TRACE?that?get
            //?initialized?before?CFileTrace::bInitialized,?you?will?have?to?call
            //?CFileTrace::Init?yourself,?before?your?first?TRACE?statement.
            //
            BOOL?CFileTrace::autoInit?=?CFileTrace::Init();

            //?This?symbol?defined?so?you?can?call?it?and?have?it
            //?compile?to?nothing?in?non-debug?build
            #define?PxlTraceInit()?CFileTrace::Init();

            #else

            #define?PxlTraceInit()

            #endif?//?_DEBUG

            posted on 2006-05-07 15:57 AlanTop 閱讀(1306) 評(píng)論(4)  編輯 收藏 引用 所屬分類: C++

            評(píng)論

            # re: 調(diào)試程序的一種方法:  回復(fù)  更多評(píng)論   

            這個(gè)還不是最方便的

            最簡(jiǎn)單的方法是使用DebugView,不用改代碼,就可以直接看到調(diào)試輸出了
            2006-05-08 09:11 | 小明

            # re: 調(diào)試程序的一種方法:  回復(fù)  更多評(píng)論   

            小明,說(shuō)得不錯(cuò),我一般還要對(duì)OutputDebugString進(jìn)行一些封裝,并增加一個(gè)調(diào)試宏,這樣在Release版本中,就沒(méi)有任何的輸出了,很方便!
            2006-05-08 22:40 | vgoo

            # re: 調(diào)試程序的一種方法:  回復(fù)  更多評(píng)論   

            方法很多,寫到一個(gè)console窗口里面也是可以的。
            quake的做法是自己寫了一個(gè)os無(wú)關(guān)的console類,無(wú)論在windows上還是linux,mac都可以出trace
            2006-05-10 12:38 |

            # re: 調(diào)試程序的一種方法:  回復(fù)  更多評(píng)論   

            不曉得有不有試過(guò) XTRACE
            可以在release 下查看輸出的
            2006-05-15 16:06 | 代李
            久久av高潮av无码av喷吹| 日批日出水久久亚洲精品tv| 久久亚洲AV成人出白浆无码国产| 欧美激情一区二区久久久| 日产久久强奸免费的看| 伊人久久精品影院| 青草国产精品久久久久久| 99久久免费国产特黄| 久久久精品波多野结衣| 久久只有这里有精品4| 久久久无码人妻精品无码| 亚洲国产精品久久久久久| 日本加勒比久久精品| 人妻无码中文久久久久专区| 国产精品久久永久免费| 久久综合视频网站| 久久99精品久久久久久动态图| 99久久精品免费观看国产| 奇米影视7777久久精品人人爽| 国产亚洲美女精品久久久久狼| 久久精品国产亚洲Aⅴ蜜臀色欲| 久久婷婷五月综合成人D啪| 久久国产乱子精品免费女| 亚洲国产成人精品91久久久 | av午夜福利一片免费看久久| 大美女久久久久久j久久| 亚洲午夜无码久久久久小说| 91久久婷婷国产综合精品青草| 蜜臀久久99精品久久久久久| 国内精品久久久久影院优 | 久久精品国内一区二区三区| 人妻无码精品久久亚瑟影视| 99久久精品免费观看国产| 少妇久久久久久被弄高潮| 亚洲精品无码久久久久AV麻豆| 97久久天天综合色天天综合色hd| 中文国产成人精品久久亚洲精品AⅤ无码精品 | 久久99精品国产99久久| 久久夜色精品国产亚洲| 久久强奷乱码老熟女网站| 久久久91精品国产一区二区三区 |