[!newguid(InterfaceGUID)]

[!set(Attributes, "00110000000")]

[!if!(IEControl)]
[!set(IPERSISTSTORAGE, "TRUE")]
[!set(ISPECIFYPROPERTYPAGES, "TRUE")]
[!set(IQUICKACTIVATE, "TRUE")]
[!set(IDATAOBJECT, "TRUE")]
[!set(IPROVIDECLASSINFO2, "TRUE")]
[!set(IPROPERTYNOTIFYSINK, "TRUE")]
[!endif]


[!if=(CompositeControl, "TRUE")]
[!Dialog("Names98", "ObjDlg98", "StockProps98")]
[!set(WindowedOnlyEnabled, "TRUE")]
[!set(NormalizeDCEnabled, "TRUE)]
[!set(MiscStatus, "131473")]
[!else]
[!if=(HTMLControl, "TRUE")]
[!Dialog("Names98", "ObjDlg98", "StockProps98")]
[!set(WindowedOnlyEnabled, "TRUE")]
[!set(MiscStatus, "131473")]
[!AddStringToSymbol(HTMLFileName, ShortName, "UI.htm")]
[!else]
[!Dialog("Names98", "ObjDlg98", "CtlDlg98", "StockProps98")]
[!endif]
[!endif]
[!if=(ConnectionPointsEnabled, "TRUE")]
[!newguid(InterfaceGUIDCP)]
[!endif]
[!DoubleSlash(DGalleryPath, GalleryPath)]

[!strcpy(UpperShortName, ShortName)]
[!toupper(UpperShortName)]

[!AddStringToSymbol(HeaderTemplate, GalleryPath, "control.h")]
[!AddStringToSymbol(CPPTemplate, GalleryPath, "control.cpp")]
[!AddStringToSymbol(RGSTemplate, GalleryPath, "control.rgs")]
[!AddStringToSymbol(BMPTemplate, DGalleryPath, "ATL.bmp")]
[!AddStringToSymbol(HTMTemplate, GalleryPath, "default.htm")]
[!AddSymbolToString(IDR_REGISTRYID, "IDR_", UpperShortName)]
[!AddSymbolToString(IDD_DIALOGID, "IDD_", UpperShortName)]
[!AddSymbolToString(IDH_HTMLID, "IDH_", UpperShortName)]
[!AddSymbolToString(IDR_BMPID, "IDB_", UpperShortName)]

[!GetTemporaryFileName(BMPRCName)]
[!target(BMPRCName)]
BITMAP  DISCARDABLE     "[!BMPTemplate]"
[!target()]
[!AddResourceFromFile(BMPRCName, IDR_BMPID, "BITMAP")]
[!DeleteFile(BMPRCName)]

[!if=(HTMLControl, "TRUE")]
[!set(atlhost.h, "<atlhost.h>")]
[!AddIncludeFile(stdafx.h, atlhost.h)]
[!set(mshtml.h, "<mshtml.h>")]
[!AddIncludeFile(stdafx.h, mshtml.h)]
[!set(exdisp.h, "<exdisp.h>")]
[!AddIncludeFile(stdafx.h, exdisp.h)]
[!AddStringToSymbol(HTMLTemplate, GalleryPath, "HTMLCTL.htm")]
[!target(HTMLFileName)]
[!include(HTMLTemplate)]
[!target()]
[!AddResourceFromFile(HTMLFileName, IDH_HTMLID, "HTML")]
[!endif]

[!AddSymbolToSymbol(RGSName, ProjectDirectory, ShortName)]
[!AddStringToSymbol(RGSName, RGSName, ".rgs")]

[!target(RGSName)]
[!include(RGSTemplate)]
[!target()]

[!AddRegistryToRC(RGSName, IDR_REGISTRYID)]

[!target(HeaderName)]
[!include(HeaderTemplate)]
[!target()]

[!target(CPPName)]
[!include(CPPTemplate)]
[!target()]

[!AddStringToSymbol(HTMName, ShortName, ".htm")]

[!target(HTMName)]
[!include(HTMTemplate)]
[!target()]

[!AddToObjectMap(CoClassName, ClassName)]

[!AddSymbolToString(header, "\"", HeaderName)]
[!AddStringToSymbol(header, header, "\"")]
[!AddIncludeFile(ProjectNameCPP,  header)]

[!if!(stdafx.h)]
[!set(stdafx.h, "stdafx.h")]
[!endif]
[!if!(stdafx.cpp)]
[!set(stdafx.cpp, "stdafx.cpp")]
[!endif]
[!set(atlctl.h, "<atlctl.h>")]
[!set(olectl.h, "olectl.h")]

[!if=(CompositeControl, "TRUE")]
[!set(atlhost.h, "<atlhost.h>")]
[!AddIncludeFile(stdafx.h, atlhost.h)]
[!endif]

[!AddIncludeFile(stdafx.h, atlctl.h)]
[!AddImportFile(IDLProject, "oaidl.idl")]
[!AddImportFile(IDLProject, "ocidl.idl")]
[!AddIncludeFile(IDLProject, olectl.h)]

[!AddStringToSymbol(IDLInterface, GalleryPath, "ctlint.idl")]
[!AddStringToSymbol(IDLCoClass, GalleryPath, "ctlco.idl")]
[!AddInterfaceToIDL(IDLProject, IDLInterface)]
[!AddCoClassToIDL(IDLProject, IDLCoClass)]
[!AddFileToProject(CPPName)]
[!AddFileToProject(HeaderName)]


[!if=(CompositeControl, "TRUE")]
[!AddStringToSymbol(DLGTemplate, GalleryPath, "cmposite.rc")]
[!AddResourceFromFile(DLGTemplate, IDD_DIALOGID, "DIALOG")]
[!Commit()]
[!OpenDialog(IDD_DIALOGID)]
[!endif]
