六月婷婷综合激情-六月婷婷综合-六月婷婷在线观看-六月婷婷在线-亚洲黄色在线网站-亚洲黄色在线观看网站

明輝手游網中心:是一個免費提供流行視頻軟件教程、在線學習分享的學習平臺!

在BCB下使用GExperts的Debug技巧

[摘要]GExperts是BCB的一個插件,其中有一項功能是Debug,非常好用。但是由于定義它的是pas文件(這個文件是GExperts安裝目錄下DbugIntf.pas),所以不能在BCB中直接使用。我把這個文件轉換成C++文件,但是使用的時候注意把dbugintf.h文件copy到工程所在的目錄中,...
GExperts是BCB的一個插件,其中有一項功能是Debug,非常好用。但是由于定義它的是pas文件(這個文件是GExperts安裝目錄下DbugIntf.pas),所以不能在BCB中直接使用。我把這個文件轉換成C++文件,但是使用的時候注意把dbugintf.h文件copy到工程所在的目錄中,直接在文件中用#include引用,不要添加到project中!

具體的使用方法還是看幫助吧!下面是轉換后的文件。
/*-----------------------------------------------------------------------------
Unit Name: dbugintf.h
Author:    yuanhen
Email:     [email protected]
            [email protected]
Purpose:   translate Delphi version to C++Builder's
Date:      2003/06/05
Time:      20:42:08
History:
NOTE NOTE NOTE:
    DON'T ADD this file to your project. Otherwise, this file should be include
    to your project manually
-----------------------------------------------------------------------------*/
#ifndef DBUGINTF_H
#define DBUGINTF_H

#ifdef LINUX
#include <iostream>
#endif LINUX

#include <vcl.h>
#include <Registry.hpp>

//---------------------------------------------------------------------------
// global variables
AnsiString  MsgPrefix;
const char  chrClearCommand = 3;
bool        PastFailedAttemptToStartDebugWin = false;
const AnsiString Indentation = "    ";

// declaration
void SendBoolean(const AnsiString &Identifier, const bool Value);
void SendDateTime(const AnsiString &Identifier, const TDateTime Value);
void SendDebugEx(const AnsiString &Msg, TMsgDlgType MType);

void SendDebug(const AnsiString &Msg);
void SendDebugClear();
void SendInteger(const AnsiString &Identifier, const int Value);
void SendMethodEnter(const AnsiString &MethodName);
void SendMethodExit(const AnsiString &MethodName);
void SendSeparator();
void SendDebugFmt(const AnsiString &Msg, const TVarRec *Args);
void SendDebugFmtEx(const AnsiString &Msg, const TVarRec *Args, TMsgDlgType MType);
HWND StartDebugWin();

// definition
void SendBoolean(const AnsiString &Identifier, const bool Value)
{
  // Note: We deliberately leave "True" and "False" as
  // hard-coded string constants, since these are
  // technical terminology which should not be localised.
  if (Value)
    SendDebugEx(Identifier + "= True", mtInformation);
  else
    SendDebugEx(Identifier + "= False", mtInformation);
}
void SendDateTime(const AnsiString &Identifier, const TDateTime Value)
{
    SendDebugEx(Identifier + '=' + DateTimeToStr(Value), mtInformation);
}
void SendDebugEx(const AnsiString &Msg, TMsgDlgType MType)
{
    TCopyDataStruct CDS;
    HWND            DebugWin;
    AnsiString      MessageString;
#ifdef LINUX
const AnsiString MTypeStr[TMsgDlgType] =
    {"Warning: ", "Error: ", "Information: ", "Confirmation: ", "Custom: "};
#endif LINUX
#ifdef LINUX
    std::cout << "GX: " << MTypeStr[MType] << Msg << std::endl;
#endif LINUX
#ifndef LINUX
    DebugWin = FindWindow("TfmDebug", NULL);

    if (DebugWin == 0)
        DebugWin = StartDebugWin();

    if (DebugWin != 0)
    {
        MessageString = MsgPrefix + Msg;
        CDS.cbData    = MessageString.Length() + 4;
        CDS.dwData    = 0;
        AnsiString com;
        if (Msg == chrClearCommand)
        {
            com = chrClearCommand;
            com += AnsiString(MType + 1) + MessageString;
            com += '\0';
        }
        else
        {
            com = '\1';
            com = com + AnsiString(MType + 1) + MessageString;
            com = com + '\0';
        }
        CDS.lpData = com.c_str();

        SendMessage(DebugWin, WM_COPYDATA, WPARAM(Application->Handle), LPARAM(&CDS));
    }
#endif LINUX
}

