Getting Started with the ActiveGanttVC Gantt Chart Scheduler Component

Saturday, September 24, 2011

ActiveGanttVC is an ActiveX Gantt Chart / Scheduler component designed for Visual C++, Visual Basic 6, Microsoft Access applications and practically any application that supports ActiveX controls. This is a complete tutorial that describes how to get started with the ActiveGanttVC Component. It covers installing the component, as well as creating very simple Visual C++, Visual Basic 6 and Microsoft Access applications with ActiveGanttVC.

1. ActiveGanttVC Requirements

2. Downloading the ActiveGanttVC component.

3. Installing the ActiveGanttVC component.

4. Examining the files created by the ActiveGanttVC install program.

      4.1. The ActiveGanttVC HTML Help Shortcut.

      4.2. The ActiveGanttVC MFC Demo Project Shortcut

      4.3. The ActiveGanttVC MFC Demo Executable Shortcut.

      4.4. The ActiveGanttVC VB6 Demo Project Shortcut.

      4.5. The ActiveGanttVC VB6 Demo Executable Shortcut.

      4.6. The ActiveGanttVC Access 2003-2010 Example.

5. How to create a simple MFC Visual C++ application using the ActiveGanttVC component.

6. How to create a simple Visual Basic 6 application using the ActiveGanttVC component.

7. How to create a simple Microsoft Access 2010 application using the ActiveGanttVC component.

1. ActiveGanttVC Requirements.

For developing applications with ActiveGanttVC:

For deploying your applications that use ActiveGanttVC:

Notes:

2. Downloading the ActiveGanttVC component.

The latest version of the ActiveGanttVC component is accessible from this page in our website:

http://www.sourcecodestore.com/TrialDownloads/ActiveGantt/Default.aspx

Select ActiveGanttVC from the drop down list and press the Download Now button, select the destination directory (this procedures varies according to the type of browser being used) and begin downloading.

The ActiveGanttVC install program is packaged in a compressed .zip file. The file names are structured according to the following convention:

Microsoft Foundation Classes versions are being released by Microsoft simultaneously with .NET framework versions, but ActiveGanttVC is unmanaged code and does not depend on the .NET framework.

3. Installing the ActiveGanttVC component.

Downloading will have left you with a file named AGVC_NETXX_X_X_X(D/R).zip.

The ActiveGanttVC install program does not contain any spyware, viruses or useless third party tools.

 

This .zip file contains two files: the .msi install package and a readme file in .rtf format. The readme file can be viewed using Microsoft Word or Word Pad.

 

Extract both files from the .zip file

 

Double click on the AGVC_NETXX_X_X_X(D/R).msi file to begin the install process. In Windows Vista and above you will get a security prompt. Click on the Run button to continue.

 

You will be taken to the welcome screen of the ActiveGanttVC installation program. Click on the Next button.

 

You will then be prompted for the installation directory. Click on the Next button.

 

The install program will ask for your confirmation before beginning to install ActiveGanttVC, click on the Next button.

 

Another security screen will ask you if you want the ActiveGanttVC install program to copy software onto your computer. Click on the Yes button.

 

After the ActiveGanttVC installation program finishes copying files to your computer, a browser window will open which contains all the above setup instructions plus any version specific information that might be of use.

 

Click on the Close button to terminate the installation of ActiveGanttVC.

 

The ActiveGanttVC component can now be uninstalled using the control panel. Always use the control panel application to uninstall ActiveGanttVC. After uninstalling the ActiveGanttVC component you can also erase the "C:\Program Files\Boötes Systems SAS\ActiveGanttVC\" directory for a complete uninstall.

You must completely uninstall the ActiveGanttVC component when upgrading to a more recent version or when switching from the Trial to the Release version.

4. Examining the files created by the ActiveGanttVC install program.

On a default install of the ActiveGanttVC component, all files will be copied to the "C:\Program Files\Boötes Systems SAS\ActiveGanttVC\" directory.

The most important files in this directory are:

