ExICalendar Frequently Asked Questions
ExICalendar FAQ | Exontrol Docs
1:
The control's release notes can be found on our web site, looking for the Release Notes column in the control's main page. Click here for direct link.
2:
The ICalendar library is a COM component that can be used in a registration-free manner, which means that it can be activated without being registered in the Windows registry. This is achieved through the use of an assembly manifest, which contains metadata about the component and its dependencies. The control's assembly manifest is:
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
	<assemblyIdentity name="exicalendar.X" version="10.0.0.1" type="win32" processorArchitecture="x86"></assemblyIdentity>
	<file name="exicalendar.dll" hashalg="SHA1">
		<comClass clsid="{D6C87100-38E2-4ABB-8AC2-4C0097AEE2D6}" tlbid="{13892953-B45F-470C-8AAC-A4D0EC376DA0}" progid="Exontrol.ICalendar.1" description="ICalendar Class"></comClass>
		<comClass clsid="{585997D0-7A9A-4163-A067-5F03B677E721}" tlbid="{13892953-B45F-470C-8AAC-A4D0EC376DA0}" progid="ExICalendar.Component.1" description="Component Class"></comClass>
		<comClass clsid="{A245500A-1569-4047-9852-229C206F3223}" tlbid="{13892953-B45F-470C-8AAC-A4D0EC376DA0}" progid="ExICalendar.Components.1" description="Components Class"></comClass>
		<comClass clsid="{99036FF6-3E52-4EDD-BF3A-C9382A0BC9F5}" tlbid="{13892953-B45F-470C-8AAC-A4D0EC376DA0}" progid="ExICalendar.Properties.1" description="Properties Class"></comClass>
		<comClass clsid="{A6082B7F-8FE0-44A1-8769-7B73D6DA75B2}" tlbid="{13892953-B45F-470C-8AAC-A4D0EC376DA0}" progid="ExICalendar.Property.1" description="Property Class"></comClass>
		<comClass clsid="{6369497C-0030-4558-B4F8-DF05332327BC}" tlbid="{13892953-B45F-470C-8AAC-A4D0EC376DA0}" progid="ExICalendar.Parameters.1" description="Parameters Class"></comClass>
		<comClass clsid="{F6A7988E-A60B-447C-B5FE-E1DA98F0E5CE}" tlbid="{13892953-B45F-470C-8AAC-A4D0EC376DA0}" progid="ExICalendar.Parameter.1" description="Parameter Class"></comClass>
		<typelib tlbid="{13892953-B45F-470C-8AAC-A4D0EC376DA0}" version="1.0" helpdir="" flags="HASDISKIMAGE"></typelib>
	</file>
	<comInterfaceExternalProxyStub name="IProperties" iid="{86F9FF3F-4AE0-441B-A099-ED28DE0A21F3}" tlbid="{13892953-B45F-470C-8AAC-A4D0EC376DA0}" proxyStubClsid32="{00020424-0000-0000-C000-000000000046}"></comInterfaceExternalProxyStub>
	<comInterfaceExternalProxyStub name="IComponents" iid="{A1336AEE-CF5E-4A86-A86A-4F0FB75B1CC4}" tlbid="{13892953-B45F-470C-8AAC-A4D0EC376DA0}" proxyStubClsid32="{00020424-0000-0000-C000-000000000046}"></comInterfaceExternalProxyStub>
	<comInterfaceExternalProxyStub name="IProperty" iid="{AE48CD7D-2F1A-40D9-9F07-507706218CE3}" tlbid="{13892953-B45F-470C-8AAC-A4D0EC376DA0}" proxyStubClsid32="{00020424-0000-0000-C000-000000000046}"></comInterfaceExternalProxyStub>
	<comInterfaceExternalProxyStub name="IICalendar" iid="{C4A195D9-6597-46F2-ACAF-860B104040C9}" tlbid="{13892953-B45F-470C-8AAC-A4D0EC376DA0}" proxyStubClsid32="{00020424-0000-0000-C000-000000000046}"></comInterfaceExternalProxyStub>
	<comInterfaceExternalProxyStub name="IComponent" iid="{CD470F49-77B6-4C82-BA14-19E62BDA01AC}" tlbid="{13892953-B45F-470C-8AAC-A4D0EC376DA0}" proxyStubClsid32="{00020424-0000-0000-C000-000000000046}"></comInterfaceExternalProxyStub>
	<comInterfaceExternalProxyStub name="IParameters" iid="{D156D528-0EA3-46E3-AFDD-66D0966003C9}" tlbid="{13892953-B45F-470C-8AAC-A4D0EC376DA0}" proxyStubClsid32="{00020424-0000-0000-C000-000000000046}"></comInterfaceExternalProxyStub>
	<comInterfaceExternalProxyStub name="IParameter" iid="{DD72A320-C88A-4A9B-A805-784FAAA14499}" tlbid="{13892953-B45F-470C-8AAC-A4D0EC376DA0}" proxyStubClsid32="{00020424-0000-0000-C000-000000000046}"></comInterfaceExternalProxyStub>
