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

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

在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:     yuanhen88@hotmail.com
            yuanhen88@mail.china.com
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爰性视频 | 日韩视频免费 | 亚洲a在线播放 | 一本草久 | 亚洲 欧美 国产 日韩 制服 bt | 亚洲成年男人的天堂网 | 色橹橹欧美在线观看视频高清免费 | 日韩在线视频观看 | 人人干日日干 | 日本视频免费播放 | 天天综合天天干 | 日韩欧美一区二区三区中文精品 | 香港aa三级久久三级不卡 | 啪啪婷婷| 亚洲视频在线观看免费 | 日产国语一区二区三区在线看 | 亚洲国产成人久久99精品 | 天天干2018 | 日韩精品视频免费网址 | 中文字幕一区二区三区免费视频 | 日韩综合久久 | 日本三级在线播放线观看2021 | 综合亚洲欧美 | 五月婷婷丁香综合网 | 日韩免费在线视频 | 五月婷色| 四虎影院最新网址 | 午夜看毛片 | 天天射天天操天天干 | 全免费一级午夜毛片 | 欧美午夜视频一区二区 | 小视频在线观看免费 | 五月花精品视频在线观看 | 天天操天天摸天天碰 | 日韩中文字幕a | 爽爽影院在线18观看 | 亚洲永久视频 |