Path File Description
C:\Program Files\Boötes Systems SAS\ActiveGanttVC\ AGVC_TR.sln The MFC C++ Visual Studio solution file.
C:\Program Files\Boötes Systems SAS\ActiveGanttVC\AGVCCON\Release AGVCCON.exe The MFC C++ executable file.
C:\Program Files\Boötes Systems SAS\ActiveGanttVC\AGVCCONVB6\ AGVCCONVB6.vbp The example's VB6 project file
C:\Program Files\Boötes Systems SAS\ActiveGanttVC\ AGVCCONVB6\ AGVCCONVB6.exe The example's VB6 executable file
C:\Program Files\Boötes Systems SAS\ActiveGanttVC\ AGVCCONACC2003\ AGVCCONACC2003.mdb The AGVC Access 2003-2010 example
C:\Program Files\Boötes Systems SAS\ActiveGanttVC\AGVC\Release\ AGVC.ocx The ActiveGanttVC ActiveX Control
C:\Program Files\Boötes Systems SAS\ActiveGanttVC\Additional Files\ AGVC.chm The ActiveGanttVC compiled HTML Help file

 

The install program will generate four shortcuts on the desktop, the ActiveGanttVC folder is a shortcut to the Visual Basic 6 and Access example files, the Regsvr32UI.exe is a shortcut to a graphical Active-X install/uninstall tool (more information on the Regsvr32UI.exe tool can be found in this article), the ActiveGanttVC MFC Demo Project is a shortcut to the AGVC_TR.sln file and the ActiveGanttVC MFC Demo Executable is a shortcut to the AGVCCON.exe file.

 

The install program will also create an ActiveGanttVC menu in Programs. This menu contains a shortcut to the folder were the AGVC.ocx file is stored, a shortcut to the ActiveGanttVC help file , a shortcut to the Regsvr32UI.exe utility, and shortcuts to the MFC C++, Visual Basic 6 and Microsoft Access 2003-2010 examples.

4.1. The ActiveGanttVC HTML Help Shortcut.

 

Clicking on the ActiveGanttVC Help shortcut in the ActiveGanttVC menu will bring up the local HTML help file for the component.

 

This help file is also available online from this link:

http://www.sourcecodestore.com/Documentation/DOCFrameset.aspx?PN=AG&PL=VC

4.2. The ActiveGanttVC MFC Demo Project Shortcut.

Clicking on the ActiveGanttVC MFC Demo Project shortcut will generate an elevated permissions prompt in the operating system. Click on the Restart this application under different credentials option.

 

You will then get a User Access Control prompt. Click on the Yes button.

 

You will then get access to the AGVC_TR.sln Visual Studio solution file.

The Visual Studio solution file contains all the source code for the ActiveGanttVC MFC example. You can press the F5 key to begin debuging.

4.3. The ActiveGanttVC MFC Demo Executable Shortcut.

 

Clicking on the ActiveGanttVC MFC Demo Executable will bring up this screen.

The ActiveGanttVC Demo has two main examples:

Both examples have two modes:

Additionally the ActiveGanttVC MFC Demo has three examples on how to read Microsoft Project 2003, 2007 and 2010 XML files.

All the code used to generate this demo is included in the AGVC_TR.sln Visual Studio Solution.

*Microsoft has not released and does not intend to release an ODBC driver for Access databases for x64 systems and therefore, the Access data source mode is not available when running the demo in 64 bit mode on a 64 bit system.

4.4. The ActiveGanttVC VB6 Demo Project Shortcut.

The Visual Basic 6 demo project shortcut is located in Desktop->ActiveGanttVC->Visual Basic 6.

 

By clicking on the ActiveGanttVC VB6 Demo Project shortcut you will get access to the AGVCCONVB6.vbp Visual Basic project file.

The Visual Basic project file contains all the source code for the ActiveGanttVC VB6 example. You can press the F5 key to begin debuging.

4.5. The ActiveGanttVC VB6 Demo Executable Shortcut.

The Visual Basic 6 demo executable shortcut is located in Desktop->ActiveGanttVC->Visual Basic 6.

 

Clicking on the ActiveGanttVC VB6 Demo Executable will bring up this screen.

The ActiveGanttVC VB6 Demo has two main examples:

Both examples have two modes:

Additionally the ActiveGanttVC VB6 Demo has three examples on how to read Microsoft Project 2003, 2007 and 2010 XML files.

All the code used to generate this demo is included in the AGVCCONVB6.vbp Visual Basic project file.