</assembly>
3:
While running a sample you might encounter the following exception:

An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in exe

Additional information: Retrieving the COM class factory for component with CLSID failed due to the following error: 80040154. 

The most probably you have installed the /COM x86 version ( 32-bit ) of the component on a Windows x64 machine, so in order to prevent this error do any of the following:

  • In VS - project properties - in the Build tab - platform target X86 ( AnyCPU to X86 )
  • Install the x64 version of the component as well, as the application runs as 64-bit on a Windows 64 machine
4:
The ExCalendar component provides a calendar view for displaying and managing events. It supports recurring events based on the iCalendar standard, allowing events to repeat at regular intervals, such as daily, weekly, or monthly. The ICalendar library provides the RecurRange method, which generates a list of occurrences from a given recurrence expression. These occurrences can then be added to the ExCalendar component as individual events.

The idea of adding recurring events to ExCalendar consists in:

  • Handle the DateChanged event of the ExCalendar component
  • Collects the occurrences of the recurrence expression between FirstVisibleDate, LastVisibleDate properties of the ExCalendar component, using the RecurRange method of the ExICalendar library
  • For each occurrence found, add a new events using the Add method of the Events collection of  ExCalendar component

The following VB sample adds recurring events to ExCalendar:

Private Sub Calendar1_DateChanged()
    DoEvents
    With Calendar1
        .BeginUpdate
        Dim o As Variant
        For Each o In CreateObject("Exontrol.ICalendar").RecurRange("DTSTART=20151201;FREQ=WEEKLY;BYDAY=FR", .FirstVisibleDate, .LastVisibleDate)
            .Events.Add(o).Marker = True
        Next
        .EndUpdate
    End With
End Sub

Private Sub Form_Load()
    With Calendar1
        .FirstDay = Monday
        .AlignmentDay = CenterAlignment
        .GridLineColor = RGB(128, 128, 128)
        Calendar1_DateChanged
    End With
End Sub

and you should get:

The following C++ sample adds recurring events to ExCalendar:

void C...Dlg::DateChangedCalendar1()
{
	DoEvents();
	EXCALENDARLib::ICalendarPtr spCalendar1 = GetDlgItem(IDC_CALENDAR1)->GetControlUnknown();
	if ( spCalendar1 != NULL )
	{
		EXCALENDARLib::IEventsPtr spEvents = spCalendar1->Events;
		spCalendar1->BeginUpdate();
		EXICALENDARLib::IICalendarPtr spICal = ::CreateObject(L"Exontrol.ICalendar");
		if ( spICal != NULL )
		{
			_variant_t vtRecurRange = spICal->GetRecurRange(L"DTSTART=20151201;FREQ=WEEKLY;BYDAY=FR",spCalendar1->FirstVisibleDate,spCalendar1->LastVisibleDate);
			if ( V_VT( &vtRecurRange ) == ( VT_ARRAY | VT_DATE ) )
			{
				SAFEARRAY* pArray = V_ARRAY( &vtRecurRange );
				DATE* pData = NULL;
				if ( SUCCEEDED( SafeArrayAccessData( pArray, (LPVOID*)&pData ) ) )
				{
					long lowerBound = 0, upperBound = 0;
					SafeArrayGetLBound(pArray, 1 , &lowerBound);
					SafeArrayGetUBound(pArray, 1, &upperBound);
					long nCount = upperBound - lowerBound + 1; 
					SafeArrayUnaccessData( pArray );
					for ( long i = 0; i < nCount; i++, pData++ )  // iterate through returned values
						spEvents->Add( *pData )->Marker = VARIANT_TRUE;
				}
			}
		}
		spCalendar1->EndUpdate();
	}
}


