Type | Description | |||
Name as String | A String expression that specifies the name of the component to be added. |
Return | Description | |||
Component | A Component object being created and added to the Components collection. |
The following is a simple example of an iCalendar format:
BEGIN:VCALENDAR
Version:2.0
PRODID:-//hacksw/handcal//NONSGML v1.0//EN
BEGIN:VEVENT
DTSTART:20010101
DTEND:20010102
SUMMARY:First Party
END:VEVENT
BEGIN:VEVENT
DTSTART:20010104
DTEND:20010105
SUMMARY:Second Party
END:VEVENT
END:VCALENDAR
The VCALENDAR, VEVENT indicates the name of the component.
The following samples show how you can generate the above format:
VBA (MS Access, Excell...)
Set ICalendar1 = CreateObject("Exontrol.ICalendar.1") With ICalendar1 With .Content.Components.Add("VCALENDAR") With .Properties .Add "Version","2.0" .Add "PRODID","-//hacksw/handcal//NONSGML v1.0//EN" End With With .Components.Add("VEVENT").Properties .Add "DTSTART",#1/1/2001# .Add "DTEND",#1/2/2001# .Add "SUMMARY","First Party" End With With .Components.Add("VEVENT").Properties .Add "DTSTART",#1/4/2001# .Add "DTEND",#1/5/2001# .Add "SUMMARY","Second Party" End With End With Debug.Print( .Save ) End With
VB6
Set ICalendar1 = CreateObject("Exontrol.ICalendar.1") With ICalendar1 With .Content.Components.Add("VCALENDAR") With .Properties .Add "Version","2.0" .Add "PRODID","-//hacksw/handcal//NONSGML v1.0//EN" End With With .Components.Add("VEVENT").Properties .Add "DTSTART",#1/1/2001# .Add "DTEND",#1/2/2001# .Add "SUMMARY","First Party" End With With .Components.Add("VEVENT").Properties .Add "DTSTART",#1/4/2001# .Add "DTEND",#1/5/2001# .Add "SUMMARY","Second Party" End With End With Debug.Print( .Save ) End With
VB.NET
' Add 'exontrol.exicalendar.dll(ExICalendar.dll)' reference to your project. Exicalendar1 = New exontrol.EXICALENDARLib.exicalendar() With Exicalendar1 With .Content.Components.Add("VCALENDAR") With .Properties .Add("Version","2.0") .Add("PRODID","-//hacksw/handcal//NONSGML v1.0//EN") End With With .Components.Add("VEVENT").Properties .Add("DTSTART",#1/1/2001#) .Add("DTEND",#1/2/2001#) .Add("SUMMARY","First Party") End With With .Components.Add("VEVENT").Properties .Add("DTSTART",#1/4/2001#) .Add("DTEND",#1/5/2001#) .Add("SUMMARY","Second Party") End With End With Debug.Print( .Save() ) End With
VB.NET for /COM
AxICalendar1 = CreateObject("Exontrol.ICalendar.1") With AxICalendar1 With .Content.Components.Add("VCALENDAR") With .Properties .Add("Version","2.0") .Add("PRODID","-//hacksw/handcal//NONSGML v1.0//EN") End With With .Components.Add("VEVENT").Properties .Add("DTSTART",#1/1/2001#) .Add("DTEND",#1/2/2001#) .Add("SUMMARY","First Party") End With With .Components.Add("VEVENT").Properties .Add("DTSTART",#1/4/2001#) .Add("DTEND",#1/5/2001#) .Add("SUMMARY","Second Party") End With End With Debug.Print( .Save() ) 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"); EXICALENDARLib::IComponentPtr var_Component = spICalendar1->GetContent()->GetComponents()->Add(L"VCALENDAR"); EXICALENDARLib::IPropertiesPtr var_Properties = var_Component->GetProperties(); var_Properties->Add(L"Version","2.0"); var_Properties->Add(L"PRODID","-//hacksw/handcal//NONSGML v1.0//EN"); EXICALENDARLib::IPropertiesPtr var_Properties1 = var_Component->GetComponents()->Add(L"VEVENT")->GetProperties(); var_Properties1->Add(L"DTSTART",COleDateTime(2001,1,1,0,00,00).operator DATE()); var_Properties1->Add(L"DTEND",COleDateTime(2001,1,2,0,00,00).operator DATE()); var_Properties1->Add(L"SUMMARY","First Party"); EXICALENDARLib::IPropertiesPtr var_Properties2 = var_Component->GetComponents()->Add(L"VEVENT")->GetProperties(); var_Properties2->Add(L"DTSTART",COleDateTime(2001,1,4,0,00,00).operator DATE()); var_Properties2->Add(L"DTEND",COleDateTime(2001,1,5,0,00,00).operator DATE()); var_Properties2->Add(L"SUMMARY","Second Party"); OutputDebugStringW( spICalendar1->Save() );
C++ Builder
Exicalendarlib_tlb::IICalendarPtr ICalendar1 = Variant::CreateObject(L"Exontrol.ICalendar.1"); Exicalendarlib_tlb::IComponentPtr var_Component = ICalendar1->Content->Components->Add(L"VCALENDAR"); Exicalendarlib_tlb::IPropertiesPtr var_Properties = var_Component->Properties; var_Properties->Add(L"Version",TVariant("2.0")); var_Properties->Add(L"PRODID",TVariant("-//hacksw/handcal//NONSGML v1.0//EN")); Exicalendarlib_tlb::IPropertiesPtr var_Properties1 = var_Component->Components->Add(L"VEVENT")->Properties; var_Properties1->Add(L"DTSTART",TVariant(TDateTime(2001,1,1).operator double())); var_Properties1->Add(L"DTEND",TVariant(TDateTime(2001,1,2).operator double())); var_Properties1->Add(L"SUMMARY",TVariant("First Party")); Exicalendarlib_tlb::IPropertiesPtr var_Properties2 = var_Component->Components->Add(L"VEVENT")->Properties; var_Properties2->Add(L"DTSTART",TVariant(TDateTime(2001,1,4).operator double())); var_Properties2->Add(L"DTEND",TVariant(TDateTime(2001,1,5).operator double())); var_Properties2->Add(L"SUMMARY",TVariant("Second Party")); OutputDebugString( ICalendar1->Save() );
C#
// Add 'exontrol.exicalendar.dll(ExICalendar.dll)' reference to your project. exontrol.EXICALENDARLib.exicalendar exicalendar1 = new exontrol.EXICALENDARLib.exicalendar(); exontrol.EXICALENDARLib.Component var_Component = exicalendar1.Content.Components.Add("VCALENDAR"); exontrol.EXICALENDARLib.Properties var_Properties = var_Component.Properties; var_Properties.Add("Version","2.0"); var_Properties.Add("PRODID","-//hacksw/handcal//NONSGML v1.0//EN"); exontrol.EXICALENDARLib.Properties var_Properties1 = var_Component.Components.Add("VEVENT").Properties; var_Properties1.Add("DTSTART",Convert.ToDateTime("1/1/2001",System.Globalization.CultureInfo.GetCultureInfo("en-US"))); var_Properties1.Add("DTEND",Convert.ToDateTime("1/2/2001",System.Globalization.CultureInfo.GetCultureInfo("en-US"))); var_Properties1.Add("SUMMARY","First Party"); exontrol.EXICALENDARLib.Properties var_Properties2 = var_Component.Components.Add("VEVENT").Properties; var_Properties2.Add("DTSTART",Convert.ToDateTime("1/4/2001",System.Globalization.CultureInfo.GetCultureInfo("en-US"))); var_Properties2.Add("DTEND",Convert.ToDateTime("1/5/2001",System.Globalization.CultureInfo.GetCultureInfo("en-US"))); var_Properties2.Add("SUMMARY","Second Party"); System.Diagnostics.Debug.Print( exicalendar1.Save() );
JScript/JavaScript
<BODY onload="Init()"> <OBJECT CLASSID="clsid:D6C87100-38E2-4ABB-8AC2-4C0097AEE2D6" id="ICalendar1"></OBJECT> <SCRIPT LANGUAGE="JScript"> function Init() { var var_Component = ICalendar1.Content.Components.Add("VCALENDAR"); var var_Properties = var_Component.Properties; var_Properties.Add("Version","2.0"); var_Properties.Add("PRODID","-//hacksw/handcal//NONSGML v1.0//EN"); var var_Properties1 = var_Component.Components.Add("VEVENT").Properties; var_Properties1.Add("DTSTART","1/1/2001"); var_Properties1.Add("DTEND","1/2/2001"); var_Properties1.Add("SUMMARY","First Party"); var var_Properties2 = var_Component.Components.Add("VEVENT").Properties; var_Properties2.Add("DTSTART","1/4/2001"); var_Properties2.Add("DTEND","1/5/2001"); var_Properties2.Add("SUMMARY","Second Party"); alert( ICalendar1.Save() ); } </SCRIPT> </BODY>
VBScript
<BODY onload="Init()"> <OBJECT CLASSID="clsid:D6C87100-38E2-4ABB-8AC2-4C0097AEE2D6" id="ICalendar1"></OBJECT> <SCRIPT LANGUAGE="VBScript"> Function Init() With ICalendar1 With .Content.Components.Add("VCALENDAR") With .Properties .Add "Version","2.0" .Add "PRODID","-//hacksw/handcal//NONSGML v1.0//EN" End With With .Components.Add("VEVENT").Properties .Add "DTSTART",#1/1/2001# .Add "DTEND",#1/2/2001# .Add "SUMMARY","First Party" End With With .Components.Add("VEVENT").Properties .Add "DTSTART",#1/4/2001# .Add "DTEND",#1/5/2001# .Add "SUMMARY","Second Party" End With End With alert( .Save ) End With End Function </SCRIPT> </BODY>
C# for /COM
EXICALENDARLib.ICalendar axICalendar1 = new EXICALENDARLib.ICalendar(); EXICALENDARLib.Component var_Component = axICalendar1.Content.Components.Add("VCALENDAR"); EXICALENDARLib.Properties var_Properties = var_Component.Properties; var_Properties.Add("Version","2.0"); var_Properties.Add("PRODID","-//hacksw/handcal//NONSGML v1.0//EN"); EXICALENDARLib.Properties var_Properties1 = var_Component.Components.Add("VEVENT").Properties; var_Properties1.Add("DTSTART",Convert.ToDateTime("1/1/2001",System.Globalization.CultureInfo.GetCultureInfo("en-US"))); var_Properties1.Add("DTEND",Convert.ToDateTime("1/2/2001",System.Globalization.CultureInfo.GetCultureInfo("en-US"))); var_Properties1.Add("SUMMARY","First Party"); EXICALENDARLib.Properties var_Properties2 = var_Component.Components.Add("VEVENT").Properties; var_Properties2.Add("DTSTART",Convert.ToDateTime("1/4/2001",System.Globalization.CultureInfo.GetCultureInfo("en-US"))); var_Properties2.Add("DTEND",Convert.ToDateTime("1/5/2001",System.Globalization.CultureInfo.GetCultureInfo("en-US"))); var_Properties2.Add("SUMMARY","Second Party"); System.Diagnostics.Debug.Print( axICalendar1.Save() );
X++ (Dynamics Ax 2009)
public void init() { COM com_Component,com_Component1,com_Components,com_Properties,com_Properties1,com_Properties2,com_exicalendar1; anytype exicalendar1,var_Component,var_Component1,var_Components,var_Properties,var_Properties1,var_Properties2; ; super(); // Add 'exicalendar.dll(ExICalendar.dll)' reference to your project. exicalendar1 = COM::createFromObject(new EXICALENDARLib.exicalendar()); com_exicalendar1 = exicalendar1; var_Component = COM::createFromObject(com_exicalendar1.Content().Components()).Add("VCALENDAR"); com_Component = var_Component; var_Properties = com_Component.Properties(); com_Properties = var_Properties; com_Properties.Add("Version","2.0"); com_Properties.Add("PRODID","-//hacksw/handcal//NONSGML v1.0//EN"); var_Components = COM::createFromObject(com_Component.Components()); com_Components = var_Components; var_Component1 = COM::createFromObject(com_Components).Add("VEVENT"); com_Component1 = var_Component1; var_Properties1 = com_Component1.Properties(); com_Properties1 = var_Properties1; com_Properties1.Add("DTSTART",COMVariant::createFromDate(str2Date("1/1/2001",213))); com_Properties1.Add("DTEND",COMVariant::createFromDate(str2Date("1/2/2001",213))); com_Properties1.Add("SUMMARY","First Party"); var_Components = COM::createFromObject(com_Component.Components()); com_Components = var_Components; var_Component1 = COM::createFromObject(com_Components).Add("VEVENT"); com_Component1 = var_Component1; var_Properties2 = com_Component1.Properties(); com_Properties2 = var_Properties2; com_Properties2.Add("DTSTART",COMVariant::createFromDate(str2Date("1/4/2001",213))); com_Properties2.Add("DTEND",COMVariant::createFromDate(str2Date("1/5/2001",213))); com_Properties2.Add("SUMMARY","Second Party"); print( com_exicalendar1.Save() ); }
Delphi 8 (.NET only)
AxICalendar1 := (ComObj.CreateComObject(ComObj.ProgIDToClassID('Exontrol.ICalendar.1')) as EXICALENDARLib.ICalendar); with AxICalendar1 do begin with Content.Components.Add('VCALENDAR') do begin with Properties do begin Add('Version','2.0'); Add('PRODID','-//hacksw/handcal//NONSGML v1.0//EN'); end; with Components.Add('VEVENT').Properties do begin Add('DTSTART','1/1/2001'); Add('DTEND','1/2/2001'); Add('SUMMARY','First Party'); end; with Components.Add('VEVENT').Properties do begin Add('DTSTART','1/4/2001'); Add('DTEND','1/5/2001'); Add('SUMMARY','Second Party'); end; end; OutputDebugString( Save() ); end
Delphi (standard)
ICalendar1 := (IUnknown(ComObj.CreateComObject(ComObj.ProgIDToClassID('Exontrol.ICalendar.1'))) as EXICALENDARLib_TLB.ICalendar); with ICalendar1 do begin with Content.Components.Add('VCALENDAR') do begin with Properties do begin Add('Version','2.0'); Add('PRODID','-//hacksw/handcal//NONSGML v1.0//EN'); end; with Components.Add('VEVENT').Properties do begin Add('DTSTART','1/1/2001'); Add('DTEND','1/2/2001'); Add('SUMMARY','First Party'); end; with Components.Add('VEVENT').Properties do begin Add('DTSTART','1/4/2001'); Add('DTEND','1/5/2001'); Add('SUMMARY','Second Party'); end; end; OutputDebugString( Save() ); end
VFP
thisform.ICalendar1 = CreateObject("Exontrol.ICalendar.1") with thisform.ICalendar1 with .Content.Components.Add("VCALENDAR") with .Properties .Add("Version","2.0") .Add("PRODID","-//hacksw/handcal//NONSGML v1.0//EN") endwith with .Components.Add("VEVENT").Properties .Add("DTSTART",{^2001-1-1}) .Add("DTEND",{^2001-1-2}) .Add("SUMMARY","First Party") endwith with .Components.Add("VEVENT").Properties .Add("DTSTART",{^2001-1-4}) .Add("DTEND",{^2001-1-5}) .Add("SUMMARY","Second Party") endwith endwith DEBUGOUT( .Save ) endwith
dBASE Plus
local oICalendar,var_Component,var_Properties,var_Properties1,var_Properties2 oICalendar = new OleAutoClient("Exontrol.ICalendar.1") var_Component = oICalendar.Content.Components.Add("VCALENDAR") var_Properties = var_Component.Properties var_Properties.Add("Version","2.0") var_Properties.Add("PRODID","-//hacksw/handcal//NONSGML v1.0//EN") var_Properties1 = var_Component.Components.Add("VEVENT").Properties var_Properties1.Add("DTSTART","01/01/2001") var_Properties1.Add("DTEND","01/02/2001") var_Properties1.Add("SUMMARY","First Party") var_Properties2 = var_Component.Components.Add("VEVENT").Properties var_Properties2.Add("DTSTART","01/04/2001") var_Properties2.Add("DTEND","01/05/2001") var_Properties2.Add("SUMMARY","Second Party") ? oICalendar.Save()
XBasic (Alpha Five)
Dim oICalendar as P Dim var_Component as P Dim var_Properties as P Dim var_Properties1 as P Dim var_Properties2 as P oICalendar = OLE.Create("Exontrol.ICalendar.1") var_Component = oICalendar.Content.Components.Add("VCALENDAR") var_Properties = var_Component.Properties var_Properties.Add("Version","2.0") var_Properties.Add("PRODID","-//hacksw/handcal//NONSGML v1.0//EN") var_Properties1 = var_Component.Components.Add("VEVENT").Properties var_Properties1.Add("DTSTART",{01/01/2001}) var_Properties1.Add("DTEND",{01/02/2001}) var_Properties1.Add("SUMMARY","First Party") var_Properties2 = var_Component.Components.Add("VEVENT").Properties var_Properties2.Add("DTSTART",{01/04/2001}) var_Properties2.Add("DTEND",{01/05/2001}) var_Properties2.Add("SUMMARY","Second Party") ? oICalendar.Save()
Visual Objects
local var_Component as IComponent local var_Properties,var_Properties1,var_Properties2 as IProperties oDCOCX_Exontrol1 := IICalendar{"Exontrol.ICalendar.1"} var_Component := oDCOCX_Exontrol1:Content:Components:Add("VCALENDAR") var_Properties := var_Component:Properties var_Properties:Add("Version","2.0") var_Properties:Add("PRODID","-//hacksw/handcal//NONSGML v1.0//EN") var_Properties1 := var_Component:Components:Add("VEVENT"):Properties var_Properties1:Add("DTSTART",SToD("20010101")) var_Properties1:Add("DTEND",SToD("20010102")) var_Properties1:Add("SUMMARY","First Party") var_Properties2 := var_Component:Components:Add("VEVENT"):Properties var_Properties2:Add("DTSTART",SToD("20010104")) var_Properties2:Add("DTEND",SToD("20010105")) var_Properties2:Add("SUMMARY","Second Party") OutputDebugString(String2Psz( oDCOCX_Exontrol1:Save() ))
PowerBuilder
OleObject oICalendar,var_Component,var_Properties,var_Properties1,var_Properties2 oICalendar = CREATE OLEObject oICalendar.ConnectToNewObject("Exontrol.ICalendar.1") var_Component = oICalendar.Content.Components.Add("VCALENDAR") var_Properties = var_Component.Properties var_Properties.Add("Version","2.0") var_Properties.Add("PRODID","-//hacksw/handcal//NONSGML v1.0//EN") var_Properties1 = var_Component.Components.Add("VEVENT").Properties var_Properties1.Add("DTSTART",2001-01-01) var_Properties1.Add("DTEND",2001-01-02) var_Properties1.Add("SUMMARY","First Party") var_Properties2 = var_Component.Components.Add("VEVENT").Properties var_Properties2.Add("DTSTART",2001-01-04) var_Properties2.Add("DTEND",2001-01-05) var_Properties2.Add("SUMMARY","Second Party") MessageBox("Information",string( oICalendar.Save() ))
Visual DataFlex
Procedure OnCreate Forward Send OnCreate Variant oComICalendar1 Get ComCreateObject "Exontrol.ICalendar.1" to oComICalendar1 Variant voComponent Get ComContent to voComponent Handle hoComponent Get Create (RefClass(cComComponent)) to hoComponent Set pvComObject of hoComponent to voComponent Variant voComponents Get ComComponents of hoComponent to voComponents Handle hoComponents Get Create (RefClass(cComComponents)) to hoComponents Set pvComObject of hoComponents to voComponents Variant voComponent1 Get ComAdd of hoComponents "VCALENDAR" to voComponent1 Handle hoComponent1 Get Create (RefClass(cComComponent)) to hoComponent1 Set pvComObject of hoComponent1 to voComponent1 Variant voProperties Get ComProperties of hoComponent1 to voProperties Handle hoProperties Get Create (RefClass(cComProperties)) to hoProperties Set pvComObject of hoProperties to voProperties Get ComAdd of hoProperties "Version" "2.0" to Nothing Get ComAdd of hoProperties "PRODID" "-//hacksw/handcal//NONSGML v1.0//EN" to Nothing Send Destroy to hoProperties Variant voComponents1 Get ComComponents of hoComponent1 to voComponents1 Handle hoComponents1 Get Create (RefClass(cComComponents)) to hoComponents1 Set pvComObject of hoComponents1 to voComponents1 Variant voComponent2 Get ComAdd of hoComponents1 "VEVENT" to voComponent2 Handle hoComponent2 Get Create (RefClass(cComComponent)) to hoComponent2 Set pvComObject of hoComponent2 to voComponent2 Variant voProperties1 Get ComProperties of hoComponent2 to voProperties1 Handle hoProperties1 Get Create (RefClass(cComProperties)) to hoProperties1 Set pvComObject of hoProperties1 to voProperties1 Get ComAdd of hoProperties1 "DTSTART" "1/1/2001" to Nothing Get ComAdd of hoProperties1 "DTEND" "1/2/2001" to Nothing Get ComAdd of hoProperties1 "SUMMARY" "First Party" to Nothing Send Destroy to hoProperties1 Send Destroy to hoComponent2 Send Destroy to hoComponents1 Variant voComponents2 Get ComComponents of hoComponent1 to voComponents2 Handle hoComponents2 Get Create (RefClass(cComComponents)) to hoComponents2 Set pvComObject of hoComponents2 to voComponents2 Variant voComponent3 Get ComAdd of hoComponents2 "VEVENT" to voComponent3 Handle hoComponent3 Get Create (RefClass(cComComponent)) to hoComponent3 Set pvComObject of hoComponent3 to voComponent3 Variant voProperties2 Get ComProperties of hoComponent3 to voProperties2 Handle hoProperties2 Get Create (RefClass(cComProperties)) to hoProperties2 Set pvComObject of hoProperties2 to voProperties2 Get ComAdd of hoProperties2 "DTSTART" "1/4/2001" to Nothing Get ComAdd of hoProperties2 "DTEND" "1/5/2001" to Nothing Get ComAdd of hoProperties2 "SUMMARY" "Second Party" to Nothing Send Destroy to hoProperties2 Send Destroy to hoComponent3 Send Destroy to hoComponents2 Send Destroy to hoComponent1 Send Destroy to hoComponents Send Destroy to hoComponent Showln (ComSave(Self)) End_Procedure
XBase++
#include "AppEvent.ch" #include "ActiveX.ch" PROCEDURE Main LOCAL oForm LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL LOCAL oICalendar LOCAL oComponent LOCAL oProperties,oProperties1,oProperties2 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} ) oComponent := oICalendar:Content():Components():Add("VCALENDAR") oProperties := oComponent:Properties() oProperties:Add("Version","2.0") oProperties:Add("PRODID","-//hacksw/handcal//NONSGML v1.0//EN") oProperties1 := oComponent:Components():Add("VEVENT"):Properties() oProperties1:Add("DTSTART","01/01/2001") oProperties1:Add("DTEND","01/02/2001") oProperties1:Add("SUMMARY","First Party") oProperties2 := oComponent:Components():Add("VEVENT"):Properties() oProperties2:Add("DTSTART","01/04/2001") oProperties2:Add("DTEND","01/05/2001") oProperties2:Add("SUMMARY","Second Party") DevOut( oICalendar:Save() ) oForm:Show() DO WHILE nEvent != xbeP_Quit nEvent := AppEvent( @mp1, @mp2, @oXbp ) oXbp:handleEvent( nEvent, mp1, mp2 ) ENDDO RETURN