From fd0b55db919d02ee3533184bc48784bbc984e5a6 Mon Sep 17 00:00:00 2001 From: Zev Spitz Date: Thu, 29 Jun 2017 08:10:14 +0200 Subject: [PATCH] Commented out string-valued enums (pending Typescript 2.4, circa end of July 2017) --- types/activex-wia/activex-wia-tests.ts | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/types/activex-wia/activex-wia-tests.ts b/types/activex-wia/activex-wia-tests.ts index e7e2fcd506..8384291f5d 100644 --- a/types/activex-wia/activex-wia-tests.ts +++ b/types/activex-wia/activex-wia-tests.ts @@ -3,17 +3,32 @@ // Convert a file let commonDialog = new ActiveXObject('WIA.CommonDialog'); let img = commonDialog.ShowAcquireImage(); -if (img.FormatID !== WIA.FormatID.wiaFormatJPEG) { + +// when DefinitelyTyped supports Typescript 2.4 -- end of July 2017, replace these: +let jpegFormatID = '{B96B3CAE-0728-11D3-9D7B-0000F81EF32E}'; +if (img.FormatID !== jpegFormatID) { + let ip = new ActiveXObject('WIA.ImageProcess'); + ip.Filters.Add(ip.FilterInfos.Item('Convert').FilterID); + ip.Filters.Item(1).Properties.Item('FormatID').Value = jpegFormatID; + img = ip.Apply(img); +} +// with this: +/*if (img.FormatID !== WIA.FormatID.wiaFormatJPEG) { let ip = new ActiveXObject('WIA.ImageProcess'); ip.Filters.Add(ip.FilterInfos.Item('Convert').FilterID); ip.Filters.Item(1).Properties.Item('FormatID').Value = WIA.FormatID.wiaFormatJPEG; img = ip.Apply(img); -} +}*/ // Take a picture let dev = commonDialog.ShowSelectDevice(); if (dev.Type === WIA.WiaDeviceType.CameraDeviceType) { - let itm = dev.ExecuteCommand(WIA.CommandID.wiaCommandTakePicture); + // when DefinitelyTyped supports Typescript 2.4 -- end of July 2017, replace these: + let commandID = '{AF933CAC-ACAD-11D2-A093-00C04F72DC3C}'; + let itm = dev.ExecuteCommand(commandID); + + // with this: + // let itm = dev.ExecuteCommand(WIA.CommandID.wiaCommandTakePicture); } // Display detailed property information