BOOL C...Dlg::OnInitDialog()
{
	CDialogEx::OnInitDialog();

	...

	EXCALENDARLib::ICalendarPtr spCalendar1 = GetDlgItem(IDC_CALENDAR1)->GetControlUnknown();
	if ( spCalendar1 != NULL )
	{
		spCalendar1->PutAlignmentDay(EXCALENDARLib::CenterAlignment);
		spCalendar1->PutFirstDay(EXCALENDARLib::Monday);
		spCalendar1->PutGridLineColor(RGB(128,128,128));

		DateChangedCalendar1();
	}

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

The following C++ sample defines the CreateObject and DoEvents functions:

#include <comdef.h>
IUnknownPtr CreateObject( BSTR Object )
{
	IUnknownPtr spResult;
	spResult.CreateInstance( Object );
	return spResult;
};

void DoEvents()
{
	MSG m = {0};
	while ( PeekMessage( &m, NULL, NULL, NULL, PM_REMOVE ) )
	{
		TranslateMessage( &m );
		DispatchMessage( &m );
	}
}    

The following C# sample adds recurring events to ExCalendar:

private void axCalendar1_DateChanged(object sender, EventArgs e)
{
    Application.DoEvents();

    if (iCal != null)
    {
        axCalendar1.BeginUpdate();
        axCalendar1.Events.Clear();
        foreach (System.DateTime d in ( iCal.get_RecurRange("DTSTART=20151201;FREQ=WEEKLY;BYDAY=FR", axCalendar1.FirstVisibleDate, axCalendar1.LastVisibleDate) as Array ))
            axCalendar1.Events.Add(d).Marker = true;
        axCalendar1.EndUpdate();

    }
}

EXICALENDARLib.ICalendar iCal = null;

private void Form1_Load(object sender, EventArgs e)
{
		iCal = new EXICALENDARLib.ICalendar();

		axCalendar1.Appearance = EXCALENDARLib.AppearanceEnum.None2;
		axCalendar1.ShowWeeks = true;
		axCalendar1.Date = Convert.ToDateTime("1/1/2015",System.Globalization.CultureInfo.GetCultureInfo("en-US"));
		axCalendar1.ShowNonMonthDays = false;
		axCalendar1.ShowMonthSelector = false;
		axCalendar1.FirstDay = EXCALENDARLib.WeekDayEnum.Monday;
		axCalendar1.AlignmentDay = EXCALENDARLib.AlignmentEnum.CenterAlignment;
		axCalendar1.GridLineColor = Color.Gray;

}
5:
The ExG2antt/ExGantt component provides a Gantt chart view for displaying and managing tasks. It supports recurring tasks based on the iCalendar standard, allowing tasks to repeat at regular intervals, such as daily, weekly, or monthly. The ICalendar library provides the RecurRange method, which generates a list of occurrences from a given recurrence expression. These occurrences can then be added to the ExG2antt/ExGantt component as individual tasks.

The idea of adding recurring tasks to ExG2antt/ExGantt consists in:

  • Handle the DateChanged event of the ExG2antt component
  • Collects the occurrences of the recurrence expression between first visible date and last visible date, using the RecurRange method of the ExICalendar library
  • For each occurrence found, add a new task using the AddBar method of the Items collection of  ExG2antt component

The following VB sample adds recurring events to ExG2antt:

Function Max(ByVal a As Double, ByVal b As Double) As Double
    Max = IIf(a < b, b, a)
End Function

Private Sub Form_Load()
    With G2antt1
        .BeginUpdate
        .Columns.Add "Tasks"
        .Items.AddItem "Every Friday, starting from 2015, Dec 1st"
        With .Chart
            .LevelCount = 2
            .PaneWidth(0) = 224
            .Bars("Task").Pattern = exPatternSolid
            .FirstVisibleDate = #11/23/2015#
        End With
        .EndUpdate
    End With
End Sub

Private Sub G2antt1_DateChange()
    With G2antt1
        .BeginUpdate
        Dim o As Variant
        For Each o In CreateObject("Exontrol.ICalendar").RecurRange("DTSTART=20151201;FREQ=WEEKLY;BYDAY=FR", .Chart.FirstVisibleDate, Max(.Chart.FirstVisibleDate + (1 + .Chart.PaneWidth(False) + .Chart.PaneWidth(True)) / .Chart.UnitWidth, .Chart.DateFromPoint(1, -1)))
            .Items.AddBar .Items.FirstVisibleItem, "Task", o, o + 1, o
        Next
        .EndUpdate
    End With
End Sub

and you should get:

A few notes:

  • The DateFromPoint(1, -1) property determines the last visible date.
  • The Max(.Chart.FirstVisibleDate + (1 + .Chart.PaneWidth(False) + .Chart.PaneWidth(True)) / .Chart.UnitWidth, .Chart.DateFromPoint(1, -1))), determines the maximum between the last visible date if no columns section is displayed and the currently last visible date
  • The initial FirstVisibleDate should be called after filling the columns/items, so during the DateChange event, the FirstVisibleItem property is NOT zero, so adding bars is possible

The following C++ sample adds recurring events to ExG2antt:

