techvdoc.gif (3031 bytes)


Short Description:

Visual DocPro parses C/C++, Pascal and Visual Basic code and formats it in a user defined format.

vdoc1.gif (65378 bytes)

Tools Used:

Visual DocPro is written in Microsoft Visual Basic 5.0. It uses Microsoft Word as an OLE Automation server. I chose this path because it is very easy to search for patterns and change the format in MS Word.

 

Example:

Following is an example of some C/C++ code taken from WinSQL project.

/*
* Designed and implemented by Imran Hussain. The author can be reached at
* imranh@summitdata.com. WinSQL is distributed freely. However, the source code cannot
* be modified without author's permission. It uses direct ODBC calls to connect
* to different databases. It uses ODBC 3.0 API and will work will ODBC 2.0 compliant
* drivers.
*/

//---------------------------------------------------------------------------

#include <vcl.h>
#include <stdlib.h>
#include "Work.h"
#include "Login.h"
#include "Glob.h"
#include "qThread.h"

//---------------------------------------------------------------------------

 

TfrmWork *frmWork;

//---------------------------------------------------------------------------

TTextAttributes* __fastcall TfrmWork::CurrText(void)
{
   return txtQuery->SelAttributes;
}

//---------------------------------------------------------------------------

__fastcall TfrmWork::TfrmWork(TComponent* Owner): TForm(Owner)
{

}

//---------------------------------------------------------------------------

void __fastcall TfrmWork::btnOpenClick(TObject *Sender)
{
   if(dlgOpenFile->Execute()){
        txtQuery->Lines->LoadFromFile(dlgOpenFile->FileName);
        ChangeRangeFormat(1);

        Caption = "Query - " + dlgOpenFile->FileName;
        fileName = dlgOpenFile->FileName;
    }

}

//---------------------------------------------------------------------------

bool TfrmWork::GetFirstKeywordPos(AnsiString Input, int& start, int& end){
//This function finds if there was a key word found in the string.
//It returns the start and end position of the first keyword found.

int Pos;
Pos = Input.LowerCase().Pos("select");
   if(Pos == 0) return false;

    start = Pos;
    end = Pos + 6;
   return true;
}