void SendDebug(const AnsiString &Msg)
{
    SendDebugEx(Msg, mtInformation);
}
void SendDebugClear()
{
    SendDebug(chrClearCommand);
}
void SendInteger(const AnsiString &Identifier, const int Value)
{
    SendDebugEx(AnsiString(Identifier + " = " + Value), mtInformation);
}
void SendMethodEnter(const AnsiString &MethodName)
{
    MsgPrefix = MsgPrefix + Indentation;
    SendDebugEx("Entering " + MethodName, mtInformation);
}
void SendMethodExit(const AnsiString &MethodName)
{
    SendDebugEx("Exiting " + MethodName, mtInformation);
    MsgPrefix.Delete(1, Indentation.Length());
}
void SendSeparator()
{
    const AnsiString SeparatorString = "------------------------------";
    SendDebugEx(SeparatorString, mtInformation);
}
void SendDebugFmt(const AnsiString &Msg, const TVarRec *Args)
{
    SendDebugEx(Msg.Format(Msg, Args, sizeof(Args)), mtInformation);
}
void SendDebugFmtEx(const AnsiString &Msg, const TVarRec *Args, TMsgDlgType MType)
{
    SendDebugEx(Msg.Format(Msg, Args, sizeof(Args)), MType);
}

HWND StartDebugWin()
{
    AnsiString DebugFilename;
    char Buf[MAX_PATH + 1];
    TStartupInfo si;
    TProcessInformation pi;

    MsgPrefix = "";

    HWND Result = 0;
    if (PastFailedAttemptToStartDebugWin)
        exit;

    TRegIniFile *File = new TRegIniFile("\\Software\\GExperts");
    __try
    {
        DebugFilename = File->ReadString("Debug", "FilePath", "");
    }
    __finally
    {
        delete File;
    }

    if (DebugFilename.Trim() == "")
    {
        GetModuleFileName(NULL, Buf, sizeof(Buf)-1);
        DebugFilename = ExtractFilePath(StrPas(Buf))+"GDebug.exe";
    }
    if (DebugFilename.Trim() == "" (!FileExists(DebugFilename)))
    {
        PastFailedAttemptToStartDebugWin = true;
        exit;
    }

    memset(&si, '\0', sizeof(si));
    si.cb          = sizeof(si);
    si.dwFlags     = STARTF_USESHOWWINDOW;
    si.wShowWindow = SW_SHOW;
    if (!CreateProcess(DebugFilename.c_str(), NULL,
                       NULL, NULL,
                       false, 0, NULL, NULL,
                       &si, &pi))
    {
        PastFailedAttemptToStartDebugWin = true;
        exit;
    }
    __try
    {
        WaitForInputIdle(pi.hProcess, 3000); // wait for 3 seconds to get idle
    }
    __finally
    {
        CloseHandle(pi.hThread);
        CloseHandle(pi.hProcess);
    }
    Result = FindWindow("TfmDebug", NULL);
    return Result;
}
#endif DBUGINTF_H


主站蜘蛛池模板: 一级做a爰全过程免费视频毛片 | 日本高清不卡网站免费 | 四虎国产精品永久在线 | 伊人看片| 亚洲第一网站快活影院 | 中文字幕第一页在线 | 亚洲欧美自拍另类图片色 | 日韩精品亚洲一级在线观看 | 热の综合热の国产热の潮小说 | 天天操天天爽天天射 | 综合网婷婷 | 香蕉成人啪国产精品视频综合网 | 亚洲aav | 青娱乐视觉盛宴在线视频 | 青青草免费在线观看视频 | 午夜亚洲福利 | 小明永久免费看aⅴ片 | 色网址在线 | 亚洲第一视频在线 | 亚洲福利二区 | 色视在线| 日韩视频中文字幕专区 | 手机在线观看mv网址 | 泰剧不期而爱第三季免费全集观看 | 欧美亚洲综合视频 | 青青草a国产免费观看 | 色吊丝国产永久免费网址 | 色图自拍偷拍 | 日韩免费不卡 | 亚洲国产第一页 | 亚洲光棍天堂 | 亚洲专区在线播放 | 四虎永久在线观看 | 四虎影院海外永久 | 日本翁熄系列乱在线视频 | 色香天天| 色噜噜狠狠色综合中国 | 最新69堂国产成人精品视频 | 亚洲图片在线欧美专区图片 | 亚洲综合九九 | 欧美在线视频免费看 |