*Microsoft has not released and does not intend to release an ODBC driver for Access databases for x64 systems and therefore, the Access data source mode is not available when running the demo in 64 bit mode on a 64 bit system.

4.6. The ActiveGanttVC Access 2003-2010 Example.

The Microsoft Access demo shortcut is located in Desktop->ActiveGanttVC->Microsoft Access 2003-2010.

This demo is in Access 2003 format but can be upgraded to Access 2007 or 2010

 

Clicking on the ActiveGanttVC Access 2003-2010 Example shortcut will open Microsoft Access.

The ActiveGanttVC Access Example has two main examples:

Additionally the ActiveGanttVC Access Example has three examples on how to read Microsoft Project 2003, 2007 and 2010 XML files.

All the code used to generate this demo is included in the AGVCCONACC2003.mdb Access file.

*Microsoft has not released and does not intend to release an ODBC driver for Access databases for x64 systems and therefore, the Access data source mode is not available when running the demo in 64 bit mode on a 64 bit system.

5. How to create a simple MFC Visual C++ application using the ActiveGanttVC component.

Start a new instance of Visual Studio.

Select   File -> New -> Project....

 

In the New Project dialog select   Installed Templates -> Visual C++ -> MFC Application. We will name the solution: MFCApplication1.

 

Clicking on the OK button will take you to the welcome screen of the MFC Application Wizard.

 

Click on the Next button. Change the Application Type to Dialog Based.

 

Click on the Finish button. The wizard will create a skeleton MFC application with one dialog: MFCApplication1Dlg and will redirect you to Resource View. Remove the "TODO" Static label and remove the OK and Cancel buttons and make the whole dialog bigger.

 

Right click on any empty spot inside the dialog and select Insert ActiveX Control from the drop down menu.

 

An Insert ActiveX Control dialog will pop up. Select ActiveGanttVC Scheduler Component and press the OK button.

 

Resize the ActiveGanttVC component to an appropriate size.

Important: Do not use the Add Member Variable Wizard as it will create unusable wrapper classes for the control. Adding a member variable for ActiveGanttVC must be done manually.

In a default installation the wrapper classes for the ActiveGanttVC Scheduler Component will be installed in the "C:\Program Files\The Source Code Store LLC\ActiveGanttVC\AGVCCON\AGVC_WRAPPERS\" folder. Wrappers come bundled in a single .h and .cpp file (ActiveGanttVCWrappers.h and ActiveGanttVCWrappers.cpp), or can also be included as separate individual files. The big advantage of using the bundled single file approach will be appreciated when having to upgrade to a newer version of the ActiveGanttVC Scheduler Component.

 

Copy ActiveGanttVCWrappers.h, ActiveGanttVCWrappers.cpp, MSP2003Wrappers.h, MSP2003Wrappers.cpp, MSP2007Wrappers.h, MSP2007Wrappers.cpp, MSP2010Wrappers.h and , MSP2010Wrappers.cpp from "C:\Program Files\The Source Code Store LLC\ActiveGanttVC\AGVCCON\AGVC_WRAPPERS\" to the MFC application's folder (in this case: "C:\Users\Admin7\Documents\Visual Studio 2010\Projects\MFCApplication1\MFCApplication1"). The wrappers must be on the same physical directory as the MFC project's stdafx.h file. MSP20XXWrappers are only necessary if you want to read Microsoft Project XML files.

Include the following lines at the end of your project's stdafx.h file:



// ActiveGanttVC
#include "ActiveGanttVCWrappers.h"
using namespace ActiveGanttVC;

Open MFCApplication1Dlg.h and declare the following:



// MFCApplication1Dlg.h : header file
//

#pragma once


// CMFCApplication1Dlg dialog
class CMFCApplication1Dlg : public CDialogEx
{
...

CActiveGanttVCCtl    ActiveGanttVCCtl1;

...
};

Open MFCApplication1Dlg.cpp and modify the DoDataExchange function as follows:



void CMFCApplication1Dlg::DoDataExchange(CDataExchange* pDX)
{
    CDialogEx::DoDataExchange(pDX);
    DDX_Control(pDX, IDC_ACTIVEGANTTVCCTL1, ActiveGanttVCCtl1);
}

