exicalendar - sample code

Recur: The last work day of the month?

VBA (MS Access, Excell...)

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

VB6

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

VB.NET

' Add 'exontrol.exicalendar.dll(ExICalendar.dll)' reference to your project.
Exicalendar1 = New exontrol.EXICALENDARLib.exicalendar()
With Exicalendar1
	Debug.Print( .get_RecurAllAsString("DTSTART=19970805;FREQ=MONTHLY;BYDAY=MO,TU,WE,TH,FR;BYSETPOS=-1",12) )
End With

VB.NET for /COM

AxICalendar1 = CreateObject("Exontrol.ICalendar.1")
With AxICalendar1
	Debug.Print( .get_RecurAllAsString("DTSTART=19970805;FREQ=MONTHLY;BYDAY=MO,TU,WE,TH,FR;BYSETPOS=-1",12) )
End With

C++

/*
	Includes the definition for CreateObject function like follows:

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

*/
/*
	Copy and paste the following directives to your header file as
	it defines the namespace 'EXICALENDARLib' for the library: 'ICalendar 1.0 Type Library'

	#import <ExICalendar.dll>
	using namespace EXICALENDARLib;
*/
EXICALENDARLib::IICalendarPtr spICalendar1 = ::CreateObject(L"Exontrol.ICalendar.1");
OutputDebugStringW( _bstr_t(spICalendar1->GetRecurAllAsString(L"DTSTART=19970805;FREQ=MONTHLY;BYDAY=MO,TU,WE,TH,FR;BYSETPOS=-1",long(12))) );

C++ Builder

Exicalendarlib_tlb::IICalendarPtr ICalendar1 = Variant::CreateObject(L"Exontrol.ICalendar.1");
OutputDebugString( PChar(ICalendar1->RecurAllAsString[L"DTSTART=19970805;FREQ=MONTHLY;BYDAY=MO,TU,WE,TH,FR;BYSETPOS=-1",TVariant(12)]) );

C#

// Add 'exontrol.exicalendar.dll(ExICalendar.dll)' reference to your project.
exontrol.EXICALENDARLib.exicalendar exicalendar1 = new exontrol.EXICALENDARLib.exicalendar();
System.Diagnostics.Debug.Print( exicalendar1.get_RecurAllAsString("DTSTART=19970805;FREQ=MONTHLY;BYDAY=MO,TU,WE,TH,FR;BYSETPOS=-1",12).ToString() );

JScript/JavaScript

<BODY onload="Init()">
<OBJECT CLASSID="clsid:D6C87100-38E2-4ABB-8AC2-4C0097AEE2D6" id="ICalendar1"></OBJECT>

<SCRIPT LANGUAGE="JScript">
function Init()
{
	alert( ICalendar1.RecurAllAsString("DTSTART=19970805;FREQ=MONTHLY;BYDAY=MO,TU,WE,TH,FR;BYSETPOS=-1",12) );
}
</SCRIPT>
</BODY>

VBScript

<BODY onload="Init()">
<OBJECT CLASSID="clsid:D6C87100-38E2-4ABB-8AC2-4C0097AEE2D6" id="ICalendar1"></OBJECT>

<SCRIPT LANGUAGE="VBScript">
Function Init()
	With ICalendar1
		alert( .RecurAllAsString("DTSTART=19970805;FREQ=MONTHLY;BYDAY=MO,TU,WE,TH,FR;BYSETPOS=-1",12) )
	End With
End Function
</SCRIPT>
</BODY>

C# for /COM

EXICALENDARLib.ICalendar axICalendar1 = new EXICALENDARLib.ICalendar();
System.Diagnostics.Debug.Print( axICalendar1.get_RecurAllAsString("DTSTART=19970805;FREQ=MONTHLY;BYDAY=MO,TU,WE,TH,FR;BYSETPOS=-1",12).ToString() );

X++ (Dynamics Ax 2009)

public void init()
{
	COM com_exicalendar1;
	anytype exicalendar1;
	;

	super();

	// Add 'exicalendar.dll(ExICalendar.dll)' reference to your project.
	exicalendar1 = COM::createFromObject(new EXICALENDARLib.exicalendar()); com_exicalendar1 = exicalendar1;
	print( com_exicalendar1.RecurAllAsString("DTSTART=19970805;FREQ=MONTHLY;BYDAY=MO,TU,WE,TH,FR;BYSETPOS=-1",COMVariant::createFromInt(12)) );
}