void C...Dlg::DateChangedG2antt1()
{
	EXG2ANTTLib::IG2anttPtr spG2antt1 = GetDlgItem(IDC_G2ANTT1)->GetControlUnknown();
	if ( spG2antt1 != NULL )
	{
		EXG2ANTTLib::IItemsPtr spItems = spG2antt1->Items;
		spG2antt1->BeginUpdate();
		EXIG2ANTTLib::IIG2anttPtr spICal = ::CreateObject(L"Exontrol.ICalendar");
		if ( spICal != NULL )
		{
			_variant_t vtRecurRange = spICal->GetRecurRange(L"DTSTART=20151201;FREQ=WEEKLY;BYDAY=FR",spG2antt1->FirstVisibleDate,spG2antt1->LastVisibleDate);
			if ( V_VT( &vtRecurRange ) == ( VT_ARRAY | VT_DATE ) )
			{
				SAFEARRAY* pArray = V_ARRAY( &vtRecurRange );
				DATE* pData = NULL;
				if ( SUCCEEDED( SafeArrayAccessData( pArray, (LPVOID*)&pData ) ) )
				{
					long lowerBound = 0, upperBound = 0;
					SafeArrayGetLBound(pArray, 1 , &lowerBound);
					SafeArrayGetUBound(pArray, 1, &upperBound);
					long nCount = upperBound - lowerBound + 1; 
					SafeArrayUnaccessData( pArray );
					for ( long i = 0; i < nCount; i++, pData++ )  // iterate through returned values
						spItems->AddBar( spItems->FirstVisibleItem, :L"Task", *pData, *pData, *pData );
				}
			}
		}
		spG2antt1->EndUpdate();
	}
}

The following C++ sample defines the CreateObject and DoEvents functions:

#include <comdef.h>
IUnknownPtr CreateObject( BSTR Object )
{
	IUnknownPtr spResult;
	spResult.CreateInstance( Object );
	return spResult;
};

void DoEvents()
{
	MSG m = {0};
	while ( PeekMessage( &m, NULL, NULL, NULL, PM_REMOVE ) )
	{
		TranslateMessage( &m );
		DispatchMessage( &m );
	}
}
6:
Please check the Repetitive property of the Event object, of the ExSchedule.
7:
The ExICalendar library is a COM component that can be used in a registration-free manner, which means that it can be activated without being registered in the Windows registry. This is achieved through the use of an assembly manifest, which contains metadata about the component and its dependencies.

The following methods:

  • RecurAll
  • RecurAllAsString
  • RecurRange
  • RecurRangeAsString

are limited to 16 occurrences only if:

  • running the trial version of the ExICalendar library ( Please check the Version property of the component, if contains DEMO )
  • RuntimeKey property has not been called, or using invalid key, if running the registered version.

If you are using the registered version, you must call the RuntimeKey property immediately after creating the component.

The following VB sample shows how to use the RuntimeKey property:

Set iCal = CreateObject("Exontrol.ICalendar.1")
With iCal
	.RuntimeKey = "..."
	Debug.Print( .RecurAllAsString("DTSTART=19970805;FREQ=MONTHLY;BYDAY=MO,TU,WE,TH,FR;BYSETPOS=-1",255) )
End With

where "..." represents the runtime license key provided in the email you received when purchasing the component. If you have misplaced this email, please contact us to request your runtime license key.

8:
The Load, LoadFile, and LoadFileU methods load iCalendar data into the component. The Root and Content properties provide access to the root and content components of the loaded format, respectively. Since each component can contain other components, the Count property of the Components collection returns the number of Component objects directly contained in the collection, excluding any nested components.

A) The following VB sample defines a recursive function that counts all Component objects, including nested components, by traversing the component hierarchy:

Function getComponentsCount(ByVal c As EXICALENDARLib.Component) As Long
    Dim nCount As Long, i As EXICALENDARLib.Component
    nCount = c.Components.Count
    For Each i In c.Components
        nCount = nCount + getComponentsCount(i)
    Next
    getComponentsCount = nCount
End Function

and you can call it using a code like: getComponentsCount(iCal.Content)

B) The following VB sample uses the AddComponent event to count all Component objects being loaded:

Dim nComponents As Long
Dim WithEvents iCal As EXICALENDARLib.ICalendar

Private Sub Form_Load()
    Set iCal = New EXICALENDARLib.ICalendar
	nComponents = 0
End Sub


Private Sub iCal_StartLoad()
    nComponents = 0
End Sub

Private Sub iCal_AddComponent(ByVal NewComponent As EXICALENDARLib.IComponent)
    nComponents = nComponents + 1
End Sub

Private Sub iCal_EndLoad()
    Debug.Print (nComponents)
End Sub

where the nComponents member is increased each time the AddComponent event occurs.

How-To Questions
FAQ