list of _all_ Excel constants
list of _all_ Excel constants
List of all Excel constants is here.
Re: list of _all_ Excel constants
Code: Select all
_xlDialogChartSourceData 541
_xlDialogPhonetic 538
msoLimited 1
msoNoOverwrite 3
msoOrganization 2
msoPBIAbort 1
msoPBIExport 0
msoPBIIgnore 0
msoPBIOverwrite 2
msoPBIUpload 1
msoPublic 0
rgbAliceBlue 16775408
rgbAntiqueWhite 14150650
rgbAqua 16776960
rgbAquamarine 13959039
rgbAzure 16777200
rgbBeige 14480885
rgbBisque 12903679
rgbBlack 0
rgbBlanchedAlmond 13495295
rgbBlue 16711680
rgbBlueViolet 14822282
rgbBrown 2763429
rgbBurlyWood 8894686
rgbCadetBlue 10526303
rgbChartreuse 65407
rgbCoral 5275647
rgbCornflowerBlue 15570276
rgbCornsilk 14481663
rgbCrimson 3937500
rgbDarkBlue 9109504
rgbDarkCyan 9145088
rgbDarkGoldenrod 755384
rgbDarkGray 11119017
rgbDarkGreen 25600
rgbDarkGrey 11119017
rgbDarkKhaki 7059389
rgbDarkMagenta 9109643
rgbDarkOliveGreen 3107669
rgbDarkOrange 36095
rgbDarkOrchid 13382297
rgbDarkRed 139
rgbDarkSalmon 8034025
rgbDarkSeaGreen 9419919
rgbDarkSlateBlue 9125192
rgbDarkSlateGray 5197615
rgbDarkSlateGrey 5197615
rgbDarkTurquoise 13749760
rgbDarkViolet 13828244
rgbDeepPink 9639167
rgbDeepSkyBlue 16760576
rgbDimGray 6908265
rgbDimGrey 6908265
rgbDodgerBlue 16748574
rgbFireBrick 2237106
rgbFloralWhite 15792895
rgbForestGreen 2263842
rgbFuchsia 16711935
rgbGainsboro 14474460
rgbGhostWhite 16775416
rgbGold 55295
rgbGoldenrod 2139610
rgbGray 8421504
rgbGreen 32768
rgbGreenYellow 3145645
rgbGrey 8421504
rgbHoneydew 15794160
rgbHotPink 11823615
rgbIndianRed 6053069
rgbIndigo 8519755
rgbIvory 15794175
rgbKhaki 9234160
rgbLavender 16443110
rgbLavenderBlush 16118015
rgbLawnGreen 64636
rgbLemonChiffon 13499135
rgbLightBlue 15128749
rgbLightCoral 8421616
rgbLightCyan 9145088
rgbLightGoldenrodYellow 13826810
rgbLightGray 13882323
rgbLightGreen 9498256
rgbLightGrey 13882323
rgbLightPink 12695295
rgbLightSalmon 8036607
rgbLightSeaGreen 11186720
rgbLightSkyBlue 16436871
rgbLightSlateGray 10061943
rgbLightSlateGrey 10061943
rgbLightSteelBlue 14599344
rgbLightYellow 14745599
rgbLime 65280
rgbLimeGreen 3329330
rgbLinen 15134970
rgbMaroon 128
rgbMediumAquamarine 11206502
rgbMediumBlue 13434880
rgbMediumOrchid 13850042
rgbMediumPurple 14381203
rgbMediumSeaGreen 7451452
rgbMediumSlateBlue 15624315
rgbMediumSpringGreen 10156544
rgbMediumTurquoise 13422920
rgbMediumVioletRed 8721863
rgbMidnightBlue 7346457
rgbMintCream 16449525
rgbMistyRose 14804223
rgbMoccasin 11920639
rgbNavajoWhite 11394815
rgbNavy 8388608
rgbNavyBlue 8388608
rgbOldLace 15136253
rgbOlive 32896
rgbOliveDrab 2330219
rgbOrange 42495
rgbOrangeRed 17919
rgbOrchid 14053594
rgbPaleGoldenrod 7071982
rgbPaleGreen 10025880
rgbPaleTurquoise 15658671
rgbPaleVioletRed 9662683
rgbPapayaWhip 14020607
rgbPeachPuff 12180223
rgbPeru 4163021
rgbPink 13353215
rgbPlum 14524637
rgbPowderBlue 15130800
rgbPurple 8388736
rgbRed 255
rgbRosyBrown 9408444
rgbRoyalBlue 14772545
rgbSalmon 7504122
rgbSandyBrown 6333684
rgbSeaGreen 5737262
rgbSeashell 15660543
rgbSienna 2970272
rgbSilver 12632256
rgbSkyBlue 15453831
rgbSlateBlue 13458026
rgbSlateGray 9470064
rgbSlateGrey 9470064
rgbSnow 16448255
rgbSpringGreen 8388352
rgbSteelBlue 11829830
rgbTan 9221330
rgbTeal 8421376
rgbThistle 14204888
rgbTomato 4678655
rgbTurquoise 13688896
rgbViolet 15631086
rgbWheat 11788021
rgbWhite 16777215
rgbWhiteSmoke 16119285
rgbYellow 65535
rgbYellowGreen 3329434
xl24HourClock 33
xl3Arrows 1
xl3ArrowsGray 2
xl3DArea -4098
xl3DAreaStacked 78
xl3DAreaStacked100 79
xl3DBar -4099
xl3DBarClustered 60
xl3DBarStacked 61
xl3DBarStacked100 62
xl3DColumn -4100
xl3DColumnClustered 54
xl3DColumnStacked 55
xl3DColumnStacked100 56
xl3DEffects1 13
xl3DEffects2 14
xl3DLine -4101
xl3DPie -4102
xl3DPieExploded 70
xl3DSurface -4103
xl3Flags 3
xl3Signs 6
xl3Stars 18
xl3Symbols 7
xl3Symbols2 8
xl3TrafficLights1 4
xl3TrafficLights2 5
xl3Triangles 19
xl4Arrows 9
xl4ArrowsGray 10
xl4CRV 12
xl4DigitYears 43
xl4RedToBlack 11
xl4TrafficLights 13
xl5Arrows 14
xl5ArrowsGray 15
xl5Boxes 20
xl5CRV 16
xl5Quarters 17
xlA1 1
xlAbove 0
xlAboveAverage 0
xlAboveAverageCondition 12
xlAboveStdDev 4
xlAbsolute 1
xlAbsRowRelColumn 2
xlAccounting1 4
xlAccounting2 5
xlAccounting3 6
xlAccounting4 17
xlActionTypeDrillthrough 256
xlActionTypeReport 128
xlActionTypeRowset 16
xlActionTypeUrl 1
xlAdd 2
xlAddIn 18
xlAddIn8 18
xlADORecordset 7
xlAfter 33
xlAfterOrEqualTo 34
xlAll -4104
xlAllAtOnce 2
xlAllChanges 2
xlAllDatesInPeriodApril 60
xlAllDatesInPeriodAugust 64
xlAllDatesInPeriodDecember 68
xlAllDatesInPeriodFebruary 58
xlAllDatesInPeriodJanuary 57
xlAllDatesInPeriodJuly 63
xlAllDatesInPeriodJune 62
xlAllDatesInPeriodMarch 59
xlAllDatesInPeriodMay 61
xlAllDatesInPeriodNovember 67
xlAllDatesInPeriodOctober 66
xlAllDatesInPeriodQuarter1 53
xlAllDatesInPeriodQuarter2 54
xlAllDatesInPeriodQuarter3 55
xlAllDatesInPeriodQuarter4 56
xlAllDatesInPeriodSeptember 65
xlAllExceptBorders 7
xlAllFaces 7
xlAllocateIncrement 2
xlAllocateValue 1
xlAllTables 2
xlAllValues 0
xlAlternateArraySeparator 16
xlAlways 1
xlAnd 1
xlAnyGallery 23
xlAnyKey 2
xlArabicBothStrict 3
xlArabicNone 0
xlArabicStrictAlefHamza 1
xlArabicStrictFinalYaa 2
xlArea 1
xlAreaStacked 76
xlAreaStacked100 77
xlArrangeStyleCascade 7
xlArrangeStyleHorizontal -4128
xlArrangeStyleTiled 1
xlArrangeStyleVertical -4166
xlArrowHeadLengthLong 3
xlArrowHeadLengthMedium -4138
xlArrowHeadLengthShort 1
xlArrowHeadStyleClosed 3
xlArrowHeadStyleDoubleClosed 5
xlArrowHeadStyleDoubleOpen 4
xlArrowHeadStyleNone -4142
xlArrowHeadStyleOpen 2
xlArrowHeadWidthMedium -4138
xlArrowHeadWidthNarrow 1
xlArrowHeadWidthWide 3
xlAscending 1
xlAsRequired 0
xlAtBottom 2
xlAtTop 1
xlAutoActivate 3
xlAutoClose 2
xlAutoDeactivate 4
xlAutoFill 4
xlAutomatic -4105
xlAutomaticAllocation 2
xlAutomaticScale -4105
xlAutomaticUpdate 4
xlAutoOpen 1
xlAverage -4106
xlAxis 21
xlAxisCrossesAutomatic -4105
xlAxisCrossesCustom -4114
xlAxisCrossesMaximum 2
xlAxisCrossesMinimum 4
xlAxisTitle 17
xlBackgroundAutomatic -4105
xlBackgroundOpaque 3
xlBackgroundTransparent 2
xlBar 2
xlBarClustered 57
xlBarOfPie 71
xlBarStacked 58
xlBarStacked100 59
xlBefore 31
xlBeforeOrEqualTo 32
xlBeginsWith 2
xlBelow 1
xlBelowAverage 1
xlBelowStdDev 5
xlBetween 1
xlBidi -5000
xlBidiCalendar 3
xlBIFF 2
xlBinsTypeAutomatic 0
xlBinsTypeBinCount 4
xlBinsTypeBinSize 3
xlBinsTypeCategorical 1
xlBinsTypeManual 2
xlBitmap 2
xlBlankRow 19
xlBlanks 4
xlBlanksCondition 10
xlBMP 1
xlBoth 1
xlBottom -4107
xlBottom10Items 4
xlBottom10Percent 6
xlBottomCount 2
xlBottomPercent 4
xlBottomSum 6
xlBox 0
xlBoxwhisker 121
xlBubble 15
xlBubble3DEffect 87
xlBuiltIn 21
xlButton 15
xlButtonControl 0
xlButtonOnly 2
xlByColumns 2
xlByRows 1
xlCalculatedMeasure 2
xlCalculatedMember 0
xlCalculatedSet 1
xlCalculating 1
xlCalculationAutomatic -4105
xlCalculationManual -4135
xlCalculationSemiautomatic 2
xlCancel 1
xlCap 1
xlCaptionBeginsWith 17
xlCaptionContains 21
xlCaptionDoesNotBeginWith 18
xlCaptionDoesNotContain 22
xlCaptionDoesNotEndWith 20
xlCaptionDoesNotEqual 16
xlCaptionEndsWith 19
xlCaptionEquals 15
xlCaptionIsBetween 27
xlCaptionIsGreaterThan 23
xlCaptionIsGreaterThanOrEqualTo 24
xlCaptionIsLessThan 25
xlCaptionIsLessThanOrEqualTo 26
xlCaptionIsNotBetween 28
xlCascade 7
xlCategory 1
xlCategoryAscending 2
xlCategoryDescending 3
xlCategoryLabelLevelAll -1
xlCategoryLabelLevelCustom -2
xlCategoryLabelLevelNone -3
xlCategoryScale 2
xlCellChangeApplied 3
xlCellChanged 2
xlCellNotChanged 1
xlCellTypeAllFormatConditions -4172
xlCellTypeAllValidation -4174
xlCellTypeBlanks 4
xlCellTypeComments -4144
xlCellTypeConstants 2
xlCellTypeFormulas -4123
xlCellTypeLastCell 11
xlCellTypeSameFormatConditions -4173
xlCellTypeSameValidation -4175
xlCellTypeVisible 12
xlCellValue 1
xlCenter -4108
xlCenterAcrossSelection 7
xlCenterPoint 5
xlCentimeters 1
xlCGM 7
xlChangeAttributes 6
xlChangeByExcel 0
xlChangeByPowerPivotAddIn 1
xlChart -4109
xlChart4 2
xlChartArea 2
xlChartAsWindow 5
xlChartElementPositionAutomatic -4105
xlChartElementPositionCustom -4114
xlChartInPlace 4
xlChartSeries 17
xlChartShort 6
xlChartTitle 4
xlChartTitles 18
xlCheckBox 1
xlChecker 9
xlCheckInMajorVersion 1
xlCheckInMinorVersion 0
xlCheckInOverwriteVersion 2
xlChronological 3
xlCircle 8
xlClassic1 1
xlClassic2 2
xlClassic3 3
xlClipboard 3
xlClipboardFormatBIFF 8
xlClipboardFormatBIFF12 63
xlClipboardFormatBIFF2 18
xlClipboardFormatBIFF3 20
xlClipboardFormatBIFF4 30
xlClipboardFormatBinary 15
xlClipboardFormatBitmap 9
xlClipboardFormatCGM 13
xlClipboardFormatCSV 5
xlClipboardFormatDIF 4
xlClipboardFormatDspText 12
xlClipboardFormatEmbeddedObject 21
xlClipboardFormatEmbedSource 22
xlClipboardFormatLink 11
xlClipboardFormatLinkSource 23
xlClipboardFormatLinkSourceDesc 32
xlClipboardFormatMovie 24
xlClipboardFormatNative 14
xlClipboardFormatObjectDesc 31
xlClipboardFormatObjectLink 19
xlClipboardFormatOwnerLink 17
xlClipboardFormatPICT 2
xlClipboardFormatPrintPICT 3
xlClipboardFormatRTF 7
xlClipboardFormatScreenPICT 29
xlClipboardFormatStandardFont 28
xlClipboardFormatStandardScale 27
xlClipboardFormatSYLK 6
xlClipboardFormatTable 16
xlClipboardFormatText 0
xlClipboardFormatToolFace 25
xlClipboardFormatToolFacePICT 26
xlClipboardFormatVALU 1
xlClipboardFormatWK1 10
xlClosed 3
xlCmdCube 1
xlCmdDAX 8
xlCmdDefault 4
xlCmdExcel 7
xlCmdList 5
xlCmdSql 2
xlCmdTable 3
xlCmdTableCollection 6
xlCodePage 2
xlColGroups 2
xlColor1 7
xlColor2 8
xlColor3 9
xlColorIndexAutomatic -4105
xlColorIndexNone -4142
xlColorScale 3
xlColorScaleBlackWhite 3
xlColorScaleGYR 2
xlColorScaleRYG 1
xlColorScaleWhiteBlack 4
xlColumn 3
xlColumnClustered 51
xlColumnField 2
xlColumnHeader -4110
xlColumnItem 5
xlColumnLabels 2
xlColumns 2
xlColumnSeparator 14
xlColumnStacked 52
xlColumnStacked100 53
xlColumnStripe1 7
xlColumnStripe2 8
xlColumnSubheading1 20
xlColumnSubheading2 21
xlColumnSubheading3 22
xlColumnThenRow 2
xlCombination -4111
xlCommand 2
xlCommandUnderlinesAutomatic -4105
xlCommandUnderlinesOff -4146
xlCommandUnderlinesOn 1
xlCommentAndIndicator 1
xlCommentIndicatorOnly -1
xlComments -4144
xlCompactRow 0
xlComplete 4
xlConditionValueAutomaticMax 7
xlConditionValueAutomaticMin 6
xlConditionValueFormula 4
xlConditionValueHighestValue 2
xlConditionValueLowestValue 1
xlConditionValueNone -1
xlConditionValueNumber 0
xlConditionValuePercent 3
xlConditionValuePercentile 5
xlConeBarClustered 102
xlConeBarStacked 103
xlConeBarStacked100 104
xlConeCol 105
xlConeColClustered 99
xlConeColStacked 100
xlConeColStacked100 101
xlConeToMax 5
xlConeToPoint 4
xlConnectionTypeDATAFEED 6
xlConnectionTypeMODEL 7
xlConnectionTypeNOSOURCE 9
xlConnectionTypeODBC 2
xlConnectionTypeOLEDB 1
xlConnectionTypeTEXT 4
xlConnectionTypeWEB 5
xlConnectionTypeWORKSHEET 8
xlConnectionTypeXMLMAP 3
xlConsolidation 3
xlConstant 1
xlConstants 2
xlContains 0
xlContents 2
xlContext -5002
xlContinuous 1
xlCopy 1
xlCorner 2
xlCorners 6
xlCount -4112
xlCountNums -4113
xlCountryCode 1
xlCountrySetting 2
xlCreatorCode 1480803660
xlCredentialsMethodIntegrated 0
xlCredentialsMethodNone 1
xlCredentialsMethodStored 2
xlCrissCross 16
xlCross 4
xlCSV 6
xlCSVMac 22
xlCSVMSDOS 24
xlCSVUTF8 62
xlCSVWindows 23
xlCubeAttribute 4
xlCubeCalculatedMeasure 5
xlCubeHierarchy 1
xlCubeImplicitMeasure 11
xlCubeKPIGoal 7
xlCubeKPIStatus 8
xlCubeKPITrend 9
xlCubeKPIValue 6
xlCubeKPIWeight 10
xlCubeMeasure 2
xlCubeSet 3
xlCurrencyBefore 37
xlCurrencyCode 25
xlCurrencyDigits 27
xlCurrencyLeadingZeros 40
xlCurrencyMinusSign 38
xlCurrencyNegative 28
xlCurrencySpaceBefore 36
xlCurrencyTrailingZeros 39
xlCurrentPlatformText -4158
xlCustom -4114
xlCustomSet -1
xlCut 2
xlCylinder 3
xlCylinderBarClustered 95
xlCylinderBarStacked 96
xlCylinderBarStacked100 97
xlCylinderCol 98
xlCylinderColClustered 92
xlCylinderColStacked 93
xlCylinderColStacked100 94
xlDAORecordset 2
xlDash -4115
xlDashDot 4
xlDashDotDot 5
xlDataAndLabel 0
xlDatabar 4
xlDataBarAxisAutomatic 0
xlDataBarAxisMidpoint 1
xlDataBarAxisNone 2
xlDataBarBorderNone 0
xlDataBarBorderSolid 1
xlDataBarColor 0
xlDataBarFillGradient 1
xlDataBarFillSolid 0
xlDataBarSameAsPositive 1
xlDatabase 1
xlDataField 4
xlDataFieldScope 2
xlDataHeader 3
xlDataItem 7
xlDataLabel 0
xlDataLabelSeparatorDefault 1
xlDataLabelsShowBubbleSizes 6
xlDataLabelsShowLabel 4
xlDataLabelsShowLabelAndPercent 5
xlDataLabelsShowNone -4142
xlDataLabelsShowPercent 3
xlDataLabelsShowValue 2
xlDataOnly 2
xlDataSeriesLinear -4132
xlDataTable 7
xlDate 2
xlDateBetween 35
xlDateLastMonth 45
xlDateLastQuarter 48
xlDateLastWeek 42
xlDateLastYear 51
xlDateNextMonth 43
xlDateNextQuarter 46
xlDateNextWeek 40
xlDateNextYear 49
xlDateNotBetween 36
xlDateOrder 32
xlDateSeparator 17
xlDateThisMonth 44
xlDateThisQuarter 47
xlDateThisWeek 41
xlDateThisYear 50
xlDateToday 38
xlDateTomorrow 37
xlDateYesterday 39
xlDay 1
xlDayCode 21
xlDayLeadingZero 42
xlDays 0
xlDBF2 7
xlDBF3 8
xlDBF4 11
xlDebugCodePane 13
xlDecimalSeparator 3
xlDefault -4143
xlDefaultAutoFormat -1
xlDelimited 1
xlDescending 2
xlDesktop 9
xlDiagonalDown 5
xlDiagonalUp 6
xlDialogActivate 103
xlDialogActiveCellFont 476
xlDialogAddChartAutoformat 390
xlDialogAddinManager 321
xlDialogAlignment 43
xlDialogApplyNames 133
xlDialogApplyStyle 212
xlDialogAppMove 170
xlDialogAppSize 171
xlDialogArrangeAll 12
xlDialogAssignToObject 213
xlDialogAssignToTool 293
xlDialogAttachText 80
xlDialogAttachToolbars 323
xlDialogAutoCorrect 485
xlDialogAxes 78
xlDialogBorder 45
xlDialogCalculation 32
xlDialogCellProtection 46
xlDialogChangeLink 166
xlDialogChartAddData 392
xlDialogChartLocation 527
xlDialogChartOptionsDataLabelMultiple 724
xlDialogChartOptionsDataLabels 505
xlDialogChartOptionsDataTable 506
xlDialogChartSourceData 540
xlDialogChartTrend 350
xlDialogChartType 526
xlDialogChartWizard 288
xlDialogCheckboxProperties 435
xlDialogClear 52
xlDialogColorPalette 161
xlDialogColumnWidth 47
xlDialogCombination 73
xlDialogConditionalFormatting 583
xlDialogConsolidate 191
xlDialogCopyChart 147
xlDialogCopyPicture 108
xlDialogCreateList 796
xlDialogCreateNames 62
xlDialogCreatePublisher 217
xlDialogCreateRelationship 1272
xlDialogCustomizeToolbar 276
xlDialogCustomViews 493
xlDialogDataDelete 36
xlDialogDataLabel 379
xlDialogDataLabelMultiple 723
xlDialogDataSeries 40
xlDialogDataValidation 525
xlDialogDefineName 61
xlDialogDefineStyle 229
xlDialogDeleteFormat 111
xlDialogDeleteName 110
xlDialogDemote 203
xlDialogDisplay 27
xlDialogDocumentInspector 862
xlDialogEditboxProperties 438
xlDialogEditColor 223
xlDialogEditDelete 54
xlDialogEditionOptions 251
xlDialogEditSeries 228
xlDialogErrorbarX 463
xlDialogErrorbarY 464
xlDialogErrorChecking 732
xlDialogEvaluateFormula 709
xlDialogExternalDataProperties 530
xlDialogExtract 35
xlDialogFileDelete 6
xlDialogFileSharing 481
xlDialogFillGroup 200
xlDialogFillWorkgroup 301
xlDialogFilter 447
xlDialogFilterAdvanced 370
xlDialogFindFile 475
xlDialogFont 26
xlDialogFontProperties 381
xlDialogForecastETS 1300
xlDialogFormatAuto 269
xlDialogFormatChart 465
xlDialogFormatCharttype 423
xlDialogFormatFont 150
xlDialogFormatLegend 88
xlDialogFormatMain 225
xlDialogFormatMove 128
xlDialogFormatNumber 42
xlDialogFormatOverlay 226
xlDialogFormatSize 129
xlDialogFormatText 89
xlDialogFormulaFind 64
xlDialogFormulaGoto 63
xlDialogFormulaReplace 130
xlDialogFunctionWizard 450
xlDialogGallery3dArea 193
xlDialogGallery3dBar 272
xlDialogGallery3dColumn 194
xlDialogGallery3dLine 195
xlDialogGallery3dPie 196
xlDialogGallery3dSurface 273
xlDialogGalleryArea 67
xlDialogGalleryBar 68
xlDialogGalleryColumn 69
xlDialogGalleryCustom 388
xlDialogGalleryDoughnut 344
xlDialogGalleryLine 70
xlDialogGalleryPie 71
xlDialogGalleryRadar 249
xlDialogGalleryScatter 72
xlDialogGoalSeek 198
xlDialogGridlines 76
xlDialogImportTextFile 666
xlDialogInsert 55
xlDialogInsertHyperlink 596
xlDialogInsertNameLabel 496
xlDialogInsertObject 259
xlDialogInsertPicture 342
xlDialogInsertTitle 380
xlDialogLabelProperties 436
xlDialogListboxProperties 437
xlDialogMacroOptions 382
xlDialogMailEditMailer 470
xlDialogMailLogon 339
xlDialogMailNextLetter 378
xlDialogMainChart 85
xlDialogMainChartType 185
xlDialogManageRelationships 1271
xlDialogMenuEditor 322
xlDialogMove 262
xlDialogMyPermission 834
xlDialogNameManager 977
xlDialogNew 119
xlDialogNewName 978
xlDialogNewWebQuery 667
xlDialogNote 154
xlDialogObjectProperties 207
xlDialogObjectProtection 214
xlDialogOpen 1
xlDialogOpenLinks 2
xlDialogOpenMail 188
xlDialogOpenText 441
xlDialogOptionsCalculation 318
xlDialogOptionsChart 325
xlDialogOptionsEdit 319
xlDialogOptionsGeneral 356
xlDialogOptionsListsAdd 458
xlDialogOptionsME 647
xlDialogOptionsTransition 355
xlDialogOptionsView 320
xlDialogOutline 142
xlDialogOverlay 86
xlDialogOverlayChartType 186
xlDialogPageSetup 7
xlDialogParse 91
xlDialogPasteNames 58
xlDialogPasteSpecial 53
xlDialogPatterns 84
xlDialogPermission 832
xlDialogPhonetic 656
xlDialogPivotCalculatedField 570
xlDialogPivotCalculatedItem 572
xlDialogPivotClientServerSet 689
xlDialogPivotDefaultLayout 1360
xlDialogPivotFieldGroup 433
xlDialogPivotFieldProperties 313
xlDialogPivotFieldUngroup 434
xlDialogPivotShowPages 421
xlDialogPivotSolveOrder 568
xlDialogPivotTableOptions 567
xlDialogPivotTableSlicerConnections 1183
xlDialogPivotTableWhatIfAnalysisSettings 1153
xlDialogPivotTableWizard 312
xlDialogPlacement 300
xlDialogPrint 8
xlDialogPrinterSetup 9
xlDialogPrintPreview 222
xlDialogPromote 202
xlDialogProperties 474
xlDialogPropertyFields 754
xlDialogProtectDocument 28
xlDialogProtectSharing 620
xlDialogPublishAsWebPage 653
xlDialogPushbuttonProperties 445
xlDialogRecommendedPivotTables 1258
xlDialogReplaceFont 134
xlDialogRoutingSlip 336
xlDialogRowHeight 127
xlDialogRun 17
xlDialogSaveAs 5
xlDialogSaveCopyAs 456
xlDialogSaveNewObject 208
xlDialogSaveWorkbook 145
xlDialogSaveWorkspace 285
xlDialogScale 87
xlDialogScenarioAdd 307
xlDialogScenarioCells 305
xlDialogScenarioEdit 308
xlDialogScenarioMerge 473
xlDialogScenarioSummary 311
xlDialogScrollbarProperties 420
xlDialogSearch 731
xlDialogSelectSpecial 132
xlDialogSendMail 189
xlDialogSeriesAxes 460
xlDialogSeriesOptions 557
xlDialogSeriesOrder 466
xlDialogSeriesShape 504
xlDialogSeriesX 461
xlDialogSeriesY 462
xlDialogSetBackgroundPicture 509
xlDialogSetManager 1109
xlDialogSetMDXEditor 1208
xlDialogSetPrintTitles 23
xlDialogSetTupleEditorOnColumns 1108
xlDialogSetTupleEditorOnRows 1107
xlDialogSetUpdateStatus 159
xlDialogSheet -4116
xlDialogShowDetail 204
xlDialogShowToolbar 220
xlDialogSize 261
xlDialogSlicerCreation 1182
xlDialogSlicerPivotTableConnections 1184
xlDialogSlicerSettings 1179
xlDialogSort 39
xlDialogSortSpecial 192
xlDialogSparklineInsertColumn 1134
xlDialogSparklineInsertLine 1133
xlDialogSparklineInsertWinLoss 1135
xlDialogSplit 137
xlDialogStandardFont 190
xlDialogStandardWidth 472
xlDialogStyle 44
xlDialogSubscribeTo 218
xlDialogSubtotalCreate 398
xlDialogSummaryInfo 474
xlDialogTable 41
xlDialogTabOrder 394
xlDialogTextToColumns 422
xlDialogUnhide 94
xlDialogUpdateLink 201
xlDialogVbaInsertFile 328
xlDialogVbaMakeAddin 478
xlDialogVbaProcedureDefinition 330
xlDialogView3d 197
xlDialogWebOptionsBrowsers 773
xlDialogWebOptionsEncoding 686
xlDialogWebOptionsFiles 684
xlDialogWebOptionsFonts 687
xlDialogWebOptionsGeneral 683
xlDialogWebOptionsPictures 685
xlDialogWindowMove 14
xlDialogWindowSize 13
xlDialogWorkbookAdd 281
xlDialogWorkbookCopy 283
xlDialogWorkbookInsert 354
xlDialogWorkbookMove 282
xlDialogWorkbookName 386
xlDialogWorkbookNew 302
xlDialogWorkbookOptions 284
xlDialogWorkbookProtect 417
xlDialogWorkbookTabSplit 415
xlDialogWorkbookUnhide 384
xlDialogWorkgroup 199
xlDialogWorkspace 95
xlDialogZoom 256
xlDiamond 2
xlDIF 9
xlDifferenceFrom 2
xlDirect 1
xlDisabled 0
xlDisplayNone 1
xlDisplayPropertyInPivotTable 1
xlDisplayPropertyInPivotTableAndTooltip 3
xlDisplayPropertyInTooltip 2
xlDisplayShapes -4104
xlDisplayUnitLabel 30
xlDistinctCount 11
xlDistributed -4117
xlDivide 5
xlDMYFormat 4
xlDoesNotContain 1
xlDone 0
xlDoNotRepeatLabels 1
xlDoNotSaveChanges 2
xlDot -4118
xlDouble -4119
xlDoubleAccounting 5
xlDoubleClosed 5
xlDoubleOpen 4
xlDoubleQuote 1
xlDoughnut -4120
xlDoughnutExploded 80
xlDown -4121
xlDownBars 20
xlDownThenOver 1
xlDownward -4170
xlDrawingObject 14
xlDropDown 2
xlDropLines 26
xlDRW 4
xlDuplicate 1
xlDXF 5
xlDYMFormat 7
xlEdgeBottom 9
xlEdgeLeft 7
xlEdgeRight 10
xlEdgeTop 8
xlEditBox 3
xlEditionDate 2
xlEMDFormat 10
xlEmptyCellReferences 7
xlEnd 2
xlEndSides 3
xlEndsWith 3
xlEntireChart 20
xlEntirePage 1
xlEPS 8
xlEqual 3
xlEqualAboveAverage 2
xlEqualAllocation 1
xlEqualBelowAverage 3
xlErrBlocked 2047
xlErrCalc 2050
xlErrConnect 2046
xlErrDiv0 2007
xlErrField 2049
xlErrGettingData 2043
xlErrNA 2042
xlErrName 2029
xlErrNull 2000
xlErrNum 2036
xlErrorBarIncludeBoth 1
xlErrorBarIncludeMinusValues 3
xlErrorBarIncludeNone -4142
xlErrorBarIncludePlusValues 2
xlErrorBars 9
xlErrorBarTypeCustom -4114
xlErrorBarTypeFixedValue 1
xlErrorBarTypePercent 2
xlErrorBarTypeStDev -4155
xlErrorBarTypeStError 4
xlErrorHandler 2
xlErrors 16
xlErrorsCondition 16
xlErrRef 2023
xlErrSpill 2045
xlErrUnknown 2048
xlErrValue 2015
xlEscKey 1
xlEvaluateToError 1
xlExcel12 50
xlExcel2 16
xlExcel2FarEast 27
xlExcel3 29
xlExcel4 33
xlExcel4IntlMacroSheet 4
xlExcel4MacroSheet 3
xlExcel4Workbook 35
xlExcel5 39
xlExcel7 39
xlExcel8 56
xlExcel9795 43
xlExcelLinks 1
xlExcelMenus 1
xlExclusive 3
xlExponential 5
xlExpression 2
xlExtended 3
xlExternal 2
xlExtractData 2
xlFieldsScope 1
xlFileValidationPivotDefault 0
xlFileValidationPivotRun 1
xlFileValidationPivotSkip 2
xlFill 5
xlFillCopy 1
xlFillDays 5
xlFillDefault 0
xlFillFormats 3
xlFillMonths 7
xlFillSeries 2
xlFillValues 4
xlFillWeekdays 6
xlFillWithAll -4104
xlFillWithContents 2
xlFillWithFormats -4122
xlFillYears 8
xlFilterAboveAverage 33
xlFilterAllDatesInPeriodApril 24
xlFilterAllDatesInPeriodAugust 28
xlFilterAllDatesInPeriodDay 2
xlFilterAllDatesInPeriodDecember 32
xlFilterAllDatesInPeriodFebruray 22
xlFilterAllDatesInPeriodHour 3
xlFilterAllDatesInPeriodJanuary 21
xlFilterAllDatesInPeriodJuly 27
xlFilterAllDatesInPeriodJune 26
xlFilterAllDatesInPeriodMarch 23
xlFilterAllDatesInPeriodMay 25
xlFilterAllDatesInPeriodMinute 4
xlFilterAllDatesInPeriodMonth 1
xlFilterAllDatesInPeriodNovember 31
xlFilterAllDatesInPeriodOctober 30
xlFilterAllDatesInPeriodQuarter1 17
xlFilterAllDatesInPeriodQuarter2 18
xlFilterAllDatesInPeriodQuarter3 19
xlFilterAllDatesInPeriodQuarter4 20
xlFilterAllDatesInPeriodSecond 5
xlFilterAllDatesInPeriodSeptember 29
xlFilterAllDatesInPeriodYear 0
xlFilterAutomaticFontColor 13
xlFilterBelowAverage 34
xlFilterBottom 0
xlFilterBottomPercent 2
xlFilterCellColor 8
xlFilterCopy 2
xlFilterDynamic 11
xlFilterFontColor 9
xlFilterIcon 10
xlFilterInPlace 1
xlFilterLastMonth 8
xlFilterLastQuarter 11
xlFilterLastWeek 5
xlFilterLastYear 14
xlFilterNextMonth 9
xlFilterNextQuarter 12
xlFilterNextWeek 6
xlFilterNextYear 15
xlFilterNoFill 12
xlFilterNoIcon 14
xlFilterStatusDateHasTime 2
xlFilterStatusDateWrongOrder 1
xlFilterStatusInvalidDate 3
xlFilterStatusOK 0
xlFilterThisMonth 7
xlFilterThisQuarter 10
xlFilterThisWeek 4
xlFilterThisYear 13
xlFilterToday 1
xlFilterTomorrow 3
xlFilterTop 1
xlFilterTopPercent 3
xlFilterValues 7
xlFilterYearToDate 16
xlFilterYesterday 2
xlFirst 0
xlFirstColumn 3
xlFirstHeaderCell 9
xlFirstRow 256
xlFirstTotalCell 11
xlFitToPage 2
xlFixedValue 1
xlFixedWidth 2
xlFlashFill 11
xlFloating 5
xlFloor 23
xlForecastAggregationAverage 1
xlForecastAggregationCount 2
xlForecastAggregationCountA 3
xlForecastAggregationMax 4
xlForecastAggregationMedian 5
xlForecastAggregationMin 6
xlForecastAggregationSum 7
xlForecastChartTypeColumn 1
xlForecastChartTypeLine 0
xlForecastDataCompletionInterpolate 1
xlForecastDataCompletionZeros 0
xlFormatConditions 1
xlFormatFromLeftOrAbove 0
xlFormatFromRightOrBelow 1
xlFormats -4122
xlFormula 5
xlFormulas -4123
xlFreeFloating 3
xlFront 4
xlFrontEnd 6
xlFrontSides 5
xlFullPage 3
xlFullScript 1
xlFunction 1
xlFunnel 123
xlGeneral 1
xlGeneralFormat 1
xlGeneralFormatName 26
xlGenerateTableRefA1 0
xlGenerateTableRefStruct 1
xlGeoMappingLevelAutomatic 0
xlGeoMappingLevelCountryRegion 5
xlGeoMappingLevelCountryRegionList 6
xlGeoMappingLevelCounty 3
xlGeoMappingLevelDataOnly 1
xlGeoMappingLevelPostalCode 2
xlGeoMappingLevelState 4
xlGeoMappingLevelWorld 7
xlGeoProjectionTypeAlbers 3
xlGeoProjectionTypeAutomatic 0
xlGeoProjectionTypeMercator 1
xlGeoProjectionTypeMiller 2
xlGeoProjectionTypeRobinson 4
xlGradientFillLinear 0
xlGradientFillPath 1
xlGradientStopPositionTypeExtremeValue 0
xlGradientStopPositionTypeNumber 1
xlGradientStopPositionTypePercent 2
xlGrandTotalColumn 4
xlGrandTotalRow 2
xlGray16 17
xlGray25 -4124
xlGray50 -4125
xlGray75 -4126
xlGray8 18
xlGreater 5
xlGreaterEqual 7
xlGregorian 2
xlGrid 15
xlGridline 22
xlGroupBox 4
xlGrowth 2
xlGrowthTrend 10
xlGuess 0
xlHairline 1
xlHAlignCenter -4108
xlHAlignCenterAcrossSelection 7
xlHAlignDistributed -4117
xlHAlignFill 5
xlHAlignGeneral 1
xlHAlignJustify -4130
xlHAlignLeft -4131
xlHAlignRight -4152
xlHeaderRow 1
xlHebrewFullScript 0
xlHebrewMixedAuthorizedScript 3
xlHebrewMixedScript 2
xlHebrewPartialScript 1
xlHGL 6
xlHidden 0
xlHide 3
xlHierarchy 1
xlHigh -4127
xlHiLoLines 25
xlHindiNumerals 3
xlHiragana 2
xlHistogram 118
xlHorizontal -4128
xlHorizontalCoordinate 1
xlHourCode 22
xlHtml 44
xlHtmlCalc 1
xlHtmlChart 3
xlHtmlList 2
xlHtmlStatic 0
xlHundredMillions -8
xlHundreds -2
xlHundredThousands -5
xlIBeam 3
xlIcon0Bars 37
xlIcon0FilledBoxes 52
xlIcon1Bar 38
xlIcon1FilledBox 51
xlIcon2Bars 39
xlIcon2FilledBoxes 50
xlIcon3Bars 40
xlIcon3FilledBoxes 49
xlIcon4Bars 41
xlIcon4FilledBoxes 48
xlIconBlackCircle 32
xlIconBlackCircleWithBorder 13
xlIconCircleWithOneWhiteQuarter 33
xlIconCircleWithThreeWhiteQuarters 35
xlIconCircleWithTwoWhiteQuarters 34
xlIconGoldStar 42
xlIconGrayCircle 31
xlIconGrayDownArrow 6
xlIconGrayDownInclineArrow 28
xlIconGraySideArrow 5
xlIconGrayUpArrow 4
xlIconGrayUpInclineArrow 27
xlIconGreenCheck 22
xlIconGreenCheckSymbol 19
xlIconGreenCircle 10
xlIconGreenFlag 7
xlIconGreenTrafficLight 14
xlIconGreenUpArrow 1
xlIconGreenUpTriangle 45
xlIconHalfGoldStar 43
xlIconNoCellIcon -1
xlIconPinkCircle 30
xlIconRedCircle 29
xlIconRedCircleWithBorder 12
xlIconRedCross 24
xlIconRedCrossSymbol 21
xlIconRedDiamond 18
xlIconRedDownArrow 3
xlIconRedDownTriangle 47
xlIconRedFlag 9
xlIconRedTrafficLight 16
xlIcons 1
xlIconSets 6
xlIconSilverStar 44
xlIconWhiteCircleAllWhiteQuarters 36
xlIconYellowCircle 11
xlIconYellowDash 46
xlIconYellowDownInclineArrow 26
xlIconYellowExclamation 23
xlIconYellowExclamationSymbol 20
xlIconYellowFlag 8
xlIconYellowSideArrow 2
xlIconYellowTrafficLight 15
xlIconYellowTriangle 17
xlIconYellowUpInclineArrow 25
xlIMEModeAlpha 8
xlIMEModeAlphaFull 7
xlIMEModeDisable 3
xlIMEModeHangul 10
xlIMEModeHangulFull 9
xlIMEModeHiragana 4
xlIMEModeKatakana 5
xlIMEModeKatakanaHalf 6
xlIMEModeNoControl 0
xlIMEModeOff 2
xlIMEModeOn 1
xlImmediatePane 12
xlInches 0
xlInconsistentFormula 4
xlInconsistentListFormula 9
xlIndex 9
xlIndexAscending 0
xlIndexDescending 1
xlIndicatorAndButton 0
xlInfo -4129
xlInnerCenterPoint 8
xlInnerClockwisePoint 7
xlInnerCounterClockwisePoint 9
xlInsertDeleteCells 1
xlInsertEntireRows 2
xlInside 2
xlInsideHorizontal 12
xlInsideVertical 11
xlInteger 2
xlInterpolated 3
xlInterrupt 1
xlIntlAddIn 26
xlIntlMacro 25
xlJustify -4130
xlKatakana 1
xlKatakanaHalf 0
xlLabel 5
xlLabelOnly 1
xlLabelPositionAbove 0
xlLabelPositionBelow 1
xlLabelPositionBestFit 5
xlLabelPositionCenter -4108
xlLabelPositionCustom 7
xlLabelPositionInsideBase 4
xlLabelPositionInsideEnd 3
xlLabelPositionLeft -4131
xlLabelPositionMixed 6
xlLabelPositionOutsideEnd 2
xlLabelPositionRight -4152
xlLandscape 2
xlLast 1
xlLast7Days 2
xlLastCell 11
xlLastColumn 4
xlLastHeaderCell 10
xlLastMonth 5
xlLastTotalCell 12
xlLastWeek 4
xlLatin -5001
xlLeaderLines 29
xlLeft -4131
xlLeftBrace 12
xlLeftBracket 10
xlLeftToRight 2
xlLegend 24
xlLegendEntry 12
xlLegendKey 13
xlLegendPositionBottom -4107
xlLegendPositionCorner 2
xlLegendPositionCustom -4161
xlLegendPositionLeft -4131
xlLegendPositionRight -4152
xlLegendPositionTop -4160
xlLensOnly 0
xlLess 6
xlLessEqual 8
xlLightDown 13
xlLightHorizontal 11
xlLightUp 14
xlLightVertical 12
xlLine 4
xlLinear -4132
xlLinearTrend 9
xlLineMarkers 65
xlLineMarkersStacked 66
xlLineMarkersStacked100 67
xlLineStacked 63
xlLineStacked100 64
xlLineStyleNone -4142
xlLinkedDataTypeStateBrokenLinkedData 3
xlLinkedDataTypeStateDisambiguationNeeded 2
xlLinkedDataTypeStateFetchingData 4
xlLinkedDataTypeStateNone 0
xlLinkedDataTypeStateValidLinkedData 1
xlLinkInfoOLELinks 2
xlLinkInfoPublishers 5
xlLinkInfoStatus 3
xlLinkInfoSubscribers 6
xlLinkStatusCopiedValues 10
xlLinkStatusIndeterminate 5
xlLinkStatusInvalidName 7
xlLinkStatusMissingFile 1
xlLinkStatusMissingSheet 2
xlLinkStatusNotStarted 6
xlLinkStatusOK 0
xlLinkStatusOld 3
xlLinkStatusSourceNotCalculated 4
xlLinkStatusSourceNotOpen 8
xlLinkStatusSourceOpen 9
xlLinkTypeExcelLinks 1
xlLinkTypeOLELinks 2
xlList1 10
xlList2 11
xlList3 12
xlListBox 6
xlListConflictDialog 0
xlListConflictDiscardAllConflicts 2
xlListConflictError 3
xlListConflictRetryAllConflicts 1
xlListDataTypeCheckbox 9
xlListDataTypeChoice 6
xlListDataTypeChoiceMulti 7
xlListDataTypeCounter 11
xlListDataTypeCurrency 4
xlListDataTypeDateTime 5
xlListDataTypeHyperLink 10
xlListDataTypeListLookup 8
xlListDataTypeMultiLineRichText 12
xlListDataTypeMultiLineText 2
xlListDataTypeNone 0
xlListDataTypeNumber 3
xlListDataTypeText 1
xlListDataValidation 8
xlListSeparator 5
xlLocalFormat1 15
xlLocalFormat2 16
xlLocalSessionChanges 2
xlLocationAsNewSheet 1
xlLocationAsObject 2
xlLocationAutomatic 3
xlLogarithmic -4133
xlLogical 4
xlLogicalCursor 1
xlLong 3
xlLookForBlanks 0
xlLookForErrors 1
xlLookForFormulas 2
xlLotusHelp 2
xlLow -4134
xlLowerCaseColumnLetter 9
xlLowerCaseRowLetter 8
xlLTR -5003
xlMacintosh 1
xlMacrosheetCell 7
xlMajorGridlines 15
xlManual -4135
xlManualAllocation 1
xlManualUpdate 5
xlMAPI 1
xlMarkerStyleAutomatic -4105
xlMarkerStyleCircle 8
xlMarkerStyleDash -4115
xlMarkerStyleDiamond 2
xlMarkerStyleDot -4118
xlMarkerStyleNone -4142
xlMarkerStylePicture -4147
xlMarkerStylePlus 9
xlMarkerStyleSquare 1
xlMarkerStyleStar 5
xlMarkerStyleTriangle 3
xlMarkerStyleX -4168
xlMax -4136
xlMaximized -4137
xlMaximum 2
xlMDY 44
xlMDYFormat 3
xlMeasure 2
xlMedium -4138
xlMetric 35
xlMicrosoftAccess 4
xlMicrosoftFoxPro 5
xlMicrosoftMail 3
xlMicrosoftPowerPoint 2
xlMicrosoftProject 6
xlMicrosoftSchedulePlus 7
xlMicrosoftWord 1
xlMidClockwiseRadiusPoint 4
xlMidCounterClockwiseRadiusPoint 6
xlMillimeters 2
xlMillionMillions -10
xlMillions -6
xlMin -4139
xlMinimized -4140
xlMinimum 4
xlMinorGridlines 16
xlMinusValues 3
xlMinuteCode 23
xlMissingItemsDefault -1
xlMissingItemsMax 32500
xlMissingItemsMax2 1048576
xlMissingItemsNone 0
xlMixed 2
xlMixedAuthorizedScript 4
xlMixedLabels 3
xlMixedScript 3
xlModule -4141
xlMonth 3
xlMonthCode 20
xlMonthLeadingZero 41
xlMonthNameChars 30
xlMonths 1
xlMove 2
xlMoveAndSize 1
xlMovingAvg 6
xlMSDOS 3
xlMultiply 4
xlMYDFormat 6
xlNarrow 1
xlNever 2
xlNext 1
xlNextMonth 8
xlNextToAxis 4
xlNextWeek 7
xlNo 2
xlNoAdditionalCalculation -4143
xlNoBlanksCondition 13
xlNoButton 0
xlNoButtonChanges 1
xlNoCap 2
xlNoChange 1
xlNoChanges 4
xlNoConversion 3
xlNoDockingChanges 3
xlNoDocuments 3
xlNoErrorsCondition 17
xlNoIndicator 0
xlNoKey 0
xlNoLabels -4142
xlNoMailSystem 0
xlNoncurrencyDigits 29
xlNone -4142
xlNonEnglishFunctions 34
xlNoRestrictions 0
xlNormal -4143
xlNormalLoad 0
xlNormalView 1
xlNorthwestArrow 1
xlNoSelection -4142
xlNoShapeChanges 2
xlNotBetween 2
xlNotEqual 4
xlNotes -4144
xlNothing 28
xlNotPlotted 1
xlNotSpecificDate 30
xlNotXLM 3
xlNotYetReviewed 3
xlNotYetRouted 0
xlNumber -4145
xlNumberAsText 3
xlNumberFormatTypeDefault 0
xlNumberFormatTypeNumber 1
xlNumberFormatTypePercent 2
xlNumbers 1
xlOartHorizontalOverflowClip 1
xlOartHorizontalOverflowOverflow 0
xlOartVerticalOverflowClip 1
xlOartVerticalOverflowEllipsis 2
xlOartVerticalOverflowOverflow 0
xlODBCQuery 1
xlOff -4146
xlOLEControl 2
xlOLEDBQuery 5
xlOLEEmbed 1
xlOLELink 0
xlOLELinks 2
xlOmittedCells 5
xlOn 1
xlOneAfterAnother 1
xlOpaque 3
xlOpen 2
xlOpenDocumentSpreadsheet 60
xlOpenSource 3
xlOpenXMLAddIn 55
xlOpenXMLStrictWorkbook 61
xlOpenXMLTemplate 54
xlOpenXMLTemplateMacroEnabled 53
xlOpenXMLWorkbook 51
xlOpenXMLWorkbookMacroEnabled 52
xlOptionButton 7
xlOr 2
xlOrigin 3
xlOtherSessionChanges 3
xlOuterCenterPoint 2
xlOuterClockwisePoint 3
xlOuterCounterClockwisePoint 1
xlOutline 1
xlOutlineRow 2
xlOutside 3
xlOverThenDown 2
xlOverwriteCells 0
xlPageBreakAutomatic -4105
xlPageBreakFull 1
xlPageBreakManual -4135
xlPageBreakNone -4142
xlPageBreakPartial 2
xlPageBreakPreview 2
xlPageField 3
xlPageFieldLabels 26
xlPageFieldValues 27
xlPageHeader 2
xlPageItem 6
xlPageLayoutView 3
xlPaper10x14 16
xlPaper11x17 17
xlPaperA3 8
xlPaperA4 9
xlPaperA4Small 10
xlPaperA5 11
xlPaperB4 12
xlPaperB5 13
xlPaperCsheet 24
xlPaperDsheet 25
xlPaperEnvelope10 20
xlPaperEnvelope11 21
xlPaperEnvelope12 22
xlPaperEnvelope14 23
xlPaperEnvelope9 19
xlPaperEnvelopeB4 33
xlPaperEnvelopeB5 34
xlPaperEnvelopeB6 35
xlPaperEnvelopeC3 29
xlPaperEnvelopeC4 30
xlPaperEnvelopeC5 28
xlPaperEnvelopeC6 31
xlPaperEnvelopeC65 32
xlPaperEnvelopeDL 27
xlPaperEnvelopeItaly 36
xlPaperEnvelopeMonarch 37
xlPaperEnvelopePersonal 38
xlPaperEsheet 26
xlPaperExecutive 7
xlPaperFanfoldLegalGerman 41
xlPaperFanfoldStdGerman 40
xlPaperFanfoldUS 39
xlPaperFolio 14
xlPaperLedger 4
xlPaperLegal 5
xlPaperLetter 1
xlPaperLetterSmall 2
xlPaperNote 18
xlPaperQuarto 15
xlPaperStatement 6
xlPaperTabloid 3
xlPaperUser 256
xlParamTypeBigInt -5
xlParamTypeBinary -2
xlParamTypeBit -7
xlParamTypeChar 1
xlParamTypeDate 9
xlParamTypeDecimal 3
xlParamTypeDouble 8
xlParamTypeFloat 6
xlParamTypeInteger 4
xlParamTypeLongVarBinary -4
xlParamTypeLongVarChar -1
xlParamTypeNumeric 2
xlParamTypeReal 7
xlParamTypeSmallInt 5
xlParamTypeTime 10
xlParamTypeTimestamp 11
xlParamTypeTinyInt -6
xlParamTypeUnknown 0
xlParamTypeVarBinary -3
xlParamTypeVarChar 12
xlParamTypeWChar -8
xlParentDataLabelOptionsBanner 1
xlParentDataLabelOptionsNone 0
xlParentDataLabelOptionsOverlapping 2
xlPareto 122
xlPart 2
xlPartial 3
xlPartialScript 2
xlPasteAll -4104
xlPasteAllExceptBorders 7
xlPasteAllMergingConditionalFormats 14
xlPasteAllUsingSourceTheme 13
xlPasteColumnWidths 8
xlPasteComments -4144
xlPasteFormats -4122
xlPasteFormulas -4123
xlPasteFormulasAndNumberFormats 11
xlPasteSpecialOperationAdd 2
xlPasteSpecialOperationDivide 5
xlPasteSpecialOperationMultiply 4
xlPasteSpecialOperationNone -4142
xlPasteSpecialOperationSubtract 3
xlPasteValidation 6
xlPasteValues -4163
xlPasteValuesAndNumberFormats 12
xlPatternAutomatic -4105
xlPatternChecker 9
xlPatternCrissCross 16
xlPatternDown -4121
xlPatternGray16 17
xlPatternGray25 -4124
xlPatternGray50 -4125
xlPatternGray75 -4126
xlPatternGray8 18
xlPatternGrid 15
xlPatternHorizontal -4128
xlPatternLightDown 13
xlPatternLightHorizontal 11
xlPatternLightUp 14
xlPatternLightVertical 12
xlPatternLinearGradient 4000
xlPatternNone -4142
xlPatternRectangularGradient 4001
xlPatternSemiGray75 10
xlPatternSolid 1
xlPatternUp -4162
xlPatternVertical -4166
xlPCT 13
xlPCX 10
xlPending 2
xlPercent 2
xlPercentDifferenceFrom 4
xlPercentOf 3
xlPercentOfColumn 7
xlPercentOfParent 12
xlPercentOfParentColumn 11
xlPercentOfParentRow 10
xlPercentOfRow 6
xlPercentOfTotal 8
xlPercentRunningTotal 13
xlPhoneticAlignCenter 2
xlPhoneticAlignDistributed 3
xlPhoneticAlignLeft 1
xlPhoneticAlignNoControl 0
xlPIC 11
xlPICT 1
xlPicture -4147
xlPie 5
xlPieExploded 69
xlPieOfPie 68
xlPinYin 1
xlPivotCellBlankCell 9
xlPivotCellCustomSubtotal 7
xlPivotCellDataField 4
xlPivotCellDataPivotField 8
xlPivotCellGrandTotal 3
xlPivotCellPageFieldItem 6
xlPivotCellPivotField 5
xlPivotCellPivotItem 1
xlPivotCellSubtotal 2
xlPivotCellValue 0
xlPivotChartCollapseEntireFieldButton 34
xlPivotChartDropZone 32
xlPivotChartExpandEntireFieldButton 33
xlPivotChartFieldButton 31
xlPivotLineBlank 3
xlPivotLineGrandTotal 2
xlPivotLineRegular 0
xlPivotLineSubtotal 1
xlPivotTable -4148
xlPivotTableReport 1
xlPivotTableVersion10 1
xlPivotTableVersion11 2
xlPivotTableVersion12 3
xlPivotTableVersion14 4
xlPivotTableVersion15 5
xlPivotTableVersion2000 0
xlPivotTableVersionCurrent -1
xlPlaceholders 2
xlPlotArea 19
xlPLT 12
xlPlus 9
xlPlusValues 2
xlPolynomial 3
xlPortrait 1
xlPortugueseBoth 3
xlPortuguesePostReform 2
xlPortuguesePreReform 1
xlPower 4
xlPowerTalk 2
xlPrevious 2
xlPrimary 1
xlPrimaryButton 1
xlPrinter 2
xlPrintErrorsBlank 1
xlPrintErrorsDash 2
xlPrintErrorsDisplayed 0
xlPrintErrorsNA 3
xlPrintInPlace 16
xlPrintNoComments -4142
xlPrintSheetEnd 1
xlPriorityHigh -4127
xlPriorityLow -4134
xlPriorityNormal -4143
xlProduct -4149
xlPrompt 0
xlProtectedViewCloseEdit 1
xlProtectedViewCloseForced 2
xlProtectedViewCloseNormal 0
xlProtectedViewWindowMaximized 2
xlProtectedViewWindowMinimized 1
xlProtectedViewWindowNormal 0
xlPTClassic 20
xlPTNone 21
xlPublisher 1
xlPublishers 5
xlPyramidBarClustered 109
xlPyramidBarStacked 110
xlPyramidBarStacked100 111
xlPyramidCol 112
xlPyramidColClustered 106
xlPyramidColStacked 107
xlPyramidColStacked100 108
xlPyramidToMax 2
xlPyramidToPoint 1
xlQualityMinimum 1
xlQualityStandard 0
xlQueryTable 0
xlR1C1 -4150
xlRadar -4151
xlRadarAxisLabels 27
xlRadarFilled 82
xlRadarMarkers 81
xlRange 2
xlRangeAutoFormat3DEffects1 13
xlRangeAutoFormat3DEffects2 14
xlRangeAutoFormatAccounting1 4
xlRangeAutoFormatAccounting2 5
xlRangeAutoFormatAccounting3 6
xlRangeAutoFormatAccounting4 17
xlRangeAutoFormatClassic1 1
xlRangeAutoFormatClassic2 2
xlRangeAutoFormatClassic3 3
xlRangeAutoFormatClassicPivotTable 31
xlRangeAutoFormatColor1 7
xlRangeAutoFormatColor2 8
xlRangeAutoFormatColor3 9
xlRangeAutoFormatList1 10
xlRangeAutoFormatList2 11
xlRangeAutoFormatList3 12
xlRangeAutoFormatLocalFormat1 15
xlRangeAutoFormatLocalFormat2 16
xlRangeAutoFormatLocalFormat3 19
xlRangeAutoFormatLocalFormat4 20
xlRangeAutoFormatNone -4142
xlRangeAutoFormatPTNone 42
xlRangeAutoFormatReport1 21
xlRangeAutoFormatReport10 30
xlRangeAutoFormatReport2 22
xlRangeAutoFormatReport3 23
xlRangeAutoFormatReport4 24
xlRangeAutoFormatReport5 25
xlRangeAutoFormatReport6 26
xlRangeAutoFormatReport7 27
xlRangeAutoFormatReport8 28
xlRangeAutoFormatReport9 29
xlRangeAutoFormatSimple -4154
xlRangeAutoFormatTable1 32
xlRangeAutoFormatTable10 41
xlRangeAutoFormatTable2 33
xlRangeAutoFormatTable3 34
xlRangeAutoFormatTable4 35
xlRangeAutoFormatTable5 36
xlRangeAutoFormatTable6 37
xlRangeAutoFormatTable7 38
xlRangeAutoFormatTable8 39
xlRangeAutoFormatTable9 40
xlRangeValueDefault 10
xlRangeValueMSPersistXML 12
xlRangeValueXMLSpreadsheet 11
xlRankAscending 14
xlRankDecending 15
xlRDIAll 99
xlRDIComments 1
xlRDIContentType 16
xlRDIDefinedNameComments 18
xlRDIDocumentManagementPolicy 15
xlRDIDocumentProperties 8
xlRDIDocumentServerProperties 14
xlRDIDocumentWorkspace 10
xlRDIEmailHeader 5
xlRDIExcelDataModel 23
xlRDIInactiveDataConnections 19
xlRDIInkAnnotations 11
xlRDIInlineWebExtensions 21
xlRDIPrinterPath 20
xlRDIPublishInfo 13
xlRDIRemovePersonalInformation 4
xlRDIRoutingSlip 6
xlRDIScenarioComments 12
xlRDISendForReview 7
xlRDITaskpaneWebExtensions 22
xlReadOnly 3
xlReadWrite 2
xlRecommendedCharts 2
xlReference 4
xlRegionLabelOptionsBestFitOnly 1
xlRegionLabelOptionsNone 0
xlRegionLabelOptionsShowAll 2
xlRegionMap 140
xlRelative 4
xlRelRowAbsColumn 3
xlRepairFile 1
xlRepeatLabels 2
xlReport1 0
xlReport10 9
xlReport2 1
xlReport3 2
xlReport4 3
xlReport5 4
xlReport6 5
xlReport7 6
xlReport8 7
xlReport9 8
xlRight -4152
xlRightBrace 13
xlRightBracket 11
xlRoutingComplete 2
xlRoutingInProgress 1
xlRowField 1
xlRowGroups 1
xlRowHeader -4153
xlRowItem 4
xlRowLabels 1
xlRows 1
xlRowSeparator 15
xlRowStripe1 5
xlRowStripe2 6
xlRowSubheading1 23
xlRowSubheading2 24
xlRowSubheading3 25
xlRowThenColumn 1
xlRTF 4
xlRTL -5004
xlRunningTotal 5
xlSaveChanges 1
xlScale 3
xlScaleLinear -4132
xlScaleLogarithmic -4133
xlScenario 4
xlScreen 1
xlScreenSize 1
xlScrollBar 8
xlSecondary 2
xlSecondaryButton 2
xlSecondCode 24
xlSelect 3
xlSelectionScope 0
xlSemiautomatic 2
xlSemiGray75 10
xlSendPublisher 2
xlSeries 3
xlSeriesAxis 3
xlSeriesColorGradientStyleDiverging 1
xlSeriesColorGradientStyleSequential 0
xlSeriesLines 22
xlSeriesNameLevelAll -1
xlSeriesNameLevelCustom -2
xlSeriesNameLevelNone -3
xlSet 3
xlShape 14
xlShared 2
xlSheetHidden 0
xlSheetVeryHidden 2
xlSheetVisible -1
xlShiftDown -4121
xlShiftToLeft -4159
xlShiftToRight -4161
xlShiftUp -4162
xlShort 1
xlShowLabel 4
xlShowLabelAndPercent 5
xlShowPercent 3
xlShowValue 2
xlSides 1
xlSimple -4154
xlSinceMyLastSave 1
xlSingle 2
xlSingleAccounting 4
xlSingleQuote 2
xlSizeIsArea 1
xlSizeIsWidth 2
xlSkipColumn 9
xlSlantDashDot 13
xlSlicer 1
xlSlicerCrossFilterHideButtonsWithNoData 4
xlSlicerCrossFilterShowItemsWithDataAtTop 2
xlSlicerCrossFilterShowItemsWithNoData 3
xlSlicerHoveredSelectedItemWithData 33
xlSlicerHoveredSelectedItemWithNoData 35
xlSlicerHoveredUnselectedItemWithData 32
xlSlicerHoveredUnselectedItemWithNoData 34
xlSlicerNoCrossFilter 1
xlSlicerSelectedItemWithData 30
xlSlicerSelectedItemWithNoData 31
xlSlicerSortAscending 2
xlSlicerSortDataSourceOrder 1
xlSlicerSortDescending 3
xlSlicerUnselectedItemWithData 28
xlSlicerUnselectedItemWithNoData 29
xlSmartTagControlActiveX 13
xlSmartTagControlButton 6
xlSmartTagControlCheckbox 9
xlSmartTagControlCombo 12
xlSmartTagControlHelp 3
xlSmartTagControlHelpURL 4
xlSmartTagControlImage 8
xlSmartTagControlLabel 7
xlSmartTagControlLink 2
xlSmartTagControlListbox 11
xlSmartTagControlRadioGroup 14
xlSmartTagControlSeparator 5
xlSmartTagControlSmartTag 1
xlSmartTagControlTextbox 10
xlSolid 1
xlSortColumns 1
xlSortLabels 2
xlSortNormal 0
xlSortOnCellColor 1
xlSortOnFontColor 2
xlSortOnIcon 3
xlSortOnValues 0
xlSortRows 2
xlSortTextAsNumbers 1
xlSortValues 1
xlSourceAutoFilter 3
xlSourceChart 5
xlSourcePivotTable 6
xlSourcePrintArea 2
xlSourceQuery 7
xlSourceRange 4
xlSourceSheet 1
xlSourceWorkbook 0
xlSpanishTuteoAndVoseo 1
xlSpanishTuteoOnly 0
xlSpanishVoseoOnly 2
xlSparkColumn 2
xlSparkColumnStacked100 3
xlSparkLine 1
xlSparklineColumnsSquare 2
xlSparklineNonSquare 0
xlSparklineRowsSquare 1
xlSparklines 5
xlSparkScaleCustom 3
xlSparkScaleGroup 1
xlSparkScaleSingle 2
xlSpeakByColumns 1
xlSpeakByRows 0
xlSpecificDate 29
xlSpecifiedTables 3
xlSpinner 9
xlSplitByCustomSplit 4
xlSplitByPercentValue 3
xlSplitByPosition 1
xlSplitByValue 2
xlSquare 1
xlSrcExternal 0
xlSrcModel 4
xlSrcQuery 3
xlSrcRange 1
xlSrcXml 2
xlStack 2
xlStackScale 3
xlStandardSummary 1
xlStar 5
xlStDev -4155
xlStDevP -4156
xlStError 4
xlStockHLC 88
xlStockOHLC 89
xlStockVHLC 90
xlStockVOHLC 91
xlStretch 1
xlStrict 2
xlStroke 2
xlSubscriber 2
xlSubscribers 6
xlSubscribeToPicture -4147
xlSubscribeToText -4158
xlSubtotalColumn1 13
xlSubtotalColumn2 14
xlSubtotalColumn3 15
xlSubtotalRow1 16
xlSubtotalRow2 17
xlSubtotalRow3 18
xlSubtract 3
xlSum -4157
xlSummaryAbove 0
xlSummaryBelow 1
xlSummaryOnLeft -4131
xlSummaryOnRight -4152
xlSummaryPivotTable -4148
xlSunburst 120
xlSurface 83
xlSurfaceTopView 85
xlSurfaceTopViewWireframe 86
xlSurfaceWireframe 84
xlSYLK 2
xlSyllabary 1
xlSystem 1
xlTable 2
xlTable1 10
xlTable10 19
xlTable2 11
xlTable3 12
xlTable4 13
xlTable5 14
xlTable6 15
xlTable7 16
xlTable8 17
xlTable9 18
xlTableBody 8
xlTables 4
xlTabPositionFirst 0
xlTabPositionLast 1
xlTabular 0
xlTabularRow 1
xlTemplate 17
xlTemplate8 17
xlTenMillions -7
xlTenThousands -4
xlText -4158
xlTextBox 16
xlTextDate 2
xlTextFormat 2
xlTextImport 6
xlTextMac 19
xlTextMSDOS 21
xlTextPrinter 36
xlTextQualifierDoubleQuote 1
xlTextQualifierNone -4142
xlTextQualifierSingleQuote 2
xlTextString 9
xlTextValues 2
xlTextVisualLTR 1
xlTextVisualRTL 2
xlTextWindows 20
xlThemeColorAccent1 5
xlThemeColorAccent2 6
xlThemeColorAccent3 7
xlThemeColorAccent4 8
xlThemeColorAccent5 9
xlThemeColorAccent6 10
xlThemeColorDark1 1
xlThemeColorDark2 3
xlThemeColorFollowedHyperlink 12
xlThemeColorHyperlink 11
xlThemeColorLight1 2
xlThemeColorLight2 4
xlThemeFontMajor 1
xlThemeFontMinor 2
xlThemeFontNone 0
xlThick 4
xlThin 2
xlThisMonth 9
xlThisWeek 3
xlThousandMillions -9
xlThousands -3
xlThousandsSeparator 4
xlThreadModeAutomatic 0
xlThreadModeManual 1
xlTickLabelOrientationAutomatic -4105
xlTickLabelOrientationDownward -4170
xlTickLabelOrientationHorizontal -4128
xlTickLabelOrientationUpward -4171
xlTickLabelOrientationVertical -4166
xlTickLabelPositionHigh -4127
xlTickLabelPositionLow -4134
xlTickLabelPositionNextToAxis 4
xlTickLabelPositionNone -4142
xlTickMarkCross 4
xlTickMarkInside 2
xlTickMarkNone -4142
xlTickMarkOutside 3
xlTIF 9
xlTiled 1
xlTimeLeadingZero 45
xlTimeline 2
xlTimelineLevelDays 3
xlTimelineLevelMonths 2
xlTimelineLevelQuarters 1
xlTimelineLevelYears 0
xlTimelinePeriodLabels1 38
xlTimelinePeriodLabels2 39
xlTimelineSelectedTimeBlock 40
xlTimelineSelectedTimeBlockSpace 42
xlTimelineSelectionLabel 36
xlTimelineTimeLevel 37
xlTimelineUnselectedTimeBlock 41
xlTimePeriod 11
xlTimeScale 3
xlTimeSeparator 18
xlTitleBar 8
xlToday 0
xlToLeft -4159
xlTomorrow 6
xlToolbar 1
xlToolbarButton 2
xlToolbarProtectionNone -4143
xlTop -4160
xlTop10 5
xlTop10Bottom 0
xlTop10Items 3
xlTop10Percent 5
xlTop10Top 1
xlTopCount 1
xlTopPercent 3
xlTopSum 5
xlTopToBottom 1
xlToRight -4161
xlTotalRow 2
xlTotals 3
xlTotalsCalculationAverage 2
xlTotalsCalculationCount 3
xlTotalsCalculationCountNums 4
xlTotalsCalculationCustom 9
xlTotalsCalculationMax 6
xlTotalsCalculationMin 5
xlTotalsCalculationNone 0
xlTotalsCalculationStdDev 7
xlTotalsCalculationSum 1
xlTotalsCalculationVar 8
xlTransparent 2
xlTreemap 117
xlTrendline 8
xlTriangle 3
xlTypePDF 0
xlTypeXPS 1
xlUICultureTag 46
xlUnderlineStyleDouble -4119
xlUnderlineStyleDoubleAccounting 5
xlUnderlineStyleNone -4142
xlUnderlineStyleSingle 2
xlUnderlineStyleSingleAccounting 4
xlUnicodeText 42
xlUnique 0
xlUniqueValues 8
xlUnknown 1000
xlUnlockedCells 1
xlUnlockedFormulaCells 6
xlUp -4162
xlUpBars 18
xlUpdateLinksAlways 3
xlUpdateLinksNever 2
xlUpdateLinksUserSetting 1
xlUpdateState 1
xlUpdateSubscriber 2
xlUpperCaseColumnLetter 7
xlUpperCaseRowLetter 6
xlUpward -4171
xlUserDefined 22
xlUserResolution 1
xlValidAlertInformation 3
xlValidAlertStop 1
xlValidAlertWarning 2
xlValidateCustom 7
xlValidateDate 4
xlValidateDecimal 2
xlValidateInputOnly 0
xlValidateList 3
xlValidateTextLength 6
xlValidateTime 5
xlValidateWholeNumber 1
xlVAlignBottom -4107
xlVAlignCenter -4108
xlVAlignDistributed -4117
xlVAlignJustify -4130
xlVAlignTop -4160
xlVALU 8
xlValue 2
xlValueAscending 1
xlValueDescending 2
xlValueDoesNotEqual 8
xlValueEquals 7
xlValueIsBetween 13
xlValueIsGreaterThan 9
xlValueIsGreaterThanOrEqualTo 10
xlValueIsLessThan 11
xlValueIsLessThanOrEqualTo 12
xlValueIsNotBetween 14
xlValueNone 0
xlValues -4163
xlVar -4164
xlVarP -4165
xlVerbOpen 2
xlVerbPrimary 1
xlVertical -4166
xlVerticalCoordinate 2
xlVeryHidden 2
xlVisible 12
xlVisualCursor 2
xlWait 2
xlWalls 5
xlWatchPane 11
xlWaterfall 119
xlWBATChart -4109
xlWBATExcel4IntlMacroSheet 4
xlWBATExcel4MacroSheet 3
xlWBATWorksheet -4167
xlWebArchive 45
xlWebFormattingAll 1
xlWebFormattingNone 3
xlWebFormattingRTF 2
xlWebQuery 4
xlWeekday 2
xlWeekdayNameChars 31
xlWeightedAllocation 2
xlWhole 1
xlWholeTable 0
xlWide 3
xlWindows 2
xlWithinSheet 1
xlWithinWorkbook 2
xlWJ2WD1 14
xlWJ3 40
xlWJ3FJ3 41
xlWK1 5
xlWK1ALL 31
xlWK1FMT 30
xlWK3 15
xlWK3FM3 32
xlWK4 38
xlWKS 4
xlWMF 2
xlWorkbook 1
xlWorkbookDefault 51
xlWorkbookNormal -4143
xlWorkbookTab 6
xlWorks2FarEast 28
xlWorksheet -4167
xlWorksheet4 1
xlWorksheetCell 3
xlWorksheetShort 5
xlWPG 3
xlWQ1 34
xlX -4168
xlXErrorBars 10
xlXmlExportSuccess 0
xlXmlExportValidationFailed 1
xlXmlImportElementsTruncated 1
xlXmlImportSuccess 0
xlXmlImportValidationFailed 2
xlXmlLoadImportToList 2
xlXmlLoadMapXml 3
xlXmlLoadOpenXml 1
xlXmlLoadPromptUser 0
xlXMLSpreadsheet 46
xlXYScatter -4169
xlXYScatterLines 74
xlXYScatterLinesNoMarkers 75
xlXYScatterSmooth 72
xlXYScatterSmoothNoMarkers 73
xlY 1
xlYDMFormat 8
xlYear 4
xlYearCode 19
xlYears 2
xlYearToDate 52
xlYErrorBars 11
xlYes 1
xlYesterday 1
xlYMDFormat 5
xlZero 2
Code: Select all
#SingleInstance, Force
SetBatchLines, -1
c := new OfficeInfo
Gui, Add, Listview, vLV1 w400 h600 -ReadOnly, Key|Value
LV_ModifyCol(1, 300), LV_ModifyCol(2, 90)
for k, v in c
LV_Add("", k, v)
Gui, Show
for k, v in c
out .= A_Index ">" Format("{:" (50-StrLen(A_Index)) "}", k) " " v "`r`n"
Clipboard := out
return
GuiClose:
ExitApp
; https://autohotkey.com/boards/viewtopic.php?f=6&t=23164
; Updated: Sept. 7, 2016
class OfficeInfo
{
__New()
{
static Programs := { "Excel": "{00020813-0000-0000-C000-000000000046}"}
ObjRawSet(this, "_Unlocked", true)
for ProgramName, ProgramGUID in Programs
new this._ProgramInfo(ProgramGUID, this)
this.Delete("_Unlocked")
}
__Get(aName)
{
if !this.HasKey("_Unlocked")
throw Exception( "`nThe requested key does not exist. Specifically:`n`n"
. "Key: " aName )
}
__Set(aName, aValue)
{
if !this.HasKey("_Unlocked")
throw Exception( "`nCannot create new keys. Specifically:`n`n"
. "Key: " aName "`n"
. "Value: " aValue )
else
ObjRawSet(this, aName, aValue)
return this[aName]
}
class _ProgramInfo
{
__New(GUID, Parent)
{
this.GUID := GUID
this.Parent := Parent
this.GetTypeLibVersion()
this.GetTypeLib()
this.GetFlatTypeLib()
}
GetTypeLibVersion()
{
Loop, Reg, % "HKCR\TypeLib\" this.GUID, K
{
for i, VerPart in StrSplit(A_LoopRegName, ".")
{
if VerPart is integer
Version .= VerPart "."
else if VerPart is xdigit
Version .= Format("{:i}", "0x" VerPart) "."
}
return this.Version := RTrim(Version, ".")
}
}
GetTypeLib()
{
try return this.TypeLib := ImportTypeLib(this.GUID, this.Version)
catch e
OutputDebug, % "Failed to load type library!`n"
. "GUID: " this.GUID "`n"
. "Version: " this.Version "`n"
. "Message: " e.Message "`n"
. "What: " e.What "`n"
. "Extra: " e.Extra "`n"
. "File: " e.File "`n"
. "Line: " e.Line "`n"
}
GetFlatTypeLib()
{
this.Enumerate(this.TypeLib)
return this.Parent
}
; Get each item in the type library and place it in the parent OfficeInfo object.
Enumerate(a, Depth:=2)
{
try for k, v in a
{
if IsObject(v) && Depth > 1
this.Enumerate(v, Depth - 1)
else if !this.Parent[k] && !ITL.Properties.IsInternalProperty(k)
this.Parent[k] := v ; store retrieved value in parent
}
}
}
}
/*
Function: ImportTypeLib
loads a type library and returns a wrapper object
Parameters:
lib - either the path to the library or the GUID if it is registered within the system.
If the path passed points to a file (e.g. a DLL) containing the type library, but it is not the first resource, append the index like so:
> ImportTypeLib("C:\Path\to\Lib.dll\2")
[opt] version - if a GUID is passed, specify the type library version here. Defaults to "1.0" (use exactly that format!).
*/
ImportTypeLib(lib, version = "1.0")
{
local ver, verMajor, verMinor, libid, hr
if (ITL_GUID_IsGUIDString(lib))
{
if (!RegExMatch(version, "^(?P<Major>\d+)\.(?P<Minor>\d+)$", ver))
{
throw Exception(ITL_FormatException("An invalid version was specified: """ version """.", "", ErrorLevel)*)
}
hr := ITL_GUID_FromString(lib, libid)
if (ITL_FAILED(hr))
{
throw Exception(ITL_FormatException("Failed to load type library.", "LIBID """ lib """ could not be converted.", ErrorLevel, hr)*)
}
hr := DllCall("OleAut32\LoadRegTypeLib", "Ptr", &libid, "UShort", verMajor, "UShort", verMinor, "UInt", 0, "Ptr*", lib, "Int") ; error handling is done below
VarSetCapacity(libid, 0)
}
else
{
hr := DllCall("OleAut32\LoadTypeLib", "Str", lib, "Ptr*", lib, "Int") ; error handling is done below
}
if (ITL_FAILED(hr) || !lib)
{
throw Exception(ITL_FormatException("Failed to load type library.", "", ErrorLevel, hr, !lib, "Invalid ITypeLibrary pointer: " lib)*)
}
return new ITL.ITL_TypeLibWrapper(lib)
}
ITL_FAILED(hr)
{
return hr == "" || hr < 0
}
ITL_FormatError(hr)
{
static ALLOCATE_BUFFER := 0x00000100, FROM_SYSTEM := 0x00001000, IGNORE_INSERTS := 0x00000200
local size, msg, bufaddr := 0
size := DllCall("FormatMessageW", "UInt", ALLOCATE_BUFFER|FROM_SYSTEM|IGNORE_INSERTS, "Ptr", 0, "UInt", hr, "UInt", 0, "Ptr*", bufaddr, "UInt", 0, "Ptr", 0)
msg := StrGet(bufaddr, size, "UTF-16")
return hr . " - " . Trim(msg, " `t`r`n")
}
ITL_GUID_ToString(guid)
{
local string := 0
DllCall("Ole32\StringFromCLSID", "Ptr", guid, "Ptr*", string)
return StrGet(string, "UTF-16")
}
ITL_GUID_FromString(str, byRef mem)
{
VarSetCapacity(mem, 16, 00)
return DllCall("Ole32\CLSIDFromString", "Str", str, "Ptr", &mem)
}
ITL_GUID_IsGUIDString(str)
{
return RegExMatch(str, "^\{[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}\}$")
}
ITL_GUID_Create(byRef guid)
{
VarSetCapacity(guid, 16, 00)
return DllCall("Ole32\CoCreateGuid", "Ptr", &guid, "Int")
}
ITL_HasEnumFlag(combi, flag)
{
return (combi & flag) == flag
}
ITL_Mem_Allocate(bytes)
{
static HEAP_GENERATE_EXCEPTIONS := 0x00000004, HEAP_ZERO_MEMORY := 0x00000008
return DllCall("HeapAlloc", "Ptr", ITL_Mem_GetHeap(), "UInt", HEAP_GENERATE_EXCEPTIONS|HEAP_ZERO_MEMORY, "UInt", bytes, "Ptr")
}
ITL_Mem_GetHeap()
{
static heap := DllCall("GetProcessHeap", "Ptr")
return heap
}
ITL_Mem_Release(buffer)
{
return DllCall("HeapFree", "Ptr", ITL_Mem_GetHeap(), "UInt", 0, "Ptr", buffer, "Int")
}
ITL_Mem_Copy(src, dest, bytes)
{
DllCall("RtlMoveMemory", "Ptr", dest, "Ptr", src, "UInt", bytes)
}
ITL_SUCCEEDED(hr)
{
return hr != "" && hr >= 0x00
}
ITL_VARIANT_Create(value, byRef buffer)
{
static VT_VARIANT := 0xC, sizeof_VARIANT := 8 + 2 * A_PtrSize
local arr_data := 0, array := ComObjArray(VT_VARIANT, 1)
array[0] := value
DllCall("oleaut32\SafeArrayAccessData", "Ptr", ComObjValue(array), "Ptr*", arr_data)
VarSetCapacity(buffer, 16, 00), ITL_Mem_Copy(arr_data, &buffer, sizeof_VARIANT)
DllCall("oleaut32\SafeArrayUnaccessData", "Ptr", ComObjValue(array))
return &buffer
}
ITL_VARIANT_GetValue(variant)
{
static VT_VARIANT := 0xC, VT_UNKNOWN := 0xD
local array := ComObjArray(VT_VARIANT, 1), vt := 0
vt := NumGet(1*variant, 00, "UShort")
array[0] := ComObjParameter(vt, NumGet(1*variant, 08, "Int64"))
return vt == VT_UNKNOWN ? NumGet(1*variant, 08, "Ptr") : array[0]
}
ITL_VARIANT_MapType(variant)
{
; handled types:
static VT_EMPTY := 0, VT_NULL := 1, VT_BYREF := 0x4000, VT_I1 := 16, VT_UI1 := 17, VT_I2 := 2, VT_UI2 := 18, VT_I4 := 3, VT_BOOL := 0xB, VT_INT := 22, VT_ERROR := 0xA, VT_HRESULT := 25, VT_UI4 := 19, VT_UINT := 23, VT_I8 := 20, VT_UI8 := 21, VT_CY := 6, VT_R4 := 4, VT_R8 := 5, VT_BSTR := 0x8, VT_LPSTR := 30, VT_LPWSTR := 31, VT_DISPATCH := 9, VT_UNKNOWN := 13, VT_PTR := 26, VT_INT_PTR := 37, VT_UINT_PTR := 38
; unhandled types:
static VT_DATE := 7, VT_VARIANT := 12, VT_DECIMAL := 14, VT_VOID := 24, VT_SAFEARRAY := 27, VT_ARRAY := 0x2000, VT_CARRAY := 28, VT_USERDEFINED := 29, VT_RECORD := 36, VT_FILETIME := 64, VT_BLOB := 65, VT_STREAM := 66, VT_STORAGE := 67, VT_STREAMED_OBJECT := 68, VT_STORED_OBJECT := 69, VT_BLOB_OBJECT := 70, VT_CF := 71, VT_CLSID := 72, VT_VERSIONED_STREAM := 73, VT_BSTR_BLOB := 0xffff, VT_VECTOR := 0x1000
static map := ""
local vt := 0, suffix := "", type := ""
; init static var:
if (!IsObject(map))
{
map := { (VT_I1) : "Char", (VT_UI1) : "UChar"
, (VT_I2) : "Short", (VT_UI2) : "UShort"
, (VT_I4) : "Int", (VT_BOOL) : "Int", (VT_INT) : "Int", (VT_HRESULT) : "Int", (VT_ERROR) : "Int", (VT_UI4) : "UInt", (VT_UINT) : "UInt"
, (VT_I8) : "Int64", (VT_CY) : "Int64", (VT_UI8) : "Int64"
, (VT_R4) : "Float", (VT_R8) : "Double"
, (VT_BSTR) : "WStr", (VT_LPSTR) : "Str", (VT_LPWSTR) : "WStr"
, (VT_DISPATCH) : "Ptr", (VT_UNKNOWN): "Ptr", (VT_PTR) : "Ptr", (VT_INT_PTR) : "Ptr", (VT_UINT_PTR) : "UPtr" }
}
vt := NumGet(1*variant, 00, "UShort")
if (ITL_HasEnumFlag(vt, VT_BYREF))
{
vt ^= VT_BYREF, suffix := "*" ; change this handling (?)
}
if (vt == VT_EMPTY || vt == VT_NULL)
throw Exception("Cannot map type 'EMPTY' or 'NULL'.", -1)
else if (map.HasKey(vt))
return map[vt] . suffix
throw Exception("Could not map type " vt ".", -1)
}
ITL_VARIANT_GetByteCount(variant)
{
throw Exception("Could not retrieve byte count.", -1, "Not implemented.")
}
ITL_FormatException(msg, detail, error, hr = "", special = false, special_msg = "")
{
static NL := "`n`t"
return [ msg
, -1
, (detail != "" ? NL . detail : "")
. (ErrorLevel ? NL . "ErrorLevel: " error : "")
. (A_LastError ? NL . "A_LastError: " ITL_FormatError(A_LastError) : "")
. (hr != "" ? NL . "HRESULT: " ITL_FormatError(hr) : "")
. (special ? NL . special_msg : "") ]
}
ITL_IsComObject(obj)
{
return IsObject(obj) && ComObjValue(obj)
}
ITL_ParamToVARIANT(info, tdesc, value, byRef variant, index)
{
static VT_PTR := 26, VT_USERDEFINED := 29, VT_VOID := 24, VT_BYREF := 0x4000, VT_RECORD := 36, VT_UNKNOWN := 13, VT_SAFEARRAY := 27
, sizeof_VARIANT := 8 + 2 * A_PtrSize
, TYPEKIND_RECORD := 1, TYPEKIND_INTERFACE := 3
local hr, vt := NumGet(1*tdesc, A_PtrSize, "UShort"), converted := false, indirectionLevel := 0
, refHandle, refInfo := 0, refAttr := 0, refKind
VarSetCapacity(variant, sizeof_VARIANT, 00) ; init variant
while (vt == VT_PTR)
{
tdesc := NumGet(1*tdesc, 00, "Ptr") ; TYPEDESC::lptdesc
, vt := NumGet(1*tdesc, A_PtrSize, "UShort") ; TYPEDESC::vt
, indirectionLevel++
}
if (vt == VT_USERDEFINED && IsObject(value) && !ITL_IsComObject(value)) ; a struct or interface wrapper was passed
{
NumPut(value[ITL.Properties.INSTANCE_POINTER], variant, 08, "Ptr") ; put instance pointer into VARIANT
; get the type kind of the given wrapper:
; =============================================
refHandle := NumGet(1*tdesc, 00, "UInt") ; TYPEDESC::hreftype
hr := DllCall(NumGet(NumGet(info+0), 14*A_PtrSize, "Ptr"), "Ptr", info, "UInt", refHandle, "Ptr*", refInfo, "Int") ; ITypeInfo::GetRefTypeInfo()
if (ITL_FAILED(hr) || !refInfo)
{
throw Exception(ITL_FormatException("Failed to convert parameter #" index "."
, "ITypeInfo::GetRefTypeInfo() (handle: " refHandle ") failed."
, ErrorLevel, hr
, !refInfo, "Invalid ITypeInfo pointer: " refInfo)*)
}
hr := DllCall(NumGet(NumGet(refInfo+0), 03*A_PtrSize, "Ptr"), "Ptr", refInfo, "Ptr*", refAttr, "Int") ; ITypeInfo::GetTypeAttr()
if (ITL_FAILED(hr) || !refAttr)
{
throw Exception(ITL_FormatException("Failed to convert parameter #" index "."
, "ITypeInfo::GetTypeAttr() failed."
, ErrorLevel, hr
, !refAttr, "Invalid TYPEATTR pointer: " refAttr)*)
}
refKind := NumGet(1*refAttr, 36+A_PtrSize, "UInt")
; =============================================
if (refKind == TYPEKIND_RECORD)
{
; if (indirectionLevel > 0)
; ...
NumPut(VT_RECORD, variant, 00, "UShort")
, NumPut(value.base[ITL.Properties.TYPE_RECORDINFO], variant, 08 + A_PtrSize, "Ptr")
}
else if (refKind == TYPEKIND_INTERFACE)
{
if (indirectionLevel < 1)
{
throw Exception(ITL_FormatException("Failed to convert parameter #" index "."
, "Interfaces cannot be passed by value."
, ErrorLevel, ""
, indirectionLevel < 1, "Invalid indirection level: " indirectionLevel)*)
}
NumPut(VT_UNKNOWN, variant, 00, "UShort")
}
else
{
ObjRelease(refInfo) ; cleanup
throw Exception(ITL_FormatException("Failed to convert parameter #" index "."
, "Cannot handle other wrappers than interfaces and structures."
, ErrorLevel, "")*)
}
ObjRelease(refInfo), refInfo := 0, refAttr := 0 ; cleanup
converted := true
}
else if (!IsObject(value) && vt == VT_VOID && indirectionLevel == 1)
{
value := ComObjParameter(VT_BYREF, value)
}
else if (vt == VT_SAFEARRAY && indirectionLevel == 0)
{
; get the type of the SAFEARRAY elements:
tdesc := NumGet(1*tdesc, 00, "Ptr") ; TYPEDESC::lptdesc
, vt := NumGet(1*tdesc, A_PtrSize, "UShort") ; TYPEDESC::vt
if (!IsObject(value)) ; a raw pointer was passed
{
value := ComObjParameter(VT_ARRAY|vt, value)
}
if (!ITL_IsComObject(value)) ; a normal AHK-array (or object)
{
value := ITL_ArrayToSafeArray(value, vt)
}
; (if it is already a COM wrapper object, do nothing)
}
; todo: handle arrays (native)
if (!converted)
ITL_VARIANT_Create(value, variant) ; create VARIANT
; handle: VT_CARRAY, VT_I8, VT_LPSTR, VT_LPWSTR, VT_SAFEARRAY, VT_PTR, VT_UI8, ...
}
ITL_Min(params*)
{
local each, value, minValue
for each, value in params
{
if (A_Index == 1)
minValue := value
else if (value < minValue)
minValue := value
}
return minValue
}
ITL_Max(params*)
{
local each, value, maxValue
for each, value in params
{
if (A_Index == 1)
maxValue := value
else if (value > maxValue)
maxValue := value
}
return maxValue
}
ITL_CoClassConstructor(this, iid = 0)
{
static IMPLTYPEFLAG_FDEFAULT := 1
local info, typeAttr := 0, hr, iid_mem, instance := 0, typeName
info := this.base[ITL.Properties.TYPE_TYPEINFO]
typeName := this.base[ITL.Properties.TYPE_NAME]
hr := DllCall(NumGet(NumGet(info+0), 03*A_PtrSize, "Ptr"), "Ptr", info, "Ptr*", typeAttr, "Int") ; ITypeInfo::GetTypeAttr()
if (ITL_FAILED(hr) || !typeAttr)
{
throw Exception(ITL_FormatException("Failed to create an instance of the class """ typeName """."
, "ITypeInfo::GetTypeAttr() failed."
, ErrorLevel, hr
, !typeAttr, "Invalid TYPEATTR pointer: " typeAttr)*)
}
if (!iid)
{
iid := this.base[ITL.Properties.TYPE_DEFAULTINTERFACE] ; get coclass default interface
if (!iid) ; there's no default interface
{
throw Exception(ITL_FormatException("Failed to create an instance of the class """ typeName """."
, "An IID must be specified to create an instance of this class."
, ErrorLevel)*)
}
}
hr := ITL_GUID_FromString(iid, iid_mem)
if (ITL_FAILED(hr))
{
throw Exception(ITL_FormatException("Failed to create an instance of the class """ typeName """."
, "The IID """ iid """ could not be converted."
, ErrorLevel, hr)*)
}
iid := &iid_mem
hr := DllCall(NumGet(NumGet(info+0), 16*A_PtrSize, "Ptr"), "Ptr", info, "Ptr", 0, "Ptr", iid, "Ptr*", instance, "Int") ; ITypeInfo::CreateInstance()
if (ITL_FAILED(hr) || !instance)
{
throw Exception(ITL_FormatException("Failed to create an instance of the class """ typeName """."
, "ITypeInfo::CreateInstance() failed."
, ErrorLevel, hr
, !instance, "Invalid instance pointer: " instance)*)
}
return instance
}
; Function: ITL_AbstractClassConstructor
; This is simply a wrapper for "abstract classes", i.e. an exception is thrown when it is called.
; "Abstract" classes set this as their constructor.
ITL_AbstractClassConstructor(this, p*)
{
throw Exception(ITL_FormatException("An instance of the class """ this.base.__class """ must not be created."
, "The class is abstract."
, 0)*)
}
ITL_StructureConstructor(this, ptr = 0, noInit = false)
{
local hr, rcinfo := this.base[ITL.Properties.TYPE_RECORDINFO]
if (!ptr)
{
ptr := DllCall(NumGet(NumGet(rcinfo+0), 16*A_PtrSize, "Ptr"), "Ptr", rcinfo, "Ptr") ; IRecordInfo::RecordCreate()
if (!ptr)
{
throw Exception(ITL_FormatException("Failed to create an instance of the """ this.base[ITL.Properties.TYPE_NAME] """ structure."
, "IRecordInfo::RecordCreate() failed."
, ErrorLevel, ""
, !ptr, "Invalid instance pointer: " ptr)*)
}
}
else if (!noInit)
{
hr := DllCall(NumGet(NumGet(rcinfo+0), 03*A_PtrSize, "Ptr"), "Ptr", rcinfo, "Ptr", ptr, "Int") ; IRecordInfo::RecordInit()
if (ITL_FAILED(hr))
{
throw Exception(ITL_FormatException("Failed create an instance of the """ this.base[ITL.Properties.TYPE_NAME] """ structure."
, "IRecordInfo::RecordInit() failed."
, ErrorLevel, hr)*)
}
}
this[ITL.Properties.INSTANCE_POINTER] := ptr
}
ITL_InterfaceConstructor(this, instance)
{
local interfacePtr
if (!instance)
{
throw Exception("An instance of abstract type " this.base.__class " must not be created without supplying a valid instance pointer.", -1)
}
interfacePtr := ComObjQuery(instance, this.base[ITL.Properties.TYPE_GUID])
if (!interfacePtr)
{
throw Exception(ITL_FormatException("Failed to create an instance of interface """ this.base[ITL.Properties.TYPE_NAME] """."
, "The interface is not supported by the given class instance."
, ErrorLevel, ""
, !interfacePtr, "Invalid pointer returned by ComObjQuery() : " interfacePtr)*)
}
this[ITL.Properties.INSTANCE_POINTER] := interfacePtr
}
class ITL
{
static __New := Func("ITL_AbstractClassConstructor")
class ITL_WrapperBaseClass
{
__New(typeInfo, lib)
{
local hr, name := 0, typeInfo2
static IID_ITypeInfo2 := "{00020412-0000-0000-C000-000000000046}"
if (this != ITL.ITL_WrapperBaseClass)
{
this[ITL.Properties.TYPE_TYPELIBOBJ] := lib, ObjAddRef(lib[ITL.Properties.LIB_TYPELIB])
hr := DllCall(NumGet(NumGet(typeInfo+0), 12*A_PtrSize, "Ptr"), "Ptr", typeInfo, "Int", -1, "Ptr*", name, "Ptr*", 0, "UInt*", 0, "Ptr*", 0, "Int") ; ITypeInfo::GetDocumentation()
if (ITL_FAILED(hr) || !name)
{
throw Exception(ITL_FormatException("Failed to create a wrapper instance."
, "ITypeInfo::GetDocumentation() failed."
, ErrorLevel, hr
, !name, "Invalid name pointer: " name)*)
}
this[ITL.Properties.TYPE_NAME] := StrGet(name, "UTF-16")
this[ITL.Properties.TYPE_GUID] := lib.GetGUID(typeInfo, false, true)
typeInfo2 := ComObjQuery(typeInfo, IID_ITypeInfo2)
if (!typeInfo2)
{
throw Exception(ITL_FormatException("Failed to create a wrapper instance."
, "QueryInterface() for ITypeInfo2 failed."
, ErrorLevel, ""
, !typeInfo2, "Invalid ITypeInfo2 pointer returned by ComObjQuery() : " typeInfo2)*)
}
this[ITL.Properties.TYPE_TYPEINFO] := typeInfo2, ObjAddRef(typeInfo2)
}
}
__Delete()
{
ObjRelease(this[ITL.Properties.TYPE_TYPELIBOBJ][ITL.Properties.LIB_TYPELIB])
, ObjRelease(this[ITL.Properties.TYPE_TYPEINFO])
}
}
; class: ITL_ConstantMemberWrapperBaseClass
; This is the base class for types that have constant variable members, i.e. enums and modules.
class ITL_ConstantMemberWrapperBaseClass extends ITL.ITL_WrapperBaseClass
{
; method: __Get
; gets the value of an enumeration field or module constant.
__Get(field)
{
static VARKIND_CONST := 2, DISPID_UNKNOWN := -1
local hr, info, typeName, varID := DISPID_UNKNOWN, index := -1, varDesc := 0, varValue := ""
if (field != "base" && !ITL.Properties.IsInternalProperty(field)) ; ignore base and internal properties (handled by ITL_WrapperBaseClass)
{
info := this[ITL.Properties.TYPE_TYPEINFO]
typeName := this[ITL.Properties.TYPE_NAME]
; get the member id for the given field name
hr := DllCall(NumGet(NumGet(info+0), 10*A_PtrSize, "Ptr"), "Ptr", info, "Str*", field, "UInt", 1, "UInt*", varID, "Int") ; ITypeInfo::GetIDsOfNames()
if (ITL_FAILED(hr) || varID == DISPID_UNKNOWN)
{
; allow omitting a typename prefix:
; if the enum is called "MyEnum" and the field is called "MyEnum_Any",
; then allow both "MyEnum.MyEnum_Any" and "MyEnum.Any"
if (!InStr(field, typeName . "_", true) == 1) ; omit this if the field is already prefixed with the type name
{
hr := DllCall(NumGet(NumGet(info+0), 10*A_PtrSize, "Ptr"), "Ptr", info, "Str*", typeName "_" . field, "UInt", 1, "UInt*", varID, "Int") ; ITypeInfo::GetIDsOfNames()
}
if (ITL_FAILED(hr) || varID == DISPID_UNKNOWN) ; recheck as the above "if" might have changed it
{
throw Exception(ITL_FormatException("Failed to retrieve a constant field."
, "ITypeInfo::GetIDsOfNames() failed on """ field """."
, ErrorLevel, hr
, varID == DISPID_UNKNOWN, "Invalid DISPID: " varID)*)
}
}
; map the member id to the index of the variable:
hr := DllCall(NumGet(NumGet(info+0), 25*A_PtrSize, "Ptr"), "Ptr", info, "UInt", varID, "UInt*", index, "Int") ; ITypeInfo2::GetVarIndexOfMemId()
if (ITL_FAILED(hr) || index < 0)
{
throw Exception(ITL_FormatException("Failed to retrieve a constant field."
, "ITypeInfo2::GetVarIndexOfMemId() failed on """ field """."
, ErrorLevel, hr
, index < 0, "Invalid VARDESC index: " index)*)
}
; now use the index to get the VARDESC structure:
hr := DllCall(NumGet(NumGet(info+0), 06*A_PtrSize, "Ptr"), "Ptr", info, "UInt", index, "Ptr*", varDesc, "Int") ; ITypeInfo::GetVarDesc()
if (ITL_FAILED(hr) || !varDesc)
{
throw Exception(ITL_FormatException("Failed to retrieve a constant field."
, "ITypeInfo::GetVarDesc() failed on """ field """."
, ErrorLevel, hr
, !varDesc, "Invalid VARDESC pointer: " varDesc)*)
}
; check if it is actually a constant we can map (it is very unlikely / impossible that it's something different, yet check to be sure)
if (NumGet(1*varDesc, 04 + 7 * A_PtrSize, "UShort") != VARKIND_CONST) ; VARDESC::varkind
{
throw Exception(ITL_FormatException("Failed to retrieve a constant field."
, "Field """ field """ is not constant!"
, ErrorLevel)*)
}
; get the VARIANT value out of the structure and get it's real value:
varValue := ITL_VARIANT_GetValue(NumGet(1 * varDesc, 2 * A_PtrSize, "Ptr")) ; VARDESC::lpvarValue
; we don't need the VARDESC structure anymore, so officially release it:
DllCall(NumGet(NumGet(info+0), 21*A_PtrSize, "Ptr"), "Ptr", info, "Ptr", varDesc) ; ITypeInfo::ReleaseVarDesc()
return varValue
}
}
; method: __Set
; throws an error if an attempt is made to change a constant value
__Set(field, params*)
{
if (field != "base" && !ITL.Properties.IsInternalProperty(field)) ; ignore base and internal properties (handled by ITL_WrapperBaseClass)
{
; throw an exception as setting constants is impossible
throw Exception(ITL_FormatException("Failed to set constant field """ field """."
, "By definition, constant field cannot be set."
, ErrorLevel)*)
}
}
; method: _NewEnum
; allows the object to be used within a for-loop
_NewEnum()
{
static VARKIND_CONST := 2
local hr, typeName, info, obj, attr := 0, varCount, varDesc := 0, varID, pVarName := 0, varValue
; only loop through the members once, since the constant values won't change
obj := this[ITL.Properties.TYPE_ENUMERATOR]
if (!IsObject(obj)) ; if this is the first iteration
{
obj := this[ITL.Properties.TYPE_ENUMERATOR] := {} ; create a storage object
typeName := this[ITL.Properties.TYPE_NAME]
info := this[ITL.Properties.TYPE_TYPEINFO]
; get some attributes of the type
hr := DllCall(NumGet(NumGet(info+0), 03*A_PtrSize, "Ptr"), "Ptr", info, "Ptr*", attr, "Int") ; ITypeInfo::GetTypeAttr()
if (ITL_FAILED(hr) || !attr)
{
throw Exception(ITL_FormatException("Failed to enumerate constant fields of type """ typeName """."
, "ITypeInfo::GetTypeAttr() failed."
, ErrorLevel, hr
, !attr, "Invalid TYPEATTR pointer: " attr)*)
}
; get the count of variables from the attribute structure
varCount := NumGet(1*attr, 42+1*A_PtrSize, "UShort") ; TYPEATTR::cVars
; release the structure as we don't need it any longer
DllCall(NumGet(NumGet(info+0), 19*A_PtrSize, "Ptr"), "Ptr", info, "Ptr", attr) ; ITypeInfo::ReleaseTypeAttr()
Loop % varCount ; loop through all variables
{
; get the variable description for the current variable (from zero-based index)
hr := DllCall(NumGet(NumGet(info+0), 06*A_PtrSize, "Ptr"), "Ptr", info, "UInt", A_Index - 1, "Ptr*", varDesc, "Int") ; ITypeInfo::GetVarDesc()
if (ITL_FAILED(hr) || !varDesc)
{
throw Exception(ITL_FormatException("Failed to enumerate constant fields of type """ typeName """."
, "ITypeInfo::GetVarDesc() failed on index " A_Index - 1 "."
, ErrorLevel, hr
, !varDesc, "Invalid VARDESC pointer: " varDesc)*)
}
; check if it is actually a constant we can map (it is very unlikely / impossible that it's something different, yet check to be sure)
if (NumGet(1*varDesc, 04 + 7 * A_PtrSize, "UShort") != VARKIND_CONST) ; VARDESC::varkind
{
throw Exception(ITL_FormatException("Failed to enumerate constant fields of type """ typeName """."
, "Field no. " A_Index - 1 " is not constant!"
, ErrorLevel)*)
}
; from the structure, get the variable member id:
varID := NumGet(1*varDesc, 00, "Int") ; VARDESC::memid
; retrieve the field name
hr := DllCall(NumGet(NumGet(info+0), 12*A_PtrSize, "Ptr"), "Ptr", info, "Int", varID, "Ptr*", pVarName, "Ptr", 0, "UInt", 0, "Ptr", 0, "Int") ; ITypeInfo::GetDocumentation()
if (ITL_FAILED(hr) || !pVarName)
{
throw Exception(ITL_FormatException("Failed to enumerate constant fields of type """ typeName """."
, "ITypeInfo::GetDocumentation() failed on field no. " A_Index - 1 "."
, ErrorLevel, hr
, !pVarName, "Invalid name pointer: " pVarName)*)
}
; get the VARIANT out of the structure and retrieve its value:
varValue := ITL_VARIANT_GetValue(NumGet(1 * varDesc, 2 * A_PtrSize, "Ptr")) ; VARDESC::lpvarValue
; store the field in the enumerator object:
obj[StrGet(pVarName, "UTF-16")] := varValue
; release the structure as we're finished with this variable
DllCall(NumGet(NumGet(info+0), 21*A_PtrSize, "Ptr"), "Ptr", info, "Ptr", varDesc) ; ITypeInfo::ReleaseVarDesc()
; reset local variables
pVarName := 0, varDesc := 0
}
}
; return a builtin enumerator for the field-value object:
return ObjNewEnum(obj)
}
NewEnum()
{
; allow both syntaxes: obj.NewEnum() redirects to obj._NewEnum()
return this._NewEnum()
}
}
class ITL_CoClassWrapper extends ITL.ITL_WrapperBaseClass
{
__New(typeInfo, lib)
{
local hr, typeAttr := 0, implCount, implFlags := 0, implHref := -1, implInfo := 0, implAttr := 0, iid, Base, typeName
static IMPLTYPEFLAG_FDEFAULT := 1
if (this != ITL.ITL_CoClassWrapper)
{
Base.__New(typeInfo, lib)
, ObjInsert(this, "__New", Func("ITL_CoClassConstructor"))
, typeName := this[ITL.Properties.TYPE_NAME]
; get default interface:
; =======================================
hr := DllCall(NumGet(NumGet(typeInfo+0), 03*A_PtrSize, "Ptr"), "Ptr", typeInfo, "Ptr*", typeAttr, "Int") ; ITypeInfo::GetTypeAttr()
if (ITL_FAILED(hr) || !typeAttr)
{
throw Exception(ITL_FormatException("Failed to retrieve the default interface for the """ typeName """ class."
, "ITypeInfo::GetTypeAttr() failed."
, ErrorLevel, hr
, !typeAttr, "Invalid TYPEATTR pointer: " typeAttr)*)
}
implCount := NumGet(1*typeAttr, 44+1*A_PtrSize, "UShort") ; TYPEATTR::cImplTypes
Loop % implCount
{
hr := DllCall(NumGet(NumGet(typeInfo+0), 09*A_PtrSize, "Ptr"), "Ptr", typeInfo, "UInt", A_Index - 1, "UInt*", implFlags, "Int") ; ITypeInfo::GetImplTypeFlags()
if (ITL_FAILED(hr))
{
throw Exception(ITL_FormatException("Failed to retrieve the default interface for the """ typeName """ class."
, "ITypeInfo::GetImplTypeFlags() failed."
, ErrorLevel, hr)*)
}
if (ITL_HasEnumFlag(implFlags, IMPLTYPEFLAG_FDEFAULT))
{
hr := DllCall(NumGet(NumGet(typeInfo+0), 08*A_PtrSize, "Ptr"), "Ptr", typeInfo, "UInt", A_Index - 1, "UInt*", implHref, "Int") ; ITypeInfo::GetRefTypeOfImplType()
if (ITL_FAILED(hr) || implHref == -1)
{
throw Exception(ITL_FormatException("Failed to retrieve the default interface for the """ typeName """ class."
, "ITypeInfo::GetRefTypeOfImplType() failed."
, ErrorLevel, hr
, implHref == -1, "Invalid HREFTYPE: " implHref)*)
}
hr := DllCall(NumGet(NumGet(typeInfo+0), 14*A_PtrSize, "Ptr"), "Ptr", typeInfo, "UInt", implHref, "Ptr*", implInfo, "Int") ; ITypeInfo::GetRefTypeInfo()
if (ITL_FAILED(hr) || !implInfo)
{
throw Exception(ITL_FormatException("Failed to retrieve the default interface for the """ typeName """ class."
, "ITypeInfo::GetRefTypeInfo() failed."
, ErrorLevel, hr
, !implInfo, "Invalid ITypeInfo pointer: " implInfo)*)
}
hr := DllCall(NumGet(NumGet(implInfo+0), 03*A_PtrSize, "Ptr"), "Ptr", implInfo, "Ptr*", implAttr, "Int") ; ITypeInfo::GetTypeAttr()
if (ITL_FAILED(hr) || !implAttr)
{
throw Exception(ITL_FormatException("Failed to retrieve the default interface for the """ typeName """ class."
, "ITypeInfo::GetTypeAttr() failed."
, ErrorLevel, hr
, !implAttr, "Invalid TYPEATTR pointer: " implAttr)*)
}
VarSetCapacity(iid, 16, 00)
ITL_Mem_Copy(implAttr, &iid, 16) ; TYPEATTR::guid
this[ITL.Properties.TYPE_DEFAULTINTERFACE] := ITL_GUID_ToString(&iid)
DllCall(NumGet(NumGet(implInfo+0), 19*A_PtrSize, "Ptr"), "Ptr", implInfo, "Ptr", implAttr) ; ITypeInfo::ReleaseTypeAttr()
break
}
}
DllCall(NumGet(NumGet(typeInfo+0), 19*A_PtrSize, "Ptr"), "Ptr", typeInfo, "Ptr", typeAttr) ; ITypeInfo::ReleaseTypeAttr()
; =======================================
}
}
}
; class: ITL_InterfaceWrapper
; This class enwraps COM interfaces and provides the ability to call methods, set and retrieve properties.
class ITL_InterfaceWrapper extends ITL.ITL_WrapperBaseClass
{
; method: __New
; This is the constructor for the wrapper, used by ITL_TypeLibWrapper.
__New(typeInfo, lib)
{
local Base
if (this != ITL.ITL_InterfaceWrapper)
{
Base.__New(typeInfo, lib)
ObjInsert(this, "__New", Func("ITL_InterfaceConstructor")) ; change constructor for instances
}
}
; method: __Call
; calls a method in the wrapped interface
__Call(method, params*)
{
; code inspired by AutoHotkey_L source (script_com.cpp)
static DISPATCH_METHOD := 0x1
, DISPID_UNKNOWN := -1
, sizeof_DISPPARAMS := 8 + 2 * A_PtrSize, sizeof_EXCEPINFO := 12 + 5 * A_PtrSize, sizeof_VARIANT := 8 + 2 * A_PtrSize, sizeof_ELEMDESC := 4 * A_PtrSize
, DISP_E_MEMBERNOTFOUND := -2147352573, DISP_E_UNKNOWNNAME := -2147352570, DISP_E_EXCEPTION := -2147352567, DISP_E_TYPEMISMATCH := -2147352571, DISP_E_PARAMNOTFOUND := -2147352572, DISP_E_BADVARTYPE := -2147352568
, INVOKEKIND_FUNC := 1
, VT_USERDEFINED := 29, VT_RECORD := 36, VT_UNKNOWN := 13, VT_PTR := 26
, TYPEKIND_RECORD := 1, TYPEKIND_INTERFACE := 3
local paramCount, dispparams, rgvarg := 0, hr, info, dispid := DISPID_UNKNOWN, typeName, instance, excepInfo, err_index := -1, result, variant, index := -1, funcdesc := 0, vt, fnFill ;, fn
, refHandle, refInfo := 0, refAttr := 0, refKind, tdesc, indirectionLevel
paramCount := params.maxIndex() > 0 ? params.maxIndex() : 0 ; the ternary is necessary, otherwise it would hold an empty string, causing calculations to fail
, info := this.base[ITL.Properties.TYPE_TYPEINFO]
, instance := this[ITL.Properties.INSTANCE_POINTER]
, typeName := this.base[ITL.Properties.TYPE_NAME]
; init structures
if (VarSetCapacity(dispparams, sizeof_DISPPARAMS, 00) < sizeof_DISPPARAMS)
{
throw Exception(ITL_FormatException("Out of memory", "Memory allocation for DISPPARAMS failed.", ErrorLevel)*)
}
if (VarSetCapacity(result, sizeof_VARIANT, 00) < sizeof_VARIANT)
{
throw Exception(ITL_FormatException("Out of memory", "Memory allocation for the result VARIANT failed.", ErrorLevel)*)
}
if (VarSetCapacity(excepInfo, sizeof_EXCEPINFO, 00) < sizeof_EXCEPINFO)
{
throw Exception(ITL_FormatException("Out of memory", "Memory allocation for EXCEPINFO failed.", ErrorLevel)*)
}
; get MEMBERID for called method:
hr := DllCall(NumGet(NumGet(info+0), 10*A_PtrSize, "Ptr"), "Ptr", info, "Str*", method, "UInt", 1, "UInt*", dispid, "Int") ; ITypeInfo::GetIDsOfNames()
if (ITL_FAILED(hr) || dispid == DISPID_UNKNOWN)
{
/*
if (hr == DISP_E_UNKNOWNNAME)
{
if (IsFunc(fn := "Obj" . LTrim(method, "_"))) ; if member not found: check for internal method
{
return %fn%(this, params*)
}
}
*/
throw Exception(ITL_FormatException("Failed to call method """ typeName "::" method "()""!"
, "ITypeInfo::GetIDsOfNames() failed."
, ErrorLevel, hr
, dispid != DISPID_UNKNOWN, "Invalid DISPID: " dispid)*)
}
if (paramCount > 0)
{
if (VarSetCapacity(rgvarg, sizeof_VARIANT * paramCount, 00) < (sizeof_VARIANT * paramCount)) ; create VARIANT array
throw Exception(ITL_FormatException("Out of memory.", "Memory allocation for VARIANT array failed.", ErrorLevel)*)
hr := DllCall(NumGet(NumGet(info+0), 24*A_PtrSize, "Ptr"), "Ptr", info, "UInt", dispid, "UInt", INVOKEKIND_FUNC, "UInt*", index) ; ITypeInfo2::GetFuncIndexOfMemId(_this, dispid, invkind, [out] index)
if (ITL_FAILED(hr) || index == -1)
{
throw Exception(ITL_FormatException("Failed to call method """ typeName "::" method "()""!"
, "ITypeInfo2::GetFuncIndexOfMemId() failed."
, ErrorLevel, hr
, index == -1, "Invalid function index: " index)*)
}
hr := DllCall(NumGet(NumGet(info+0), 05*A_PtrSize, "Ptr"), "Ptr", info, "UInt", index, "Ptr*", funcdesc) ; ITypeInfo::GetFuncDesc(_this, index, [out] funcdesc)
if (ITL_FAILED(hr) || !funcdesc)
{
throw Exception(ITL_FormatException("Failed to call method """ typeName "::" method "()""!"
, "ITypeInfo::GetFuncDesc() failed (index " index ")."
, ErrorLevel, hr
, !funcdesc, "Invalid FUNCDESC pointer: " funcdesc)*)
}
paramArray := NumGet(1*funcdesc, 04 + A_PtrSize, "Ptr") ; FUNCDESC::lprgelemdescParam
if (!paramArray)
{
throw Exception(ITL_FormatException("Failed to call method """ typeName "::" method "()""!"
, "The array of parameter descriptions (FUNCDESC::lprgelemdescParam) could not be read."
, ErrorLevel, ""
, !paramArray, "Invalid ELEMDESC[] pointer: " paramArray)*)
}
Loop % paramCount
{
tdesc := paramArray + (A_Index - 1) * sizeof_ELEMDESC ; ELEMDESC[A_Index - 1]::tdesc
, ITL_ParamToVARIANT(info, tdesc, params[A_Index], variant, A_Index)
, ITL_Mem_Copy(&variant, &rgvarg + (paramCount - A_Index) * sizeof_VARIANT, sizeof_VARIANT) ; put the VARIANT structure into the array
}
NumPut(&rgvarg, dispparams, 00, "Ptr") ; DISPPARAMS::rgvarg - the pointer to the VARIANT array
, NumPut(paramCount, dispparams, 2 * A_PtrSize, "UInt") ; DISPPARAMS::cArgs - the number of arguments passed
DllCall(NumGet(NumGet(info+0), 20*A_PtrSize, "Ptr"), "Ptr", info, "Ptr", funcdesc) ; ITypeInfo::ReleaseFuncDesc(_this, funcdesc)
}
; invoke the function
hr := DllCall(NumGet(NumGet(info+0), 11*A_PtrSize, "Ptr"), "Ptr", info, "Ptr", instance, "UInt", dispid, "UShort", DISPATCH_METHOD, "Ptr", &dispparams, "Ptr", &result, "Ptr", &excepInfo, "UInt*", err_index, "Int") ; ITypeInfo::Invoke()
if (ITL_FAILED(hr))
{
/*
if (hr == DISP_E_MEMBERNOTFOUND)
{
; If member not found: check for internal method
; A 2nd check is needed here because a class / interface could have a property with the same name as an AHK object function.
; In that case, GetIDsOfNames() would do well, but it would fail here.
; In all other cases, i.e. where the class / interface does not have such a property, GetIDsOfNames would fail - thus a check is needed there, too.
if (IsFunc(fn := "Obj" . LTrim(method, "_")))
{
return %fn%(this, params*)
}
}
*/
if (hr == DISP_E_EXCEPTION)
{
fnFill := NumGet(excepInfo, 08+4*A_PtrSize, "Ptr") ; EXCEPINFO::pfnDeferredFillIn
if (fnFill)
DllCall(fnFill, "Ptr", &excepInfo)
hr := (hr := NumGet(excepInfo, 08+5*A_PtrSize, "Int")) ? hr : NumGet(excepInfo, 00, "UShort") ; get EXCEPINFO::scode or EXCEPINFO::wCode
throw Exception(ITL_FormatException("Failed to call method """ typeName "::" method "()""!"
, "The called method raised an exception: Source=""" StrGet(NumGet(excepInfo, 04, "Ptr")) """, Message=""" StrGet(NumGet(excepInfo, 04 + A_PtrSize, "Ptr")) """"
, ErrorLevel, hr)*)
}
throw Exception(ITL_FormatException("Failed to call method """ typeName "::" method "()""!"
, "ITypeInfo::Invoke() failed."
, ErrorLevel, hr
, (hr == DISP_E_TYPEMISMATCH || hr == DISP_E_PARAMNOTFOUND || hr == DISP_E_BADVARTYPE), "Invalid argument: #" err_index)*)
}
return ITL_VARIANT_GetValue(&result) ; return the result of the call
}
; method: __Get
; retrieves instance properties from an interface
__Get(property)
{
; code inspired by AutoHotkey_L source (script_com.cpp)
static DISPATCH_PROPERTYGET := 0x2, DISPATCH_METHOD := 0x1
, DISPID_UNKNOWN := -1
, sizeof_DISPPARAMS := 8 + 2 * A_PtrSize, sizeof_EXCEPINFO := 12 + 5 * A_PtrSize, sizeof_VARIANT := 8 + 2 * A_PtrSize
local dispparams, hr, info, dispid := DISPID_UNKNOWN, instance, excepInfo, err_index, result, typeName
if (property != "base" && !ITL.Properties.IsInternalProperty(property)) ; ignore base and internal properties (handled by ITL_WrapperBaseClass)
{
; init structures
if (VarSetCapacity(dispparams, sizeof_DISPPARAMS, 00) != sizeof_DISPPARAMS)
{
throw Exception(ITL_FormatException("Out of memory", "Memory allocation for DISPPARAMS failed.", ErrorLevel)*)
}
if (VarSetCapacity(result, sizeof_VARIANT, 00) != sizeof_VARIANT)
{
throw Exception(ITL_FormatException("Out of memory", "Memory allocation for the result VARIANT failed.", ErrorLevel)*)
}
if (VarSetCapacity(excepInfo, sizeof_EXCEPINFO, 00) != sizeof_EXCEPINFO)
{
throw Exception(ITL_FormatException("Out of memory", "Memory allocation for EXCEPINFO failed.", ErrorLevel)*)
}
info := this.base[ITL.Properties.TYPE_TYPEINFO]
, instance := this[ITL.Properties.INSTANCE_POINTER]
, typeName := this.base[ITL.Properties.TYPE_NAME]
; get MEMBERID for the method to be retrieved:
hr := DllCall(NumGet(NumGet(info+0), 10*A_PtrSize, "Ptr"), "Ptr", info, "Str*", property, "UInt", 1, "UInt*", dispid, "Int") ; ITypeInfo::GetIDsOfNames()
if (ITL_FAILED(hr) || dispid == DISPID_UNKNOWN)
{
throw Exception(ITL_FormatException("Failed to retrieve property """ typeName "::" property """!"
, "ITypeInfo::GetIDsOfNames() failed."
, ErrorLevel, hr
, dispid == DISPID_UNKNOWN, "Invalid DISPID: " dispid)*)
}
; get the property:
; as with __Call, excepinfo is not yet used
hr := DllCall(NumGet(NumGet(info+0), 11*A_PtrSize, "Ptr"), "Ptr", info, "Ptr", instance, "UInt", dispid, "UShort", DISPATCH_METHOD | DISPATCH_PROPERTYGET, "Ptr", &dispparams, "Ptr", &result, "Ptr", &excepInfo, "Ptr", 0, "Int") ; ITypeInfo::Invoke()
if (ITL_FAILED(hr))
{
throw Exception(ITL_FormatException("Failed to retrieve property """ typeName "::" property """!"
, "ITypeInfo::Invoke() failed."
, ErrorLevel, hr)*)
}
return ITL_VARIANT_GetValue(&result) ; return the result, i.e. the value of the property
}
}
; method: __Set
; sets an instance property
__Set(property, value)
{
; code inspired by AutoHotkey_L source (script_com.cpp)
static DISPATCH_PROPERTYPUTREF := 0x8, DISPATCH_PROPERTYPUT := 0x4
, DISPID_UNKNOWN := -1, DISPID_PROPERTYPUT := ""
, sizeof_DISPPARAMS := 8 + 2 * A_PtrSize, sizeof_EXCEPINFO := 12 + 5 * A_PtrSize
, VT_UNKNOWN := 13, VT_DISPATCH := 9
, DISP_E_MEMBERNOTFOUND := -2147352573
, INVOKEKIND_PROPERTYPUT := 4, INVOKEKIND_PROPERTYPUTREF := 8
local variant, dispparams, hr, info, dispid := DISPID_UNKNOWN, vt, instance, excepInfo, err_index := 0, variant, typeName
, index := -1, funcdesc := 0, paramArray
; need to store it that way as "DISPID_PROPERTYPUT := -3, &DISPID_PROPERTYPUT" would be a STRING address
if (!DISPID_PROPERTYPUT)
VarSetCapacity(DISPID_PROPERTYPUT, 4, 0), NumPut(-3, DISPID_PROPERTYPUT, 00, "Int")
if (property != "base" && !ITL.Properties.IsInternalProperty(property)) ; ignore base and internal properties (handled by ITL_WrapperBaseClass)
{
; init structures
if (VarSetCapacity(dispparams, sizeof_DISPPARAMS, 00) != sizeof_DISPPARAMS)
{
throw Exception(ITL_FormatException("Out of memory", "Memory allocation for DISPPARAMS failed.", ErrorLevel)*)
}
if (VarSetCapacity(excepInfo, sizeof_EXCEPINFO, 00) != sizeof_EXCEPINFO)
{
throw Exception(ITL_FormatException("Out of memory", "Memory allocation for EXCEPINFO failed.", ErrorLevel)*)
}
info := this.base[ITL.Properties.TYPE_TYPEINFO]
, instance := this[ITL.Properties.INSTANCE_POINTER]
, typeName := this.base[ITL.Properties.TYPE_NAME]
; get MEMBERID for the property to be set:
hr := DllCall(NumGet(NumGet(info+0), 10*A_PtrSize, "Ptr"), "Ptr", info, "Str*", property, "UInt", 1, "UInt*", dispid, "Int") ; ITypeInfo::GetIDsOfNames()
if (ITL_FAILED(hr) || dispid == DISPID_UNKNOWN) ; an error code was returned or the ID is invalid
{
throw Exception(ITL_FormatException("Failed to set property """ typeName "::" property """ to """ value """!"
, "ITypeInfo::GetIDsOfNames() failed."
, ErrorLevel, hr
, dispid == DISPID_UNKNOWN, "Invalid DISPID: " dispid)*)
}
; ITypeInfo2::GetFuncIndexOfMemId(_this, dispid, invkind, [out] index)
hr := DllCall(NumGet(NumGet(info+0), 24*A_PtrSize, "Ptr"), "Ptr", info, "UInt", dispid, "UInt", INVOKEKIND_PROPERTYPUT, "UInt*", index)
if (ITL_FAILED(hr) || index == -1)
{
; ITypeInfo2::GetFuncIndexOfMemId(_this, dispid, invkind, [out] index)
hr := DllCall(NumGet(NumGet(info+0), 24*A_PtrSize, "Ptr"), "Ptr", info, "UInt", dispid, "UInt", INVOKEKIND_PROPERTYPUTREF, "UInt*", index) ; retry with INVOKEKIND_PROPERTYPUTREF
if (ITL_FAILED(hr) || index == -1) ; still no success? then throw!
{
throw Exception(ITL_FormatException("Failed to set property """ typeName "::" property """ to """ value """!"
, "ITypeInfo2::GetFuncIndexOfMemId() failed."
, ErrorLevel, hr
, index == -1, "Invalid function index: " index)*)
}
}
hr := DllCall(NumGet(NumGet(info+0), 05*A_PtrSize, "Ptr"), "Ptr", info, "UInt", index, "Ptr*", funcdesc) ; ITypeInfo::GetFuncDesc(_this, index, [out] funcdesc)
if (ITL_FAILED(hr) || !funcdesc)
{
throw Exception(ITL_FormatException("Failed to set property """ typeName "::" property """ to """ value """!"
, "ITypeInfo::GetFuncDesc() failed (index " index ")."
, ErrorLevel, hr
, !funcdesc, "Invalid FUNCDESC pointer: " funcdesc)*)
}
paramArray := NumGet(1*funcdesc, 04 + A_PtrSize, "Ptr") ; FUNCDESC::lprgelemdescParam
if (!paramArray)
{
throw Exception(ITL_FormatException("Failed to set property """ typeName "::" property """ to """ value """!"
, "The array of parameter descriptions (FUNCDESC::lprgelemdescParam) could not be read."
, ErrorLevel, ""
, !paramArray, "Invalid ELEMDESC[] pointer: " paramArray)*)
}
; create a VARIANT from the new value
ITL_ParamToVARIANT(info, paramArray, value, variant, 1)
NumPut(&variant, dispparams, 00, "Ptr") ; DISPPARAMS::rgvarg - the VARIANT "array", a single item here
, NumPut(1, dispparams, 2 * A_PtrSize, "UInt") ; DISPPARAMS::cArgs - the count of VARIANTs (1 in this case)
NumPut(&DISPID_PROPERTYPUT, dispparams, A_PtrSize, "Ptr") ; DISPPARAMS::rgdispidNamedArgs - indicate a property is being set
, NumPut(1, dispparams, 2 * A_PtrSize + 4, "UInt") ; DISPPARAMS::cNamedArgs
; get VARTYPE from the VARIANT structure
vt := NumGet(variant, 00, "UShort")
; for VT_UNKNOWN and VT_DISPATCH, invoke with DISPATCH_PROPERTYPUTREF first:
if (vt == VT_DISPATCH || vt == VT_UNKNOWN)
{
; as with __Call, excepinfo is not yet used
hr := DllCall(NumGet(NumGet(info+0), 11*A_PtrSize, "Ptr"), "Ptr", info, "Ptr", instance, "UInt", dispid, "UShort", DISPATCH_PROPERTYPUTREF, "Ptr", &dispparams, "Ptr", 0, "Ptr", &excepInfo, "UInt*", err_index, "Int") ; ITypeInfo::Invoke()
if (ITL_SUCCEEDED(hr))
{
return value ; return the original value to allow "a := obj.prop := value" and similar
}
else if (hr != DISP_E_MEMBERNOTFOUND) ; if member not found, retry below with DISPATCH_PROPERTYPUT
{
throw Exception(ITL_FormatException("Failed to set property """ typeName "::" property """ to """ value """!" ; otherwise an error occured
, "ITypeInfo::Invoke() failed."
, ErrorLevel, hr)*)
}
}
; set the property:
; as with __Call, excepinfo is not yet used
hr := DllCall(NumGet(NumGet(info+0), 11*A_PtrSize, "Ptr"), "Ptr", info, "Ptr", instance, "UInt", dispid, "UShort", DISPATCH_PROPERTYPUT, "Ptr", &dispparams, "Ptr*", 0, "Ptr", &excepInfo, "UInt*", err_index, "Int") ; ITypeInfo::Invoke()
if (ITL_FAILED(hr))
{
throw Exception(ITL_FormatException("Failed to set property """ typeName "::" property """ to """ value """!"
, "ITypeInfo::Invoke() failed."
, ErrorLevel, hr)*)
}
return value ; return the original value to allow "a := obj.prop := value" and similar
}
}
}
class ITL_EnumWrapper extends ITL.ITL_ConstantMemberWrapperBaseClass
{
__New(typeInfo, lib)
{
local Base
if (this != ITL.ITL_EnumWrapper)
{
Base.__New(typeInfo, lib)
ObjInsert(this, "__New", Func("ITL_AbstractClassConstructor"))
}
}
}
class ITL_StructureWrapper extends ITL.ITL_WrapperBaseClass
{
__New(typeInfo, lib)
{
static GUID_NULL := "{00000000-0000-0000-0000-000000000000}", IID_ICreateTypeInfo := "{00020405-0000-0000-C000-000000000046}"
local Base, hr := 0x00, rcinfo := 0, guid:= 0, createInfo, guid, typeName
if (this != ITL.ITL_StructureWrapper)
{
Base.__New(typeInfo, lib)
, typeName := this[ITL.Properties.TYPE_NAME]
; If there's no GUID specified, this would cause GetRecordInfoFromTypeInfo() to fail
; So we're trying to add a random-generated GUID just to keep it satisfied.
if (lib.GetGUID(typeInfo, false, true) == GUID_NULL)
{
createInfo := ComObjQuery(typeInfo, IID_ICreateTypeInfo) ; query for the ICreateTypeInfo interface which can be used to modify the type
if (!createInfo)
{
throw Exception(ITL_FormatException("Failed to create a wrapper for """ typeName """."
, "QueryInterface() for ICreateTypeInfo failed."
, ErrorLevel, ""
, !createInfo, "Invalid ICreateTypeInfo pointer returned by ComObjQuery() : " createInfo)*)
}
hr := ITL_GUID_Create(guid) ; dynamically create a new GUID
if (ITL_FAILED(hr))
{
throw Exception(ITL_FormatException("Failed to create a wrapper for """ typeName """."
, "Creation of a GUID failed."
, ErrorLevel, hr)*)
}
hr := DllCall(NumGet(NumGet(createInfo+0), 03*A_PtrSize, "Ptr"), "Ptr", createInfo, "Ptr", &guid, "Int") ; ICreateTypeInfo::SetGuid() - assign a GUID for the type
if (ITL_FAILED(hr))
{
throw Exception(ITL_FormatException("Failed to create a wrapper for """ typeName """."
, "ICreateTypeInfo::SetGuid() failed."
, ErrorLevel, hr)*)
}
}
hr := DllCall("OleAut32\GetRecordInfoFromTypeInfo", "Ptr", typeInfo, "Ptr*", rcinfo, "Int") ; retrieve an IRecordInfo instance for a type
if (ITL_FAILED(hr) || !rcinfo)
{
throw Exception(ITL_FormatException("Failed to create a wrapper for """ typeName """."
, "GetRecordInfoFromTypeInfo() failed."
, ErrorLevel, hr
, !rcinfo, "Invalid IRecordInfo pointer: " rcinfo)*)
}
this[ITL.Properties.TYPE_RECORDINFO] := rcinfo
ObjInsert(this, "__New", Func("ITL_StructureConstructor"))
}
}
__Delete()
{
local hr, ptr, rcinfo
if (ptr := this[ITL.Properties.INSTANCE_POINTER])
{
rcinfo := this.base[ITL.Properties.TYPE_RECORDINFO]
hr := DllCall(NumGet(NumGet(rcinfo+0), 18*A_PtrSize, "Ptr"), "Ptr", rcinfo, "Ptr", ptr, "Int") ; IRecordInfo::RecordDestroy()
if (ITL_FAILED(hr))
{
throw Exception(ITL_FormatException("Failed to release structure of type """ this.base[ITL.Properties.TYPE_NAME] """."
, "IRecordInfo::RecordDestroy() failed."
, ErrorLevel, hr)*)
}
}
else
{
rcinfo := this[ITL.Properties.TYPE_RECORDINFO]
ObjRelease(rcinfo)
}
}
__Get(field)
{
static sizeof_VARIANT := 8 + 2 * A_PtrSize
local hr, ptr, variant := 0, rcinfo
if (field != "base" && !ITL.Properties.IsInternalProperty(field)) ; ignore base and internal properties (handled by ITL_WrapperBaseClass)
{
ptr := this[ITL.Properties.INSTANCE_POINTER]
if (ptr)
{
rcinfo := this.base[ITL.Properties.TYPE_RECORDINFO]
if (VarSetCapacity(variant, sizeof_VARIANT, 00) != sizeof_VARIANT)
{
throw Exception(ITL_FormatException("Out of memory.", "Memory allocation for VARIANT failed.", ErrorLevel)*)
}
hr := DllCall(NumGet(NumGet(rcinfo+0), 10*A_PtrSize, "Ptr"), "Ptr", rcinfo, "Ptr", ptr, "Str", field, "Ptr", &variant, "Int") ; IRecordInfo::GetField()
if (ITL_FAILED(hr))
{
throw Exception(ITL_FormatException("Failed to retrieve a structure field."
, "IRecordInfo::GetField() failed for field """ field """ on type """ this.base[ITL.Properties.TYPE_NAME] """."
, ErrorLevel, hr)*)
}
return ITL_VARIANT_GetValue(&variant)
}
else if field is integer
{
if (field > 0)
{
return new ITL.ITL_StructureArray(this, field)
}
}
}
}
__Set(field, value)
{
static INVOKE_PROPERTYPUT := 4
local hr, ptr, variant := 0, rcinfo
if (field != "base" && !ITL.Properties.IsInternalProperty(field)) ; ignore base and internal properties (handled by ITL_WrapperBaseClass)
{
ptr := this[ITL.Properties.INSTANCE_POINTER]
, rcinfo := this.base[ITL.Properties.TYPE_RECORDINFO]
ITL_VARIANT_Create(value, variant)
hr := DllCall(NumGet(NumGet(rcinfo+0), 12*A_PtrSize, "Ptr"), "Ptr", rcinfo, "UInt", INVOKE_PROPERTYPUT, "Ptr", ptr, "Str", field, "Ptr", &variant, "Int") ; IRecordInfo::PutField()
if (ITL_FAILED(hr))
{
throw Exception(ITL_FormatException("Failed to set a structure field."
, "IRecordInfo::PutField() failed for field """ field """ on type """ this.base[ITL.Properties.TYPE_NAME] """."
, ErrorLevel, hr)*)
}
return value
}
}
_NewEnum()
{
local hr, info, rcinfo, attr := 0, obj, names_array, varCount := -1, name := ""
obj := {} ; create a storage object
rcinfo := this.base[ITL.Properties.TYPE_RECORDINFO]
; call GetFieldNames() with a NULL array pointer -> retrieve the total field count through "varCount"
hr := DllCall(NumGet(NumGet(rcinfo+0), 14 * A_PtrSize, "Ptr"), "Ptr", rcinfo, "UInt*", varCount, "Ptr", 0, "Int") ; IRecordInfo::GetFieldNames()
if (ITL_FAILED(hr) || varCount == -1)
{
throw Exception(ITL_FormatException("Failed to enumerate structure members of type """ this.base[ITL.Properties.TYPE_NAME] """."
, "IRecordInfo::GetFieldNames() failed."
, ErrorLevel, hr
, varCount != -1, "Invalid member count: " varCount)*)
}
VarSetCapacity(names_array, varCount * A_PtrSize, 00) ; allocate name array memory
; call it again, this time supplying a valid array pointer
hr := DllCall(NumGet(NumGet(rcinfo+0), 14 * A_PtrSize, "Ptr"), "Ptr", rcinfo, "UInt*", varCount, "Ptr", &names_array, "Int") ; IRecordInfo::GetFieldNames()
if (ITL_FAILED(hr))
{
throw Exception(ITL_FormatException("Failed to enumerate structure members of type """ this.base[ITL.Properties.TYPE_NAME] """."
, "IRecordInfo::GetFieldNames() failed."
, ErrorLevel, hr)*)
}
Loop %varCount%
{
name := StrGet(NumGet(names_array, (A_Index - 1) * A_PtrSize, "Ptr"))
obj.Insert(name, this[name])
}
return ObjNewEnum(obj)
}
NewEnum()
{
return this._NewEnum()
}
_Clone()
{
local hr, rcinfo := this.base[ITL.Properties.TYPE_RECORDINFO], ptrNew := 0, ptrOld := this[ITL.Properties.INSTANCE_POINTER], newObj
newObj := new this.base()
ptrNew := newObj[ITL.Properties.INSTANCE_POINTER]
hr := DllCall(NumGet(NumGet(rcinfo+0), 05*A_PtrSize, "Ptr"), "Ptr", rcinfo, "Ptr", ptrOld, "Ptr", ptrNew, "Int") ; IRecordInfo::RecordCopy()
if (ITL_FAILED(hr))
{
throw Exception(ITL_FormatException("Failed to clone a structure instance."
, "IRecordInfo::RecordCopy() failed."
, ErrorLevel, hr)*)
}
return newObj
}
Clone()
{
return this._Clone()
}
GetSize()
{
local hr, size := -1, type, rcinfo
type := this
if (this[ITL.Properties.INSTANCE_POINTER])
type := this.base
rcinfo := type[ITL.Properties.TYPE_RECORDINFO]
hr := DllCall(Numget(NumGet(rcinfo+0), 08*A_PtrSize, "Ptr"), "Ptr", rcinfo, "UInt*", size, "Int") ; IRecordInfo::GetSize()
if (ITL_FAILED(hr) || size == -1)
{
throw Exception(ITL_FormatException("Failed to retrieve structure size for """ type[ITL.Properties.TYPE_NAME] """."
, "IRecordInfo::GetSize() failed."
, ErrorLevel, hr)*)
}
return size
}
Clear()
{
local hr, rcinfo := this.base[ITL.Properties.TYPE_RECORDINFO], ptr := this[ITL.Properties.INSTANCE_POINTER]
hr := DllCall(NumGet(NumGet(rcinfo+0), 04*A_PtrSize, "Ptr"), "Ptr", rcinfo, "Ptr", ptr, "Int") ; IRecordInfo::RecordClear()
if (ITL_Failed(hr))
{
throw Exception(ITL_FormatException("Failed to clear a structure instance."
, "IRecordInfo::RecordClear() failed."
, ErrorLevel, hr)*)
}
hr := DllCall(NumGet(NumGet(rcinfo+0), 03*A_PtrSize, "Ptr"), "Ptr", rcinfo, "Ptr", ptr, "Int") ; IRecordInfo::RecordInit()
if (ITL_Failed(hr))
{
throw Exception(ITL_FormatException("Failed to clear a structure instance."
, "RecordInit::RecordClear() failed."
, ErrorLevel, hr)*)
}
}
}
class ITL_ModuleWrapper extends ITL.ITL_ConstantMemberWrapperBaseClass
{
__New(typeInfo, lib)
{
local Base
if (this != ITL.ITL_ModuleWrapper)
{
Base.__New(typeInfo, lib)
ObjInsert(this, "__New", Func("ITL_AbstractClassConstructor"))
}
}
__Call(method, params*)
{
static DISPID_UNKNOWN := -1, INVOKEKIND_FUNC := 1
local id := DISPID_UNKNOWN, hr := 0, addr := 0, info
info := this[ITL.Properties.TYPE_TYPEINFO]
hr := DllCall(NumGet(NumGet(info+0), 10*A_PtrSize, "Ptr"), "Ptr", info, "Str*", method, "UInt", INVOKEKIND_FUNC, "Ptr*", id, "Int") ; ITypeInfo::GetIDsOfNames()
if (ITL_FAILED(hr) || id == DISPID_UNKNOWN)
{
throw Exception(ITL_FormatException("Failed to call method """ method """ on module """ this[ITL.Properties.TYPE_NAME] """."
, "ITypeInfo::GetIDsOfNames() failed."
, ErrorLevel, hr
, id == DISPID_UNKNOWN, "Invalid DISPID: " id)*)
}
hr := DllCall(NumGet(NumGet(info+0), 15*A_PtrSize, "Ptr"), "Ptr", info, "UInt", id, "UInt", 1, "Ptr*", addr, "Int") ; ITypeInfo::AddressOfMember()
if (ITL_FAILED(hr) || !addr)
{
throw Exception(ITL_FormatException("Failed to call method """ method """ on module """ this[ITL.Properties.TYPE_NAME] """."
, "ITypeInfo::AddressOfMember() failed."
, ErrorLevel, hr
, !addr, "Invalid member address: " addr)*)
}
return DllCall(addr, params*)
}
}
class ITL_TypeLibWrapper
{
__New(lib)
{
static valid_typekinds := "", VT_USERDEFINED := 29, MEMBERID_NIL := -1
, TYPEKIND_ENUM := 0, TYPEKIND_RECORD := 1, TYPEKIND_MODULE := 2, TYPEKIND_INTERFACE := 3, TYPEKIND_COCLASS := 5, TYPEKIND_ALIAS := 6
local typeKind := -1, hr, typeName, obj, typeInfo := 0, attr := 0, vt, mappings := [], refInfo := 0, hrefType, refAttr := 0, refKind, typeLibName, alias := ""
if (!IsObject(valid_typekinds)) ; init static field
{
valid_typekinds := { (TYPEKIND_ENUM) : ITL.ITL_EnumWrapper
, (TYPEKIND_RECORD) : ITL.ITL_StructureWrapper
, (TYPEKIND_MODULE) : ITL.ITL_ModuleWrapper
, (TYPEKIND_INTERFACE) : ITL.ITL_InterfaceWrapper
, (TYPEKIND_COCLASS) : ITL.ITL_CoClassWrapper }
}
if (this != ITL.ITL_TypeLibWrapper)
{
ObjInsert(this, "__New", Func("ITL_AbstractClassConstructor"))
this[ITL.Properties.LIB_TYPELIB] := lib
typeLibName := this[ITL.Properties.LIB_NAME] := this.GetName()
Loop % DllCall(NumGet(NumGet(lib+0), 03*A_PtrSize, "Ptr"), "Ptr", lib, "Int") ; ITypeLib::GetTypeInfoCount()
{
hr := DllCall(NumGet(NumGet(lib+0), 05*A_PtrSize, "Ptr"), "Ptr", lib, "UInt", A_Index - 1, "UInt*", typeKind, "Int") ; ITypeLib::GetTypeKind()
if (ITL_FAILED(hr) || typeKind == -1)
{
throw Exception(ITL_FormatException("Failed to wrap type library """ typeLibName """."
, "Type information kind no. " A_Index - 1 " could not be read."
, ErrorLevel, hr
, typeKind == -1, "Invalid TYPEKIND: " typeKind)*)
}
if (!valid_typekinds.HasKey(typeKind) && typeKind != TYPEKIND_ALIAS)
{
ObjRelease(typeInfo), typeKind := -1, typeName := "", typeInfo := 0
continue
}
hr := DllCall(NumGet(NumGet(lib+0), 04*A_PtrSize, "Ptr"), "Ptr", lib, "UInt", A_Index - 1, "Ptr*", typeInfo, "Int") ; ITypeLib::GetTypeInfo()
if (ITL_FAILED(hr) || !typeInfo)
{
throw Exception(ITL_FormatException("Failed to wrap type library """ typeLibName """."
, "Type information no. " A_Index - 1 " could not be read."
, ErrorLevel, hr
, !typeInfo, "Invalid ITypeInfo pointer: " typeInfo)*)
}
typeName := this.GetName(A_Index - 1)
if (typeKind == TYPEKIND_ALIAS)
{
;MsgBox %typeName% is an alias...
hr := DllCall(NumGet(NumGet(typeInfo+0), 03*A_PtrSize, "Ptr"), "Ptr", typeInfo, "Ptr*", attr, "Int") ; ITypeInfo::GetTypeAttr()
if (ITL_FAILED(hr) || !attr)
{
throw Exception(ITL_FormatException("Failed to wrap type library """ typeLibName """."
, "ITypeInfo::GetTypeAttr() for type """ typeName """ failed."
, ErrorLevel, hr
, !attr, "Invalid TYPEATTR pointer: " attr)*)
}
vt := NumGet(1*attr, 56 + 2*A_PtrSize, "UShort") ; TYPEATTR::tdescAlias::vt
if (vt == VT_USERDEFINED)
{
hrefType := NumGet(1*attr, 56 + A_PtrSize, "UInt")
hr := DllCall(NumGet(NumGet(typeInfo+0), 14*A_PtrSize, "Ptr"), "Ptr", typeInfo, "UInt", hrefType, "Ptr*", refInfo) ; ITypeInfo::GetRefTypeInfo()
if (ITL_FAILED(hr) || !refInfo)
{
throw Exception(ITL_FormatException("Failed to wrap type library """ typeLibName """."
, "ITypeInfo::GetRefTypeInfo() for type """ typeName """ failed."
, ErrorLevel, hr
, !refInfo, "Invalid ITypeInfo pointer: " refInfo)*)
}
hr := DllCall(NumGet(NumGet(refInfo+0), 03*A_PtrSize, "Ptr"), "Ptr", refInfo, "Ptr*", refAttr, "Int") ; ITypeInfo::GetTypeAttr()
if (ITL_FAILED(hr) || !refAttr)
{
throw Exception(ITL_FormatException("Failed to wrap type library """ typeLibName """."
, "ITypeInfo::GetTypeAttr() for type """ typeName """ failed."
, ErrorLevel, hr
, !refAttr, "Invalid TYPEATTR pointer: " refAttr)*)
}
refKind := NumGet(1*attr, 36+A_PtrSize, "UInt") ; TYPEATTR::typekind
if (valid_typekinds.HasKey(refKind))
{
mappings.Insert(typeName, refInfo)
}
DllCall(NumGet(NumGet(refInfo+0), 19*A_PtrSize, "Ptr"), "Ptr", refInfo, "Ptr", refAttr) ; ITypeInfo::ReleaseTypeAttr()
, ObjRelease(refInfo)
, refInfo := 0, refAttr := 0
}
DllCall(NumGet(NumGet(typeInfo+0), 19*A_PtrSize, "Ptr"), "Ptr", typeInfo, "Ptr", attr) ; ITypeInfo::ReleaseTypeAttr()
, ObjRelease(typeInfo)
, attr := 0
}
else
{
obj := valid_typekinds[typeKind], this[typeName] := new obj(typeInfo, this)
}
typeName := "", typeInfo := 0, typeKind := -1
}
for alias, typeInfo in mappings
{
hr := DllCall(NumGet(NumGet(typeInfo+0), 12*A_PtrSize, "Ptr"), "Ptr", typeInfo, "Int", MEMBERID_NIL, "Ptr*", typeName, "Int")
if (ITL_FAILED(hr) || !typeName)
{
throw Exception(ITL_FormatException("Failed to wrap type library """ typeLibName """."
, "ITypeInfo::GetDocumentation() for an alias failed."
, ErrorLevel, hr
, !typeName, "Invalid type name pointer: " typeName)*)
}
this[alias] := this[StrGet(typeName)]
ObjRelease(typeInfo)
}
}
}
GetName(index = -1)
{
local hr, name := 0, lib
lib := this[ITL.Properties.LIB_TYPELIB]
hr := DllCall(NumGet(NumGet(lib+0), 09*A_PtrSize, "Ptr"), "Ptr", lib, "UInt", index, "Ptr*", name, "Ptr*", 0, "UInt*", 0, "Ptr*", 0, "Int") ; ITypeLib::GetDocumentation()
if (ITL_FAILED(hr) || !name)
{
throw Exception(ITL_FormatException("The name for the " (index == -1 ? "type library" : "type description no. " index) " could not be read."
, "ITypeLib::GetDocumentation() failed."
, ErrorLevel, hr
, !name, "Invalid name pointer: " name)*)
}
return StrGet(name, "UTF-16")
}
GetGUID(obj = -1, returnRaw = false, passRaw = false)
{
local hr, guid, lib, info, attr := 0, result
lib := this[ITL.Properties.LIB_TYPELIB]
if obj is not integer
{
if (!IsObject(obj)) ; it's a string, a field name
obj := this[obj]
if (IsObject(obj)) ; a field, either passed directly or via name
{
if obj[ITL.Properties.TYPE_GUID] ; if it's already stored, do not retrieve it again
{
if (!returnRaw)
return obj[ITL.Properties.TYPE_GUID]
guid := ITL_Mem_Allocate(16)
, ITL_GUID_FromString(obj[ITL.Properties.TYPE_GUID], attr)
, ITL_Mem_Copy(&attr, guid, 16)
return guid
}
info := obj[ITL.Properties.TYPE_TYPEINFO]
}
else
{
throw Exception(ITL_FormatException("A type GUID could not be read."
, "The type wrapper object could not be retrieved."
, ErrorLevel, ""
, !IsObject(obj), "Not an object: """ obj """.")*)
}
}
else if (obj != -1)
{
if (passRaw)
info := obj ; also allow passing an ITypeInfo pointer directly
else
{
hr := DllCall(NumGet(NumGet(lib+0), 04*A_PtrSize, "Ptr"), "Ptr", lib, "UInt", obj, "Ptr*", info, "Int") ; ITypeLib::GetTypeInfo()
if (ITL_FAILED(hr) || !info)
{
throw Exception(ITL_FormatException("A type GUID could not be read."
, "ITypeLib::GetTypeInfo() failed on index " obj "."
, ErrorLevel, hr
, !info, "Invalid ITypeInfo pointer: " info)*)
}
}
}
if (obj == -1)
{
hr := DllCall(NumGet(NumGet(lib+0), 07*A_PtrSize, "Ptr"), "Ptr", lib, "Ptr*", attr, "Int") ; ITypeLib::GetLibAttr()
if (ITL_FAILED(hr) || !attr)
{
throw Exception(ITL_FormatException("The type library GUID could not be read."
, "ITypeLib::GetLibAttr() failed."
, ErrorLevel, hr
, !attr, "Invalid TLIBATTR pointer: " attr)*)
}
guid := ITL_Mem_Allocate(16), ITL_Mem_Copy(attr, guid, 16) ; TLIBATTR::guid
if (returnRaw)
result := guid
else
result := ITL_GUID_ToString(guid), ITL_Mem_Release(guid)
DllCall(NumGet(NumGet(lib+0), 12*A_PtrSize, "Ptr"), "Ptr", lib, "Ptr", attr) ; ITypeLib::ReleaseTLibAttr()
}
else
{
hr := DllCall(NumGet(NumGet(info+0), 03*A_PtrSize, "Ptr"), "Ptr", info, "Ptr*", attr, "Int") ; ITypeInfo::GetTypeAttr()
if (ITL_FAILED(hr) || !attr)
{
throw Exception(ITL_FormatException("A type GUID could not be read."
, "ITypeInfo::GetTypeAttr() failed."
, ErrorLevel, hr
, !attr, "Invalid TYPEATTR pointer: " attr)*)
}
guid := ITL_Mem_Allocate(16), ITL_Mem_Copy(attr, guid, 16) ; TYPEATTR::guid
if (returnRaw)
result := guid
else
result := ITL_GUID_ToString(guid), ITL_Mem_Release(guid)
DllCall(NumGet(NumGet(info+0), 19*A_PtrSize, "Ptr"), "Ptr", info, "Ptr", attr, "Int") ; ITypeInfo::ReleaseTypeAttr()
}
return result
}
}
; zero-based
class ITL_StructureArray
{
__New(type, count)
{
this[ITL.Properties.ARRAY_ELEMTYPEOBJ] := type
, this[ITL.Properties.ARRAY_ELEMCOUNT] := count
, this[ITL.Properties.ARRAY_MEMBUFFER] := ITL_Mem_Allocate(count * type.GetSize())
, this[ITL.Properties.ARRAY_ELEMSIZE] := type.GetSize()
, this[ITL.Properties.ARRAY_INSTANCEOBJ] := []
}
__Get(property)
{
local buffer, size, index, struct, type
if (property != "base" && !ITL.Properties.IsInternalProperty(property))
{
count := this[ITL.Properties.ARRAY_ELEMCOUNT]
if (property == "")
{
buffer := this[ITL.Properties.ARRAY_MEMBUFFER], size := this[ITL.Properties.ARRAY_ELEMSIZE]
for index, struct in this
{
ITL_Mem_Copy(struct[ITL.Properties.INSTANCE_POINTER], buffer + index * size, size)
}
return buffer
}
else if property is not integer
{
throw Exception(ITL_FormatException("Failed to retrieve an array element."
, """" property """ is not a valid array index."
, ErrorLevel)*)
}
else if (property < 0 || property >= count)
{
throw Exception(ITL_FormatException("Failed to retrieve an array element."
, """" property """ is out of range."
, ErrorLevel)*)
}
struct := this[ITL.Properties.ARRAY_INSTANCEOBJ][property]
if (!IsObject(struct))
{
type := this[ITL.Properties.ARRAY_ELEMTYPEOBJ]
, this[ITL.Properties.ARRAY_INSTANCEOBJ][property] := struct := new type()
}
return struct
}
}
__Set(property, value)
{
local count := this[ITL.Properties.ARRAY_ELEMCOUNT]
if (property != "base" && !ITL.Properties.IsInternalProperty(property))
{
if property is not integer
{
throw Exception(ITL_FormatException("Failed to set an array element."
, """" property """ is not a valid array index."
, ErrorLevel)*)
}
else if (property < 0 || property >= count)
{
throw Exception(ITL_FormatException("Failed to set an array element."
, """" property """ is out of range."
, ErrorLevel)*)
}
if value is integer
{
value := new this[ITL.Properties.ARRAY_ELEMTYPEOBJ](value, true)
}
this[ITL.Properties.ARRAY_INSTANCEOBJ][property] := value
}
}
_NewEnum()
{
return ObjNewEnum(this[ITL.Properties.ARRAY_INSTANCEOBJ])
}
NewEnum()
{
return this._NewEnum()
}
SetCapacity(newCount)
{
local newBuffer := ITL_Mem_Allocate(newCount * this[ITL.Properties.ARRAY_ELEMSIZE])
, oldBuffer := this[ITL.Properties.ARRAY_MEMBUFFER]
, oldCount := this[ITL.Properties.ARRAY_ELEMCOUNT]
ITL_Mem_Copy(oldBuffer, newBuffer, oldCount), ITL_Mem_Release(oldBuffer)
this[ITL.Properties.ARRAY_MEMBUFFER] := newBuffer, this[ITL.Properties.ARRAY_ELEMCOUNT] := newCount
if (newCount < oldCount)
{
this[ITL.Properties.ARRAY_INSTANCEOBJ].Remove(newCount - 1, oldCount - 1)
}
}
}
class Properties
{
static INSTANCE_POINTER := "internal://type-instance"
static INSTANCE_ENUMERATOR := "internal://instance-enumerator"
static TYPE_TYPEINFO := "internal://typeinfo-instance"
static TYPE_NAME := "internal://typeinfo-name"
static TYPE_GUID := "internal://type-guid"
static TYPE_RECORDINFO := "internal://rcinfo-instance"
static TYPE_ENUMERATOR := "internal://enumerator-object"
static TYPE_DEFAULTINTERFACE := "internal://default-iid"
static TYPE_TYPELIBOBJ := "internal://typelib-object"
static ARRAY_ELEMCOUNT := "internal://instance-count"
static ARRAY_MEMBUFFER := "internal://memory-buffer"
static ARRAY_ELEMTYPEOBJ := "internal://type-obj"
static ARRAY_ELEMSIZE := "internal://instance-size"
static ARRAY_INSTANCEOBJ := "internal://instance-array"
static LIB_TYPELIB := "internal://typelib-instance"
static LIB_NAME := "internal://typelib-name"
static LIB_GUID := "internal://typelib-guid"
IsInternalProperty(property)
{
return RegExMatch(property, "^internal://")
}
}
}
; various misc. helper functions, later to be sorted out to separate classes / libs / files.
ITL_IsSafeArray(obj)
{
static VT_ARRAY := 0x2000
local vt := 0
return (IsObject(obj) && ITL_HasEnumFlag(ComObjType(obj), VT_ARRAY)) ; a wrapper object was passed
|| (ITL_SUCCEEDED(DllCall("OleAut32\SafeArrayGetVartype", "Ptr", obj, "UShort*", vt, "Int")) && vt && ITL_IsSafeArray(ComObjParameter(VT_ARRAY|vt, obj))) ; a raw SAFEARRAY pointer was passed
}
ITL_IsPureArray(obj, zeroBased = false)
{
for key in obj
{
if (!zeroBased && key != A_Index)
{
return false
}
else if (zeroBased && key != (A_Index - 1))
{
return false
}
}
return true
}
ITL_SafeArrayType(obj)
{
static VT_ARRAY := 0x2000
local vt := 0
if (ITL_IsSafeArray(obj))
return IsObject(obj)
? (ComObjType(obj) ^ VT_ARRAY) ; a wrapper object was passed
: (ITL_SUCCEEDED(DllCall("OleAut32\SafeArrayGetVartype", "Ptr", obj, "UShort*", vt, "Int")) && vt) ? vt : "" ; a raw SAFEARRAY pointer was passed
}
ITL_CreateStructureSafeArray(type, dims*)
{
static VT_RECORD := 0x24
local arr, hr
if (dims.MaxIndex() > 8 || dims.MinIndex() != 1)
throw Exception(ITL_FormatException("Failed to create a structure SAFEARRAY."
, "Invalid dimensions were specified."
, ErrorLevel)*)
; TODO: enable arrays with > 8 dimensions!
arr := ComObjArray(VT_RECORD, dims*)
hr := DllCall("OleAut32\SafeArraySetRecordInfo", "Ptr", ComObjValue(arr), "Ptr", type[ITL.Properties.TYPE_RECORDINFO], "Int")
if (ITL_FAILED(hr))
throw Exception(ITL_FormatException("Failed to create a structure SAFEARRAY."
, "Could not set IRecordInfo."
, ErrorLevel, hr)*)
return arr
}
ITL_CreateStructureArray(type, count)
{
return new ITL.ITL_StructureArray(type, count)
}
ITL_ArrayToSafeArray(array, vt)
{
static VT_ARRAY := 0x2000
local dimensions, dimCount, bounds, psa, each, dim
dimensions := ITL_ArrayGetDimensions(array), dimCount := dimensions.maxIndex(), bounds := ITL_Mem_Allocate(dimCount * 8)
for each, dim in dimensions
{
NumPut(dim.uBound - dim.lBound + 1, bounds + (A_Index - 1) * 8, 00, "Int") ; SAFEARRAYBOUND::cElements
NumPut(dim.lBound, bounds + (A_Index - 1) * 8, 04, "Int") ; SAFEARRAYBOUND::lLbound
}
psa := DllCall("OleAut32\SafeArrayCreate", "UShort", vt, "UInt", dimCount, "Ptr", bounds, "Ptr"), ITL_Mem_Release(bounds)
if (!psa)
{
throw Exception(ITL_FormatException("Failed to convert an array to a SAFEARRAY."
, "SafeArrayCreate() returned NULL."
, ErrorLevel)*)
}
ITL_ArrayCopyToSafeArray(array, psa)
return ComObjParameter(VT_ARRAY|vt, psa)
}
ITL_ArrayCopyToSafeArray(array, psa) ; TODO
{
local dimCount, indices
if ITL_IsComObject(psa)
psa := ComObjValue(psa)
dimCount := ITL_ArrayGetDimensionCount(array)
; ...
indices := ITL_Mem_Allocate(dimCount * 4)
; ...
ITL_Mem_Release(indices)
; ...
}
ITL_SafeArrayCopyToArray(psa, array) ; TODO
{
local dimCount, indices
if ITL_IsComObject(psa)
psa := ComObjValue(psa)
dimCount := DllCall("OleAut32\SafeArrayGetDim", "Ptr", psa, "UInt")
; ...
indices := ITL_Mem_Allocate(dimCount * 4)
; ...
ITL_Mem_Release(indices)
; ...
}
ITL_SafeArrayToArray(safearray)
{
local array := []
ITL_SafeArrayCopyToArray(safearray, array)
return array
}
ITL_ArrayGetDimensions(array, dimensions = "", index = 1)
{
local dim, k, v
if (!dimensions)
dimensions := []
dim := ITL_ArrayGetBounds(array)
if (!dimensions.HasKey(index))
dimensions[index] := dim
else
dimensions[index].uBound := ITL_Max(dimensions[index].uBound, dim.uBound)
, dimensions[index].lBound := ITL_Min(dimensions[index].lBound, dim.lBound)
for k, v in array
{
if (IsObject(v) && (ITL_IsPureArray(v, true) || ITL_IsPureArray(v, false)))
dimensions := ITL_ArrayGetDimensions(v, dimensions, index + 1)
}
return dimensions
}
; all "arms" of the array must be of equal "depth"
ITL_ArrayGetDimensionCount(array)
{
local k, v, dimCount := 0
while (IsObject(v) && (ITL_IsPureArray(v, true) || ITL_IsPureArray(v, false)))
{
dimCount++
for k, v in array
{
array := v
break
}
}
return dimCount
}
ITL_ArrayGetBounds(obj, byRef lBound = 0, byRef uBound = 0)
{
local index
for index in obj
{
if (A_Index == 1)
lBound := uBound := index
else
uBound := ITL_Max(index, uBound), lBound := ITL_Min(index, lBound)
}
return { "lBound" : lBound, "uBound" : uBound }
}
Last edited by TheDewd on 04 Jan 2019, 10:14, edited 1 time in total.
Re: list of _all_ Excel constants
Wonderful! Thank you!
Re: list of _all_ Excel constants
Wonderful! Thank you!