Delphi 8 (.NET only)

AxICalendar1 := (ComObj.CreateComObject(ComObj.ProgIDToClassID('Exontrol.ICalendar.1')) as EXICALENDARLib.ICalendar);
with AxICalendar1 do
begin
	OutputDebugString( get_RecurAllAsString('DTSTART=19970805;FREQ=MONTHLY;BYDAY=MO,TU,WE,TH,FR;BYSETPOS=-1',TObject(12)) );
end

Delphi (standard)

ICalendar1 := (IUnknown(ComObj.CreateComObject(ComObj.ProgIDToClassID('Exontrol.ICalendar.1'))) as EXICALENDARLib_TLB.ICalendar);
with ICalendar1 do
begin
	OutputDebugString( RecurAllAsString['DTSTART=19970805;FREQ=MONTHLY;BYDAY=MO,TU,WE,TH,FR;BYSETPOS=-1',OleVariant(12)] );
end

VFP

thisform.ICalendar1 = CreateObject("Exontrol.ICalendar.1")
with thisform.ICalendar1
	DEBUGOUT( .RecurAllAsString("DTSTART=19970805;FREQ=MONTHLY;BYDAY=MO,TU,WE,TH,FR;BYSETPOS=-1",12) )
endwith

dBASE Plus

local oICalendar

oICalendar = new OleAutoClient("Exontrol.ICalendar.1")

? Str(oICalendar.RecurAllAsString("DTSTART=19970805;FREQ=MONTHLY;BYDAY=MO,TU,WE,TH,FR;BYSETPOS=-1",12)) 

XBasic (Alpha Five)

Dim oICalendar as P

oICalendar = OLE.Create("Exontrol.ICalendar.1")

? oICalendar.RecurAllAsString("DTSTART=19970805;FREQ=MONTHLY;BYDAY=MO,TU,WE,TH,FR;BYSETPOS=-1",12) 

Visual Objects


oDCOCX_Exontrol1 := IICalendar{"Exontrol.ICalendar.1"}
OutputDebugString(String2Psz( AsString(oDCOCX_Exontrol1:[RecurAllAsString,"DTSTART=19970805;FREQ=MONTHLY;BYDAY=MO,TU,WE,TH,FR;BYSETPOS=-1",12]) ))

PowerBuilder

OleObject oICalendar

oICalendar = CREATE OLEObject
oICalendar.ConnectToNewObject("Exontrol.ICalendar.1")

MessageBox("Information",string( String(oICalendar.RecurAllAsString("DTSTART=19970805;FREQ=MONTHLY;BYDAY=MO,TU,WE,TH,FR;BYSETPOS=-1",12)) ))

Visual DataFlex

Procedure OnCreate
	Forward Send OnCreate
	Variant oComICalendar1
	Get ComCreateObject "Exontrol.ICalendar.1" to oComICalendar1

	Showln (ComRecurAllAsString(Self,"DTSTART=19970805;FREQ=MONTHLY;BYDAY=MO,TU,WE,TH,FR;BYSETPOS=-1",12))
End_Procedure

XBase++

#include "AppEvent.ch"
#include "ActiveX.ch"

PROCEDURE Main
 	LOCAL oForm
	LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
	LOCAL oICalendar

	oForm := XbpDialog():new( AppDesktop() )
	oForm:drawingArea:clipChildren := .T.
	oForm:create( ,,{100,100}, {640,480},, .F. )
	oForm:close  := {|| PostAppEvent( xbeP_Quit )}

	oICalendar := XbpActiveXControl():new( oForm:drawingArea )
	oICalendar:CLSID  := "Exontrol.ICalendar.1" /*{D6C87100-38E2-4ABB-8AC2-4C0097AEE2D6}*/
	oICalendar:create(,, {10,60},{610,370} )

		DevOut( Transform(oICalendar:RecurAllAsString("DTSTART=19970805;FREQ=MONTHLY;BYDAY=MO,TU,WE,TH,FR;BYSETPOS=-1",12),"") )

	oForm:Show()
	DO WHILE nEvent != xbeP_Quit
		nEvent := AppEvent( @mp1, @mp2, @oXbp )
		oXbp:handleEvent( nEvent, mp1, mp2 )
	ENDDO 
RETURN