The MFCApplication1Dlg.cpp contains implementation functions for CMFCApplication1Dlg and CAboutDlg. Make sure that you are adding the above code in the CMFCApplication1Dlg DoDataExchange function.

Press the F5 key to begin debugging.

 

At this time you will only have an ActiveGanttVC control with no functionality. The watermark on the lower right hand side will only be present in the trial version of the ActiveGanttVC Scheduler Component.

Close the dialog to exit debugging. Open MFCApplication1Dlg.cpp. In the MFCApplication1Dlg.cpp::OnInitDialog function under "// TODO: Add extra initialization here", add the following code:



BOOL CMFCApplication1Dlg::OnInitDialog()
{
    CDialogEx::OnInitDialog();

       ...


    // TODO: Add extra initialization here
    int i;
    ActiveGanttVCCtl1.GetColumns().Add(_T("Column 1"), _T(""), 125, _T(""));
    ActiveGanttVCCtl1.GetColumns().Add(_T("Column 2"), _T(""), 100, _T(""));
    for (i = 1; i <= 10; i++)
    {
        CString si = _T("");
        si.Format(_T("%d"), i);
        ActiveGanttVCCtl1.GetRows().Add(_T("K") + si, _T("Row") + si, TRUE, TRUE, _T(""));
    }

    return TRUE;  // return TRUE  unless you set the focus to a control
}

The above code will create two Columns and ten empty Rows (Rows without any task objects). Notice that every Row has to be identified by a unique key: "K1", "K2", K3", etc. Press the F5 key to begin debugging.

 

All the Rows have been merged so that individual Cells are not visible.

You can also change the add row line to:



ActiveGanttVCCtl1.GetRows().Add(_T("K") + si, _T("Row") + si, FALSE, TRUE, _T(""));

To make Cells visible (if Cells are visible then the Row is split into columns).

 

You can now add Task objects by clicking and dragging over any Row in the Client Area of the ActiveGanttVC control.

You can also add Task objects programmatically:



BOOL CMFCApplication1Dlg::OnInitDialog()
{
    CDialogEx::OnInitDialog();

    ....

    // TODO: Add extra initialization here
    int i;
    ActiveGanttVCCtl1.GetColumns().Add(_T("Column 1"), _T(""), 125, _T(""));
    ActiveGanttVCCtl1.GetColumns().Add(_T("Column 2"), _T(""), 100, _T(""));
    for (i = 1; i <= 10; i++)
    {
        CString si = _T("");
        si.Format(_T("%d"), i);
        ActiveGanttVCCtl1.GetRows().Add(_T("K") + si, _T("Row") + si, TRUE, TRUE, _T(""));
    }

    ActiveGanttVCCtl1.GetCurrentViewObject().GetTimeLine().Position(GetDateTime(2011, 11, 2, 0, 0, 0));
    ActiveGanttVCCtl1.GetTasks().Add(_T("Task 1"), _T("K1"), GetDateTime(2011, 11, 2, 0, 0, 0), GetDateTime(2011, 11, 2, 3, 0, 0), _T(""), _T(""), _T(""));
    ActiveGanttVCCtl1.GetTasks().Add(_T("Task 2"), _T("K2"), GetDateTime(2011, 11, 2, 1, 0, 0), GetDateTime(2011, 11, 2, 4, 0, 0), _T(""), _T(""), _T(""));
    ActiveGanttVCCtl1.GetTasks().Add(_T("Task 3"), _T("K3"), GetDateTime(2011, 11, 2, 2, 0, 0), GetDateTime(2011, 11, 2, 5, 0, 0), _T(""), _T(""), _T(""));


    return TRUE;  // return TRUE  unless you set the focus to a control
}


GetDateTime is defined as:



CDateTime GetDateTime(int nYear, int nMonth, int nDay)
{
    CDateTime dtReturn;
    dtReturn.CreateDispatch(_T("AGVC.DateTime"));
    dtReturn.SetDateTime(nYear,nMonth, nDay, 0, 0, 0);
    return dtReturn;
}

CDateTime GetDateTime(int nYear, int nMonth, int nDay, int nHour, int nMin, int nSec)
{
    CDateTime dtReturn;
    dtReturn.CreateDispatch(_T("AGVC.DateTime"));
    dtReturn.SetDateTime(nYear,nMonth, nDay, nHour, nMin, nSec);
    return dtReturn;
}

 

The above code will produce this result.

The examples included in the MFC demo cover almost every piece of functionality present in the ActiveGanttVC component, but if you need further assistance please read our ActiveGantt support options. Important: if you are sending an e-mail you have to specify that you are referring to the ActiveGanttVC component, otherwise you will inevitably experience delays in having your query answered.

6. How to create a simple Visual Basic 6 application using the ActiveGanttVC component.

Start a new instance of Visual Basic 6.

 

In the New Project dialog select Standard EXE.

 

The IDE will create a project named Project1 with a single form called Form1. Resize Form1 to an appropriate size.

 

Go to Project -> Components. Once in the Components dialog box select ActiveGanttVC Scheduler Component and press the OK button.

 

The ActiveGanttVC Scheduler Component will now be present in the lower right hand side of the Toolbar.

 

Select the icon in the Toolbar and click and drag a rectangular area inside Form1. Resize as appropriate.

 

Press the F5 key to begin debugging. At this time you will only have an ActiveGanttVC control with no functionality. The watermark on the lower right hand side will only be present in the trial version of the ActiveGanttVC component.

Close Form1 to exit debugging.

Right click on Form1 and select View Code. Include the following code:



Option Explicit

Private Sub Form_Load()
    Dim i As Integer
    ActiveGanttVCCtl1.Columns.Add "Column 1", "", 125, ""
    ActiveGanttVCCtl1.Columns.Add "Column 2", "", 100, ""
    For i = 1 To 10
        ActiveGanttVCCtl1.Rows.Add "K" & i, "Row " & i, True, True, ""
    Next
End Sub

The above code will create two Columns and ten empty Rows (Rows without any task objects). Notice that every Row has to be identified by a unique key: "K1", "K2", K3", etc. Press the F5 key to begin debugging.

 

All the Rows have been merged so that individual Cells are not visible.

You can also change the add row line to:



ActiveGanttVCCtl1.Rows.Add "K" & i, "Row " & i, False, True, ""

To make Cells visible (if Cells are visible then the Row is split into columns).

 

You can now add Task objects by clicking and dragging over any Row in the Client Area of the ActiveGanttVC control.

You can also add Task objects programmatically:



Option Explicit

Private Sub Form_Load()
    Dim i As Integer
    ActiveGanttVCCtl1.Columns.Add "Column 1", "", 125, ""
    ActiveGanttVCCtl1.Columns.Add "Column 2", "", 100, ""
    For i = 1 To 10
        ActiveGanttVCCtl1.Rows.Add "K" & i, "Row " & i, True, True, ""
    Next
    
    ActiveGanttVCCtl1.CurrentViewObject.TimeLine.Position DateSerial(2011, 11, 2)
    ActiveGanttVCCtl1.Tasks.Add "Task 1", "K1", DateSerial(2011, 11, 2) + TimeSerial(0, 0, 0), DateSerial(2011, 11, 2) + TimeSerial(3, 0, 0), "", "", ""
    ActiveGanttVCCtl1.Tasks.Add "Task 2", "K2", DateSerial(2011, 11, 2) + TimeSerial(1, 0, 0), DateSerial(2011, 11, 2) + TimeSerial(4, 0, 0), "", "", ""
    ActiveGanttVCCtl1.Tasks.Add "Task 3", "K3", DateSerial(2011, 11, 2) + TimeSerial(2, 0, 0), DateSerial(2011, 11, 2) + TimeSerial(5, 0, 0), "", "", ""
End Sub

 

The above code will produce this result.

The examples included in the VB6 demo cover almost every piece of functionality present in the ActiveGanttVC component, but if you need further assistance please read our ActiveGantt support options. Important: if you are sending an e-mail you have to specify that you are referring to the ActiveGanttVC component, otherwise you will inevitably experience delays in having your query answered.

7. How to create a simple Microsoft Access 2010 application using the ActiveGanttVC component.

Start a new instance of Microsoft Access 2010.

 

Select Blank Database from Available Templates. Click on the Create button on the right.

 

Go to the File tab on the left hand side and select Options near the bottom.

 

In the Access Options dialog box select Trust Center. Click on the Trust Center Settings button.

 

Select the Enable all controls without restrictions and without prompting option and uncheck the Safe Mode check box.

 

Select the Create tab and click on Blank Form.

 

Right click on the Form1 tab and select Design View.

 

Form1 will now be ready to accept incoming ActiveX controls.

 

Click on the Design tab and on the lower right hand side click on the More button.

 

Select the ActiveX Controls option.

 

In the Insert Active Control dialog select ActiveGanttVC Scheduler Component.

 

Resize the ActiveGanttVC Component to an appropriate size.

 

Right click on the Form1 tab and select Form View.

 

At this time you will only have an ActiveGanttVC control on a Form with no functionality. The watermark on the lower right hand side will only be present in the trial version of the ActiveGanttVC component.

 

Switch back to Design View. Right click on the ActiveGanttVC control and select Propertries to bring up the properties window. Change the name from ActiveGantCtl0 to ActiveGanttCtl1A.

 

Select View Code from the options on the top left hand corner.

Insert the following code:



Option Compare Database
Option Explicit

Public Function ActiveGanttVCCtl1() As ActiveGanttVCCtl
    Set ActiveGanttVCCtl1 = ActiveGanttVCCtl1A.Object
End Function

Private Sub Form_Load()
    Dim i As Integer
    ActiveGanttVCCtl1.Columns.Add "Column 1", "", 125, ""
    ActiveGanttVCCtl1.Columns.Add "Column 2", "", 100, ""
    For i = 1 To 10
        ActiveGanttVCCtl1.Rows.Add "K" & i, "Row " & i, True, True, ""
    Next
End Sub

The ActiveGanttVCCtl1 function, allows the control to have intellisense in Visual Basic for Applications (VBA).

 

Close the VBA window, and switch to Form View. The above code will create two Columns and ten empty Rows (Rows without any task objects). Notice that every Row has to be identified by a unique key: "K1", "K2", K3", etc. All the Rows have been merged so that individual Cells are not visible.

You can also change the add row line to:



ActiveGanttVCCtl1.Rows.Add "K" & i, "Row " & i, False, True, ""

To make Cells visible (if Cells are visible then the Row is split into columns).

 

You can now add Task objects by clicking and dragging over any Row in the Client Area of the ActiveGanttVC control.

You can also add Task objects programmatically:



Option Compare Database
Option Explicit

Public Function ActiveGanttVCCtl1() As ActiveGanttVCCtl
    Set ActiveGanttVCCtl1 = ActiveGanttVCCtl1A.Object
End Function

Private Sub Form_Load()
    Dim i As Integer
    ActiveGanttVCCtl1.Columns.Add "Column 1", "", 125, ""
    ActiveGanttVCCtl1.Columns.Add "Column 2", "", 100, ""
    For i = 1 To 10
        ActiveGanttVCCtl1.Rows.Add "K" & i, "Row " & i, True, True, ""
    Next
    ActiveGanttVCCtl1.CurrentViewObject.TimeLine.Position DateSerial(2011, 11, 2)
    ActiveGanttVCCtl1.Tasks.Add "Task 1", "K1", DateSerial(2011, 11, 2) + TimeSerial(0, 0, 0), DateSerial(2011, 11, 2) + TimeSerial(3, 0, 0), "", "", ""
    ActiveGanttVCCtl1.Tasks.Add "Task 2", "K2", DateSerial(2011, 11, 2) + TimeSerial(1, 0, 0), DateSerial(2011, 11, 2) + TimeSerial(4, 0, 0), "", "", ""
    ActiveGanttVCCtl1.Tasks.Add "Task 3", "K3", DateSerial(2011, 11, 2) + TimeSerial(2, 0, 0), DateSerial(2011, 11, 2) + TimeSerial(5, 0, 0), "", "", ""
End Sub

 

The above code will produce this result.

The examples included in the Access 2003-2010 demo cover almost every piece of functionality present in the ActiveGanttVC component, but if you need further assistance please read our ActiveGantt support options. Important: if you are sending an e-mail you have to specify that you are referring to the ActiveGanttVC component, otherwise you will inevitably experience delays in having your query answered.

All trademarks are property of their respective holders, and are only used to directly describe the products and services being provided. Their use in no way indicates any relationship or endorsement between The Source Code Store LLC and the holders of said trademarks.