#nullable enable
using System;
using System.Runtime.InteropServices;
using System.Runtime.InteropServices.ComTypes;
using static Vanara.PInvoke.Gdi32;
using static Vanara.PInvoke.Ole32;
using static Vanara.PInvoke.PropSys;
using static Vanara.PInvoke.Shell32;
using static Vanara.PInvoke.User32;
using FILETIME = System.Runtime.InteropServices.ComTypes.FILETIME;
namespace Vanara.PInvoke;
/// Enums and interfaces from the Windows Photo Acquisition API.
public static partial class PhotoAcquisition
{
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
public static readonly HRESULT PAQ_ERR = HRESULT.Make(true, HRESULT.FacilityCode.FACILITY_ITF, 0xA001);
public static readonly PROPERTYKEY PKEY_PhotoAcquire_CameraSequenceNumber = new(new(0x00f23377, 0x7ac6, 0x4b7a, 0x84, 0x43, 0x34, 0x5e, 0x73, 0x1f, 0xa5, 0x7a), 7); // VT_LPWSTR
public static readonly PROPERTYKEY PKEY_PhotoAcquire_DuplicateDetectionID = new(new(0x00f23377, 0x7ac6, 0x4b7a, 0x84, 0x43, 0x34, 0x5e, 0x73, 0x1f, 0xa5, 0x7a), 10); // VT_I4
public static readonly PROPERTYKEY PKEY_PhotoAcquire_FinalFilename = new(new(0x00f23377, 0x7ac6, 0x4b7a, 0x84, 0x43, 0x34, 0x5e, 0x73, 0x1f, 0xa5, 0x7a), 3); // VT_LPWSTR
public static readonly PROPERTYKEY PKEY_PhotoAcquire_GroupTag = new(new(0x00f23377, 0x7ac6, 0x4b7a, 0x84, 0x43, 0x34, 0x5e, 0x73, 0x1f, 0xa5, 0x7a), 4); // VT_LPWSTR
public static readonly PROPERTYKEY PKEY_PhotoAcquire_IntermediateFile = new(new(0x00f23377, 0x7ac6, 0x4b7a, 0x84, 0x43, 0x34, 0x5e, 0x73, 0x1f, 0xa5, 0x7a), 8); // VT_LPWSTR
public static readonly PROPERTYKEY PKEY_PhotoAcquire_OriginalFilename = new(new(0x00f23377, 0x7ac6, 0x4b7a, 0x84, 0x43, 0x34, 0x5e, 0x73, 0x1f, 0xa5, 0x7a), 6); // VT_LPWSTR
public static readonly PROPERTYKEY PKEY_PhotoAcquire_RelativePathname = new(new(0x00f23377, 0x7ac6, 0x4b7a, 0x84, 0x43, 0x34, 0x5e, 0x73, 0x1f, 0xa5, 0x7a), 2); // VT_LPWSTR
public static readonly PROPERTYKEY PKEY_PhotoAcquire_SkipImport = new(new(0x00f23377, 0x7ac6, 0x4b7a, 0x84, 0x43, 0x34, 0x5e, 0x73, 0x1f, 0xa5, 0x7a), 9); // VT_BOOL
public static readonly PROPERTYKEY PKEY_PhotoAcquire_TransferResult = new(new(0x00f23377, 0x7ac6, 0x4b7a, 0x84, 0x43, 0x34, 0x5e, 0x73, 0x1f, 0xa5, 0x7a), 5); // VT_SCODE
#pragma warning restore CS1591 // Missing XML comment for publicly visible type or member
/// The enumeration type indicates the type of a selected device.
/// This enumeration type is pointed to by the pnDeviceType parameter of IPhotoAcquireDeviceSelectionDialog::DoModal.
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/ne-photoacquire-device_selection_device_type typedef enum
// tagDEVICE_SELECTION_DEVICE_TYPE { DST_UNKNOWN_DEVICE = 0, DST_WPD_DEVICE = 0x1, DST_WIA_DEVICE = 0x2, DST_STI_DEVICE = 0x3,
// DSF_TWAIN_DEVICE = 0x4, DST_FS_DEVICE = 0x5, DST_DV_DEVICE = 0x6 } DEVICE_SELECTION_DEVICE_TYPE;
[PInvokeData("photoacquire.h", MSDNShortId = "NE:photoacquire.tagDEVICE_SELECTION_DEVICE_TYPE")]
public enum DEVICE_SELECTION_DEVICE_TYPE
{
///
/// Value:
/// 0
/// Specifies that the type of the selected device is unknown.
///
DST_UNKNOWN_DEVICE,
///
/// Value:
/// 0x1
/// Specifies that the type of the selected device is Windows Portable Devices (WPD).
///
DST_WPD_DEVICE,
///
/// Value:
/// 0x2
/// Specifies that the type of the selected device is Windows Image Acquisition (WIA).
///
DST_WIA_DEVICE,
///
/// Value:
/// 0x3
/// Specifies that the type of the selected device is Still Image Architecture (STI).
///
DST_STI_DEVICE,
///
/// Value:
/// 0x4
/// Not supported.
///
DSF_TWAIN_DEVICE,
///
/// Value:
/// 0x5
/// Specifies that the selected device is a removable drive in the file system.
///
DST_FS_DEVICE,
///
/// Value:
/// 0x6
///
DST_DV_DEVICE,
}
///
[Flags]
public enum DSF : uint
{
/// Show devices of type Windows Portable Devices (WPD).
DSF_WPD_DEVICES = 0x00000001,
/// Show cameras of type Windows Image Acquisition (WIA).
DSF_WIA_CAMERAS = 0x00000002,
/// Show scanners of type Windows Image Acquisition (WIA).
DSF_WIA_SCANNERS = 0x00000004,
/// Show devices of type Still Image Architecture (STI).
DSF_STI_DEVICES = 0x00000008,
///
DSF_TWAIN_DEVICES = 0x00000010,
/// Show removable storage devices, such as CD drives or card readers.
DSF_FS_DEVICES = 0x00000020,
/// Show digital video camera devices.
DSF_DV_DEVICES = 0x00000040,
/// Show all devices.
DSF_ALL_DEVICES = 0x0000FFFF,
///
DSF_CPL_MODE = 0x00010000,
/// Show devices that are offline. Not supported by all device types.
DSF_SHOW_OFFLINE = 0x00020000,
}
/// The enumeration type indicates the type of error values that can be passed to the nMessageType parameter of IPhotoAcquireProgressCB::ErrorAdvise.
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/ne-photoacquire-error_advise_message_type typedef enum
// tagERROR_ADVISE_MESSAGE_TYPE { PHOTOACQUIRE_ERROR_SKIPRETRYCANCEL = 0, PHOTOACQUIRE_ERROR_RETRYCANCEL = 1, PHOTOACQUIRE_ERROR_YESNO =
// 2, PHOTOACQUIRE_ERROR_OK = 3 } ERROR_ADVISE_MESSAGE_TYPE;
[PInvokeData("photoacquire.h", MSDNShortId = "NE:photoacquire.tagERROR_ADVISE_MESSAGE_TYPE")]
public enum ERROR_ADVISE_MESSAGE_TYPE
{
///
/// Value:
/// 0
/// Specifies that the error that occurred requires a Skip, Retry, or Cancel response. The
/// pnErrorAdviseResult
/// parameter to
/// IPhotoAcquireProgressDialogCB::ErrorAdvise
/// must be one of the following:
/// PHOTOACQUIRE_RESULT_SKIP
/// ,
/// PHOTOACQUIRE_RESULT_SKIP_ALL
/// ,
/// PHOTOACQUIRE_RESULT_RETRY
/// , or
/// PHOTOACQUIRE_RESULT_ABORT
/// .
///
PHOTOACQUIRE_ERROR_SKIPRETRYCANCEL,
///
/// Value:
/// 1
/// Specifies that the error that occurred requires a Retry or Cancel response. The
/// pnErrorAdviseResult
/// parameter to
/// IPhotoAcquireProgressDialogCB::ErrorAdvise
/// must be one of the following:
/// PHOTOACQUIRE_RESULT_RETRY
/// or
/// PHOTOACQUIRE_RESULT_ABORT
/// .
///
PHOTOACQUIRE_ERROR_RETRYCANCEL,
///
/// Value:
/// 2
/// Specifies that the error that occurred requires a Yes or No response. The
/// pnErrorAdviseResult
/// parameter to
/// IPhotoAcquireProgressDialogCB::ErrorAdvise
/// must be one of the following:
/// PHOTOACQUIRE_RESULT_YES
/// or
/// PHOTOACQUIRE_RESULT_NO
/// .
///
PHOTOACQUIRE_ERROR_YESNO,
///
/// Value:
/// 3
/// Specifies that the error that occurred requires an OK response. The
/// pnErrorAdviseResult
/// parameter to
/// IPhotoAcquireProgressDialogCB::ErrorAdvise
/// must be
/// PHOTOACQUIRE_RESULT_OK
/// .
///
PHOTOACQUIRE_ERROR_OK,
}
///
/// The enumeration type indicates the type of error values that can be assigned to the pnErrorAdviseResult parameter of IPhotoAcquireProgressCB::ErrorAdvise.
///
///
/// The type of response allowed is of type ERROR_ADVISE_MESSAGE_TYPE, and indicated by the nMessageType parameter of IPhotoAcquireProgressCB::ErrorAdvise.
///
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/ne-photoacquire-error_advise_result typedef enum
// tagERROR_ADVISE_RESULT { PHOTOACQUIRE_RESULT_YES = 0, PHOTOACQUIRE_RESULT_NO = 1, PHOTOACQUIRE_RESULT_OK = 2, PHOTOACQUIRE_RESULT_SKIP
// = 3, PHOTOACQUIRE_RESULT_SKIP_ALL = 4, PHOTOACQUIRE_RESULT_RETRY = 5, PHOTOACQUIRE_RESULT_ABORT = 6 } ERROR_ADVISE_RESULT;
[PInvokeData("photoacquire.h", MSDNShortId = "NE:photoacquire.tagERROR_ADVISE_RESULT")]
public enum ERROR_ADVISE_RESULT
{
///
/// Value:
/// 0
/// Specifies a Yes response to an error dialog. Valid only if the
/// nMessageType
/// parameter to
/// IPhotoAcquireProgressCB::ErrorAdvise
/// is PHOTOACQUIRE_ERROR_YESNO.
///
PHOTOACQUIRE_RESULT_YES,
///
/// Value:
/// 1
/// Specifies a No response to an error dialog. Valid only if the
/// nMessageType
/// parameter to
/// IPhotoAcquireProgressCB::ErrorAdvise
/// is PHOTOACQUIRE_ERROR_YESNO.
///
PHOTOACQUIRE_RESULT_NO,
///
/// Value:
/// 2
/// Specifies an OK response to an error dialog. Valid only if the
/// nMessageType
/// parameter to
/// IPhotoAcquireProgressCB::ErrorAdvise
/// is PHOTOACQUIRE_ERROR_OK.
///
PHOTOACQUIRE_RESULT_OK,
///
/// Value:
/// 3
/// Specifies a Skip response to an error dialog. Valid only if the
/// nMessageType
/// parameter to
/// IPhotoAcquireProgressCB::ErrorAdvise
/// is PHOTOACQUIRE_ERROR_SKIPRETRYCANCEL.
///
PHOTOACQUIRE_RESULT_SKIP,
///
/// Value:
/// 4
/// Specifies a Skip All response to an error dialog. Valid only if the
/// nMessageType
/// parameter to
/// IPhotoAcquireProgressCB::ErrorAdvise
/// is PHOTOACQUIRE_ERROR_SKIPRETRYCANCEL.
///
PHOTOACQUIRE_RESULT_SKIP_ALL,
///
/// Value:
/// 5
/// Specifies a Retry response to an error dialog. Valid only if the
/// nMessageType
/// parameter to
/// IPhotoAcquireProgressCB::ErrorAdvise
/// is PHOTOACQUIRE_ERROR_SKIPRETRYCANCEL or PHOTOACQUIRE_ERROR_RETRYCANCEL.
///
PHOTOACQUIRE_RESULT_RETRY,
///
/// Value:
/// 6
/// Specifies a Cancel response to an error dialog. Valid only if the
/// nMessageType
/// parameter to
/// IPhotoAcquireProgressCB::ErrorAdvise
/// is PHOTOACQUIRE_ERROR_SKIPRETRYCANCEL or PHOTOACQUIRE_ERROR_RETRYCANCEL.
///
PHOTOACQUIRE_RESULT_ABORT,
}
/// Specifies a double word value indicating whether this method is being called before or after processing an item.
[PInvokeData("photoacquire.h", MSDNShortId = "NN:photoacquire.IPhotoAcquirePlugin")]
public enum PAPS : uint
{
///
/// Indicates that the method is being called before saving the acquired file. During PAPS_PRESAVE, pPhotoAcquireItem::GetProperty
/// should be used to retrieve metadata from the original file, while new metadata to be written to the file should be added to pPropertyStore.
///
PAPS_PRESAVE = 0x00000000,
/// Indicates that the method is being called after saving the acquired file.
PAPS_POSTSAVE = 0x00000001,
/// Indicates that the user has canceled the acquire operation and any work done by the plug-in should be cleaned up.
PAPS_CLEANUP = 0x00000002,
}
/// Photo acquire flags.
[PInvokeData("photoacquire.h")]
[Flags]
public enum PHOTOACQ : uint
{
///
PHOTOACQ_RUN_DEFAULT = 0x00000000,
///
/// In versions of Windows that don't include Windows Photo Gallery, PHOTOACQ_NO_GALLERY_LAUNCH suppresses the explorer window
/// launched after acquisition.
///
PHOTOACQ_NO_GALLERY_LAUNCH = 0x00000001,
///
PHOTOACQ_DISABLE_AUTO_ROTATE = 0x00000002,
///
PHOTOACQ_DISABLE_PLUGINS = 0x00000004,
///
PHOTOACQ_DISABLE_GROUP_TAG_PROMPT = 0x00000008,
///
PHOTOACQ_DISABLE_DB_INTEGRATION = 0x00000010,
///
PHOTOACQ_DELETE_AFTER_ACQUIRE = 0x00000020,
///
PHOTOACQ_DISABLE_DUPLICATE_DETECTION = 0x00000040,
///
PHOTOACQ_ENABLE_THUMBNAIL_CACHING = 0x00000080,
///
PHOTOACQ_DISABLE_METADATA_WRITE = 0x00000100,
///
PHOTOACQ_DISABLE_THUMBNAIL_PROGRESS = 0x00000200,
///
PHOTOACQ_DISABLE_SETTINGS_LINK = 0x00000400,
///
PHOTOACQ_ABORT_ON_SETTINGS_UPDATE = 0x00000800,
///
PHOTOACQ_IMPORT_VIDEO_AS_MULTIPLE_FILES = 0x00001000,
}
/// The enumeration type indicates the check box on the IPhotoProgressDialog object.
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/ne-photoacquire-progress_dialog_checkbox_id typedef enum
// PROGRESS_DIALOG_CHECKBOX_ID { PROGRESS_DIALOG_CHECKBOX_ID_DEFAULT = 0 } PROGRESS_DIALOG_CHECKBOX_ID;
[PInvokeData("photoacquire.h", MSDNShortId = "NE:photoacquire.PROGRESS_DIALOG_CHECKBOX_ID")]
public enum PROGRESS_DIALOG_CHECKBOX_ID
{
///
/// Value:
/// 0
/// Specifies PROGRESS_DIALOG_CHECKBOX_ID_DEFAULT .
///
PROGRESS_DIALOG_CHECKBOX_ID_DEFAULT,
}
/// The enumeration type indicates the image type set in IPhotoProgressDialog::SetImage.
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/ne-photoacquire-progress_dialog_image_type typedef enum
// tagPROGRESS_DIALOG_IMAGE_TYPE { PROGRESS_DIALOG_ICON_SMALL = 0, PROGRESS_DIALOG_ICON_LARGE = 0x1, PROGRESS_DIALOG_ICON_THUMBNAIL =
// 0x2, PROGRESS_DIALOG_BITMAP_THUMBNAIL = 0x3 } PROGRESS_DIALOG_IMAGE_TYPE;
[PInvokeData("photoacquire.h", MSDNShortId = "NE:photoacquire.tagPROGRESS_DIALOG_IMAGE_TYPE")]
public enum PROGRESS_DIALOG_IMAGE_TYPE
{
///
/// Value:
/// 0
/// Specifies the small icon used in the title bar (normally 16 x 16 pixels).
///
PROGRESS_DIALOG_ICON_SMALL,
///
/// Value:
/// 0x1
/// Specifies the icon used to represent the progress dialog box in ALT+TAB key combination windows (normally 32 x 32 pixels).
///
PROGRESS_DIALOG_ICON_LARGE,
///
/// Value:
/// 0x2
/// Specifies an icon used in place of the thumbnail (up to 128 x 128 pixels).
///
PROGRESS_DIALOG_ICON_THUMBNAIL,
///
/// Value:
/// 0x3
/// Specifies a bitmap thumbnail (up to 128 x 128 pixels, although it will be scaled to fit if it is too large).
///
PROGRESS_DIALOG_BITMAP_THUMBNAIL,
}
/// The enumeration type indicates the type of string to obtain from the user in IPhotoAcquireProgressCB::GetUserInput.
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/ne-photoacquire-user_input_string_type typedef enum
// tagUSER_INPUT_STRING_TYPE { USER_INPUT_DEFAULT = 0, USER_INPUT_PATH_ELEMENT = 0x1 } USER_INPUT_STRING_TYPE;
[PInvokeData("photoacquire.h", MSDNShortId = "NE:photoacquire.tagUSER_INPUT_STRING_TYPE")]
public enum USER_INPUT_STRING_TYPE
{
///
/// Value:
/// 0
/// Indicates that any string is allowed.
///
USER_INPUT_DEFAULT,
///
/// Value:
/// 0x1
/// Indicates that the string will not accept characters that are illegal in file or directory names (such as * or /).
///
USER_INPUT_PATH_ELEMENT,
}
/// The interface provides methods for acquiring photos from a device.
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/nn-photoacquire-iphotoacquire
[PInvokeData("photoacquire.h", MSDNShortId = "NN:photoacquire.IPhotoAcquire")]
[ComImport, Guid("00F23353-E31B-4955-A8AD-CA5EBF31E2CE"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown), CoClass(typeof(PhotoAcquire))]
public interface IPhotoAcquire
{
/// The method initializes an IPhotoAcquireSource object to pass to IPhotoAcquire::Acquire.
/// A string containing the device name.
/// Returns the initialized photo source to acquire photos from.
///
/// The IPhotoAcquireSource object created is used as the parameter for the Acquire method.
/// If an error occurs in , ppPhotoAcquireSource is initialized to NULL.
///
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/nf-photoacquire-iphotoacquire-createphotosource HRESULT
// CreatePhotoSource( [in] LPCWSTR pszDevice, [out] IPhotoAcquireSource **ppPhotoAcquireSource );
IPhotoAcquireSource? CreatePhotoSource([In, MarshalAs(UnmanagedType.LPWStr)] string pszDevice);
/// The method acquires photos from a device.
///
/// Pointer to an IPhotoAcquireSource object representing the device from which to acquire photos. Initialize this object by calling CreatePhotoSource.
///
/// Flag that, when set to , indicates that a progress dialog will be shown.
/// Handle to a parent window.
/// A string containing the application name.
/// Pointer to an optional IPhotoAcquireProgressCB object.
///
///
/// To initialize the pPhotoAcquireSource parameter passed to , CreatePhotoSource should be called prior to calling .
///
///
/// pPhotoAcquireProgressCB provides callback methods that allow you to apply further filtering or control as items are acquired.
///
///
/// To verify that there are items in the device before acquisition, or to selectively acquire items from the device, call
/// IPhotoAcquireSource::InitializeItemList to enumerate the items before calling .
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/nf-photoacquire-iphotoacquire-acquire HRESULT Acquire( [in]
// IPhotoAcquireSource *pPhotoAcquireSource, [in] BOOL fShowProgress, [in] HWND hWndParent, [in] LPCWSTR pszApplicationName, [in]
// IPhotoAcquireProgressCB *pPhotoAcquireProgressCB );
void Acquire([In, Optional, MarshalAs(UnmanagedType.Interface)] IPhotoAcquireSource pPhotoAcquireSource, [In, MarshalAs(UnmanagedType.Bool)] bool fShowProgress,
[In, Optional] HWND hWndParent, [In, Optional, MarshalAs(UnmanagedType.LPWStr)] string pszApplicationName, [In, Optional, MarshalAs(UnmanagedType.Interface)] IPhotoAcquireProgressCB pPhotoAcquireProgressCB);
///
/// The method retrieves an enumeration containing the paths of all files successfully transferred during the most recent call to Acquire.
///
/// Returns an enumeration containing the paths to all the transferred files.
/// If the file transfer is aborted before any files are transferred, ppEnumFilePaths will be set to NULL.
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/nf-photoacquire-iphotoacquire-enumresults HRESULT EnumResults(
// [out] IEnumString **ppEnumFilePaths );
IEnumString? EnumResults();
}
/// Provides a dialog box for selecting the device to acquire images from.
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/nn-photoacquire-iphotoacquiredeviceselectiondialog
[PInvokeData("photoacquire.h", MSDNShortId = "NN:photoacquire.IPhotoAcquireDeviceSelectionDialog")]
[ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("00F28837-55DD-4F37-AAF5-6855A9640467"), CoClass(typeof(PhotoAcquireDeviceSelectionDialog))]
public interface IPhotoAcquireDeviceSelectionDialog
{
/// The method sets the title of the device selection dialog box.
/// A string containing the title.
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/nf-photoacquire-iphotoacquiredeviceselectiondialog-settitle
// HRESULT SetTitle( [in] LPCWSTR pszTitle );
void SetTitle([In, MarshalAs(UnmanagedType.LPWStr)] string pszTitle);
/// The method sets the text displayed in the dialog box that prompts the user to select a device.
/// A string containing the prompt.
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/nf-photoacquire-iphotoacquiredeviceselectiondialog-setsubmitbuttontext
// HRESULT SetSubmitButtonText( [in] LPCWSTR pszSubmitButtonText );
void SetSubmitButtonText([In, MarshalAs(UnmanagedType.LPWStr)] string pszSubmitButtonText);
/// The method displays a device selection dialog box. The function returns when the user selects a device using the modal dialog box.
/// Handle to a parent window.
///
/// Double word value containing a combination of device flags that indicate which type of devices to display. The device flags may be a combination of any of the following:
///
///
/// Flag
/// Description
///
/// -
/// DSF_WPD_DEVICES
/// Show devices of type Windows Portable Devices (WPD).
///
/// -
/// DSF_WIA_CAMERAS
/// Show cameras of type Windows Image Acquisition (WIA).
///
/// -
/// DSF_WIA_SCANNERS
/// Show scanners of type Windows Image Acquisition (WIA).
///
/// -
/// DSF_STI_DEVICES
/// Show devices of type Still Image Architecture (STI).
///
/// -
/// DSF_FS_DEVICES
/// Show removable storage devices, such as CD drives or card readers.
///
/// -
/// DSF_DV_DEVICES
/// Show digital video camera devices.
///
/// -
/// DSF_ALL_DEVICES
/// Show all devices.
///
/// -
/// DSF_SHOW_OFFLINE
/// Show devices that are offline. Not supported by all device types.
///
///
///
/// Pointer to a string containing the ID of the selected device.
/// Pointer to the DEVICE_SELECTION_DEVICE_TYPE of the selected device.
///
/// The method returns an HRESULT. Possible values include, but are not limited to, those in the following table.
///
///
/// Return code
/// Description
///
/// -
/// S_OK
/// The method succeeded.
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/nf-photoacquire-iphotoacquiredeviceselectiondialog-domodal
// HRESULT DoModal( [in] HWND hWndParent, [in] DWORD dwDeviceFlags, [out] BSTR *pbstrDeviceId, [out] DEVICE_SELECTION_DEVICE_TYPE *pnDeviceType );
[PreserveSig]
HRESULT DoModal([In] HWND hWndParent, [In] DSF dwDeviceFlags, [MarshalAs(UnmanagedType.BStr)] out string? pbstrDeviceId,
out DEVICE_SELECTION_DEVICE_TYPE pnDeviceType);
}
/// The interface provides methods for working with items as they are acquired from a device.
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/nn-photoacquire-iphotoacquireitem
[PInvokeData("photoacquire.h", MSDNShortId = "NN:photoacquire.IPhotoAcquireItem")]
[ComImport, Guid("00F21C97-28BF-4C02-B842-5E4E90139A30"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IPhotoAcquireItem
{
/// The method retrieves the file name for an item.
/// Pointer to a string containing the name of the item.
///
/// The file name consists of the display name and the extension, even if the Hide extensions for known file types setting is
/// checked in the Windows Folder Options dialog box.
///
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/nf-photoacquire-iphotoacquireitem-getitemname HRESULT
// GetItemName( [out] BSTR *pbstrItemName );
[return: MarshalAs(UnmanagedType.BStr)]
string? GetItemName();
/// The method retrieves the thumbnail provided for an item.
/// Specifies the size of the thumbnail.
/// Specifies a handle to the thumbnail bitmap.
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/nf-photoacquire-iphotoacquireitem-getthumbnail HRESULT
// GetThumbnail( [in] SIZE sizeThumbnail, [out] HBITMAP *phbmpThumbnail );
SafeHBITMAP? GetThumbnail([In] SIZE sizeThumbnail);
/// The method retrieves the value of a property of an item.
/// Specifies a key for the property.
/// Pointer to a property variant containing the property value.
///
/// The method returns an HRESULT. Possible values include, but are not limited to, those in the following table.
///
///
/// Return code
/// Description
///
/// -
/// S_OK
/// The method succeeded.
///
///
///
///
/// For an item that is a shell object, this method will defer to the IPropertyStore object provided by the item if the
/// property hasn't been set or updated using SetProperty.
///
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/nf-photoacquire-iphotoacquireitem-getproperty HRESULT
// GetProperty( [in] REFPROPERTYKEY key, [out] PROPVARIANT *pv );
[PreserveSig]
HRESULT GetProperty(in PROPERTYKEY key, [Out] PROPVARIANT pv);
/// The method sets a property for an item.
/// Specifies a key for the property to set.
/// Pointer to a property variant containing the value to set the property to.
/// The property is stored in memory, but is not written to the file.
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/nf-photoacquire-iphotoacquireitem-setproperty HRESULT
// SetProperty( [in] REFPROPERTYKEY key, [in] const PROPVARIANT *pv );
void SetProperty(in PROPERTYKEY key, [In] PROPVARIANT pv);
/// The method retrieves a read-only stream containing the contents of an item.
/// Returns a stream object with the file contents.
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/nf-photoacquire-iphotoacquireitem-getstream HRESULT GetStream(
// [out] IStream **ppStream );
IStream? GetStream();
/// The method indicates whether an item may be deleted.
/// Pointer to a flag that, when set to , indicates that the item can be deleted.
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/nf-photoacquire-iphotoacquireitem-candelete HRESULT CanDelete(
// [out] BOOL *pfCanDelete );
[return: MarshalAs(UnmanagedType.Bool)]
bool CanDelete();
/// The method deletes an item.
/// To determine whether an item may be deleted, call CanDelete first.
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/nf-photoacquire-iphotoacquireitem-delete HRESULT Delete();
void Delete();
/// The method retrieves the number of subitems contained in an item.
/// Pointer to an integer containing the count of subitems.
/// If an error occurs, pnCount will be set to NULL.
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/nf-photoacquire-iphotoacquireitem-getsubitemcount HRESULT
// GetSubItemCount( [out] UINT *pnCount );
uint GetSubItemCount();
/// The method retrieves a subitem of an item, given the index of the subitem.
/// Integer containing the index of the item.
/// Returns the IPhotoAcquireItem object at the given index.
/// If no item is found at the given index, ppPhotoAcquireItem is set to NULL.
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/nf-photoacquire-iphotoacquireitem-getsubitemat HRESULT
// GetSubItemAt( [in] UINT nItemIndex, [out] IPhotoAcquireItem **ppPhotoAcquireItem );
IPhotoAcquireItem? GetSubItemAt([In] uint nItemIndex);
}
/// The method retrieves the value of a property of an item.
/// The instance.
/// Specifies a key for the property.
/// The property value or on error.
///
/// For an item that is a shell object, this method will defer to the IPropertyStore object provided by the item if the
/// property hasn't been set or updated using SetProperty.
///
public static object? GetProperty(this IPhotoAcquireItem item, in PROPERTYKEY key)
{
if (item == null) throw new ArgumentNullException(nameof(item));
using var pv = new PROPVARIANT();
return item.GetProperty(key, pv).Succeeded ? pv.Value : null;
}
///
/// The interface is used to display an options dialog box in which the user can select photo acquisition settings such as file name
/// formats, as well as whether or not to rotate images, to prompt for a tag name, or to erase photos from the camera after importing.
///
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/nn-photoacquire-iphotoacquireoptionsdialog
[PInvokeData("photoacquire.h", MSDNShortId = "NN:photoacquire.IPhotoAcquireOptionsDialog")]
[ComImport, Guid("00F2B3EE-BF64-47EE-89F4-4DEDD79643F2"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown), CoClass(typeof(PhotoAcquireOptionsDialog))]
public interface IPhotoAcquireOptionsDialog
{
/// Initializes the options dialog box and reads any saved options from the registry.
///
/// (optional) A string containing the registry root of a custom location to read the acquisition settings from. If this parameter is
/// set to NULL, the default location will be used.
///
///
/// must be called prior to calling Create or DoModal. Failure to do so will cause Create or DoModal to fail.
/// If is called while the options dialog box is already displayed, an error will be returned.
///
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/nf-photoacquire-iphotoacquireoptionsdialog-initialize HRESULT
// Initialize( [in] LPCWSTR pszRegistryRoot );
void Initialize([In, Optional, MarshalAs(UnmanagedType.LPWStr)] string pszRegistryRoot);
/// The method creates and displays a modeless instance of the photo options dialog box, hosted within a parent window.
/// Handle to the parent window.
/// Specifies the created dialog box.
///
/// The Initialize method should be called prior to the method.
/// The parent window indicated by hWndParent provides OK and Cancel buttons to the new dialog box instance.
///
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/nf-photoacquire-iphotoacquireoptionsdialog-create HRESULT Create(
// [in] HWND hWndParent, [out] HWND *phWndDialog );
HWND Create([In] HWND hWndParent);
/// The method closes and destroys the modeless dialog box created with the Create method.
/// If you destroy the parent window, the child window will automatically be destroyed.
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/nf-photoacquire-iphotoacquireoptionsdialog-destroy HRESULT Destroy();
void Destroy();
/// The method creates and displays the options dialog box as a modal dialog box.
/// Handle to the dialog's parent window.
/// Specifies the code returned when the window is closed.
///
/// The modal dialog displayed by DoModal will have OK and Cancel buttons, whereas the OK and
/// Cancel buttons of the modeless dialog displayed by Create must be provided by the parent window.
///
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/nf-photoacquire-iphotoacquireoptionsdialog-domodal HRESULT
// DoModal( [in] HWND hWndParent, [out] INT_PTR *ppnReturnCode );
[return: MarshalAs(UnmanagedType.SysInt)]
IntPtr DoModal([In] HWND hWndParent);
///
/// The method saves acquisition settings from the options dialog box to the registry so that a subsequent instance of the dialog can
/// be initialized with the same settings.
///
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/nf-photoacquire-iphotoacquireoptionsdialog-savedata HRESULT SaveData();
void SaveData();
}
///
/// Implement the interface when you want to create a plug-in to run alongside the Windows Vista user interface (UI) for image
/// acquisition. Registry settings are required to enable the plug-in.
///
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/nn-photoacquire-iphotoacquireplugin
[PInvokeData("photoacquire.h", MSDNShortId = "NN:photoacquire.IPhotoAcquirePlugin")]
[ComImport, Guid("00f2dceb-ecb8-4f77-8e47-e7a987c83dd0"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IPhotoAcquirePlugin
{
///
/// The method provides extended functionality when the plug-in is initialized. The application provides the implementation of the method.
///
/// Specifies the source from which photos are being acquired.
/// Specifies the callback that will provide additional processing during acquisition.
///
/// The method returns an HRESULT. Your implementation is not limited to the following return values.
///
///
/// Return code
/// Description
///
/// -
/// S_OK
/// The method succeeded.
///
/// -
/// E_NOTIMPL
/// The method is not implemented
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/nf-photoacquire-iphotoacquireplugin-initialize HRESULT
// Initialize( [in] IPhotoAcquireSource *pPhotoAcquireSource, [in] IPhotoAcquireProgressCB *pPhotoAcquireProgressCB );
[PreserveSig]
HRESULT Initialize([In, Optional] IPhotoAcquireSource pPhotoAcquireSource, [In, Optional] IPhotoAcquireProgressCB pPhotoAcquireProgressCB);
///
/// The method provides additional functionality each time an item is processed. The application provides the implementation of the method.
///
///
///
/// Specifies a double word value indicating whether this method is being called before or after processing an item. Must be one of:
/// PAPS_PRESAVE, PAPS_POSTSAVE, or PAPS_CLEANUP.
///
///
///
/// Value
/// Description
///
/// -
/// PAPS_PRESAVE
///
/// Indicates that the method is being called before saving the acquired file. During PAPS_PRESAVE, pPhotoAcquireItem::GetProperty
/// should be used to retrieve metadata from the original file, while new metadata to be written to the file should be added to pPropertyStore.
///
///
/// -
/// PAPS_POSTSAVE
/// Indicates that the method is being called after saving the acquired file.
///
/// -
/// PAPS_CLEANUP
/// Indicates that the user has canceled the acquire operation and any work done by the plug-in should be cleaned up.
///
///
///
/// Pointer to an IPhotoAcquireItem object for the item being processed.
///
/// Pointer to an IStream object for the original item. NULL if dwAcquireStage is PAPS_POSTSAVE.
///
/// The file name of the destination of the item. NULL if dwAcquireStage is PAPS_PRESAVE.
/// The item's property store. NULL if dwAcquireStage is PAPS_POSTSAVE.
///
/// The method returns an HRESULT. Your implementation is not limited to the following return values.
///
///
/// Return code
/// Description
///
/// -
/// S_OK
/// The method succeeded.
///
/// -
/// E_NOTIMPL
/// The method is not implemented.
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/nf-photoacquire-iphotoacquireplugin-processitem HRESULT
// ProcessItem( [in] DWORD dwAcquireStage, [in] IPhotoAcquireItem *pPhotoAcquireItem, [in] IStream *pOriginalItemStream, [in] LPCWSTR
// pszFinalFilename, [in] IPropertyStore *pPropertyStore );
[PreserveSig]
HRESULT ProcessItem(PAPS dwAcquireStage, [In, Optional] IPhotoAcquireItem pPhotoAcquireItem, [In, Optional] IStream pOriginalItemStream,
string pszFinalFilename, [In, Optional] IPropertyStore pPropertyStore);
///
/// Provides extended functionality when a transfer session is completed. The application provides the implementation of the
/// TransferComplete method.
///
/// Specifies the result of the transfer operation.
///
/// The method returns an HRESULT. Your implementation is not limited to the following return values.
///
///
/// Return code
/// Description
///
/// -
/// S_OK
/// The method succeeded.
///
/// -
/// E_NOTIMPL
/// The method is not implemented
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/nf-photoacquire-iphotoacquireplugin-transfercomplete HRESULT
// TransferComplete( [in] HRESULT hr );
[PreserveSig]
HRESULT TransferComplete(HRESULT hr);
///
/// The method provides extended functionality when the configuration dialog is displayed. The application provides the
/// implementation of the method.
///
/// Specifies the handle to the configuration dialog window.
///
/// The method returns an HRESULT. Your implementation is not limited to the following return values.
///
///
/// Return code
/// Description
///
/// -
/// S_OK
/// The method succeeded.
///
/// -
/// E_NOTIMPL
/// The method is not implemented
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/nf-photoacquire-iphotoacquireplugin-displayconfiguredialog
// HRESULT DisplayConfigureDialog( [in] HWND hWndParent );
[PreserveSig]
HRESULT DisplayConfigureDialog([In] HWND hWndParent);
}
/// The interface may be implemented if you wish to do extra processing at various stages in the acquisition process.
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/nn-photoacquire-iphotoacquireprogresscb
[PInvokeData("photoacquire.h", MSDNShortId = "NN:photoacquire.IPhotoAcquireProgressCB")]
[ComImport, Guid("00F2CE1E-935E-4248-892C-130F32C45CB4"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IPhotoAcquireProgressCB
{
///
/// The method provides extended functionality when a cancellation occurs during an acquisition session. The application provides the
/// implementation of the method.
///
/// Pointer to a flag that, when set to , indicates that the operation was canceled.
///
///
/// The method returns an HRESULT. Your implementation is not limited to the following return values. Any failing HRESULT
/// other than E_NOTIMPL is fatal and will cause the transfer to abort.
///
///
///
/// Return code
/// Description
///
/// -
/// S_OK
/// The method succeeded.
///
/// -
/// E_NOTIMPL
/// The method is not implemented.
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/nf-photoacquire-iphotoacquireprogresscb-cancelled HRESULT
// Cancelled( [out] BOOL *pfCancelled );
[PreserveSig]
HRESULT Cancelled([MarshalAs(UnmanagedType.Bool)] out bool pfCancelled);
///
/// The method provides extended functionality when the enumeration of items to acquire begins.
/// The application provides the implementation of the method.
///
/// Pointer to the IPhotoAcquireSource object that items are being enumerated from.
///
///
/// The method returns an HRESULT. Your implementation is not limited to the following return values. Any failing HRESULT
/// other than E_NOTIMPL is fatal and will cause the transfer to abort.
///
///
///
/// Return code
/// Description
///
/// -
/// S_OK
/// The method succeeded.
///
/// -
/// E_NOTIMPL
/// The method is not implemented.
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/nf-photoacquire-iphotoacquireprogresscb-startenumeration HRESULT
// StartEnumeration( [in] IPhotoAcquireSource *pPhotoAcquireSource );
[PreserveSig]
HRESULT StartEnumeration([In, Optional, MarshalAs(UnmanagedType.Interface)] IPhotoAcquireSource pPhotoAcquireSource);
///
/// The method provides extended functionality each time an item is found during enumeration of items from the device. This method
/// can be used to exclude an item from the list of items to acquire. The application provides the implementation of the method.
///
/// Pointer to the found IPhotoAcquireItem object.
///
///
/// The method returns an HRESULT. Your implementation is not limited to the following return values. Any failing HRESULT
/// other than E_NOTIMPL is fatal and will cause the transfer to abort.
///
///
///
/// Return code
/// Description
///
/// -
/// S_OK
/// The method succeeded.
///
/// -
/// S_FALSE
/// Exclude this item from the list of files to acquire.
///
///
///
///
/// Return S_FALSE to exclude the item from the results of the enumeration. This would allow the caller to exclude videos or camera
/// raw files, for instance.
///
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/nf-photoacquire-iphotoacquireprogresscb-founditem HRESULT
// FoundItem( [in] IPhotoAcquireItem *pPhotoAcquireItem );
[PreserveSig]
HRESULT FoundItem([In, MarshalAs(UnmanagedType.Interface)] IPhotoAcquireItem pPhotoAcquireItem);
///
/// The method provides extended functionality when enumeration of files from the image source is complete. The application provides
/// the implementation of the method.
///
/// Specifies the result of the enumeration operation.
///
///
/// The method returns an HRESULT. Your implementation is not limited to the following return values. Any failing HRESULT
/// other than E_NOTIMPL is fatal and will cause the transfer to abort.
///
///
///
/// Return code
/// Description
///
/// -
/// S_OK
/// The method succeeded.
///
/// -
/// E_NOTIMPL
/// The method is not yet implemented
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/nf-photoacquire-iphotoacquireprogresscb-endenumeration HRESULT
// EndEnumeration( [in] HRESULT hr );
[PreserveSig]
HRESULT EndEnumeration(HRESULT hr);
///
/// The method provides additional processing when transfer of items from the device begins. The application provides the
/// implementation of the method.
///
/// Pointer to the IPhotoAcquireSource from which items are being retrieved.
///
///
/// The method returns an HRESULT. Your implementation is not limited to the following return values. Any Failing HRESULT
/// other than E_NOTIMPL is fatal and will cause the transfer to abort.
///
///
///
/// Return code
/// Description
///
/// -
/// S_OK
/// The method succeeded.
///
/// -
/// E_NOTIMPL
/// The method is not implemented.
///
///
///
/// Returning an error HRESULT other than E_NOTIMPL will cause acquisition to be aborted.
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/nf-photoacquire-iphotoacquireprogresscb-starttransfer HRESULT
// StartTransfer( [in] IPhotoAcquireSource *pPhotoAcquireSource );
[PreserveSig]
HRESULT StartTransfer([In, Optional, MarshalAs(UnmanagedType.Interface)] IPhotoAcquireSource pPhotoAcquireSource);
///
/// The method provides extended functionality each time the transfer of an item begins. The application provides the implementation
/// of the method.
///
/// Integer value containing the item index in the list of items to transfer.
/// Pointer to the IPhotoAcquireItem object that is to be transferred.
///
///
/// The method returns an HRESULT. Your implementation is not limited to the following return values. Any failing HRESULT
/// other than E_NOTIMPL is fatal and will cause the transfer to abort.
///
///
///
/// Return code
/// Description
///
/// -
/// S_OK
/// The method succeeded.
///
/// -
/// E_NOTIMPL
/// The method is not implemented.
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/nf-photoacquire-iphotoacquireprogresscb-startitemtransfer HRESULT
// StartItemTransfer( [in] UINT nItemIndex, [in] IPhotoAcquireItem *pPhotoAcquireItem );
[PreserveSig]
HRESULT StartItemTransfer([In] uint nItemIndex, [In, Optional, MarshalAs(UnmanagedType.Interface)] IPhotoAcquireItem pPhotoAcquireItem);
///
/// The method provides extended functionality when a destination directory is created during the acquisition process. The
/// application provides the implementation of the method.
///
/// A string containing the directory.
///
///
/// The method returns an HRESULT. Your implementation is not limited to the following return values. Any failing HRESULT
/// other than E_NOTIMPL is fatal and will cause the transfer to abort.
///
///
///
/// Return code
/// Description
///
/// -
/// S_OK
/// The method succeeded.
///
/// -
/// E_NOTIMPL
/// The method is not yet implemented.
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/nf-photoacquire-iphotoacquireprogresscb-directorycreated HRESULT
// DirectoryCreated( [in] LPCWSTR pszDirectory );
[PreserveSig]
HRESULT DirectoryCreated([In, MarshalAs(UnmanagedType.LPWStr)] string pszDirectory);
///
/// The method provides extended functionality when the percentage of items transferred changes. The application provides the
/// implementation of the method.
///
///
/// Flag that, when set to , indicates that the value contained in nPercent is a percentage of the
/// overall transfer progress, rather than a percentage of an individual item's progress.
///
/// Integer value containing the percentage of items transferred.
///
///
/// The method returns an HRESULT. Your implementation is not limited to the following return values. Any failing HRESULT
/// other than E_NOTIMPL is fatal and will cause the transfer to abort.
///
///
///
/// Return code
/// Description
///
/// -
/// S_OK
/// The method succeeded.
///
/// -
/// E_NOTIMPL
/// The method is not implemented.
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/nf-photoacquire-iphotoacquireprogresscb-updatetransferpercent
// HRESULT UpdateTransferPercent( [in] BOOL fOverall, [in] UINT nPercent );
[PreserveSig]
HRESULT UpdateTransferPercent([MarshalAs(UnmanagedType.Bool)] bool fOverall, [In] uint nPercent);
///
/// The method provides extended functionality each time a file is transferred from the image source. The application provides the
/// implementation of the method.
///
/// Integer value containing the item index.
/// Pointer to a photo acquire item object.
/// Specifies the result of the transfer operation.
///
///
/// The method returns an HRESULT. Your implementation is not limited to the following return values. Any failing HRESULT
/// other than E_NOTIMPL is fatal and will cause the transfer to abort.
///
///
///
/// Return code
/// Description
///
/// -
/// S_OK
/// The method succeeded.
///
/// -
/// E_NOTIMPL
/// The method is not yet implemented
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/nf-photoacquire-iphotoacquireprogresscb-enditemtransfer HRESULT
// EndItemTransfer( [in] UINT nItemIndex, [in] IPhotoAcquireItem *pPhotoAcquireItem, [in] HRESULT hr );
[PreserveSig]
HRESULT EndItemTransfer([In] uint nItemIndex, [In, Optional, MarshalAs(UnmanagedType.Interface)] IPhotoAcquireItem pPhotoAcquireItem, HRESULT hr);
///
/// The method provides extended functionality when the transfer of all files is complete. The application provides the
/// implementation of the method.
///
/// Specifies the result of the transfer.
///
///
/// The method returns an HRESULT. Your implementation is not limited to the following return values. Any failing HRESULT
/// other than E_NOTIMPL is fatal and will cause the transfer to abort.
///
///
///
/// Return code
/// Description
///
/// -
/// S_OK
/// The method succeeded.
///
/// -
/// E_NOTIMPL
/// The method is not yet implemented
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/nf-photoacquire-iphotoacquireprogresscb-endtransfer HRESULT
// EndTransfer( [in] HRESULT hr );
[PreserveSig]
HRESULT EndTransfer(HRESULT hr);
///
/// The method provides extended functionality when deletion of items from the device begins.
/// The implementation of is provided by the application.
///
/// Pointer to the IPhotoAcquireSource that items are being deleted from.
///
///
/// The method returns an HRESULT. Your implementation is not limited to the following return values. Any failing HRESULT
/// other than E_NOTIMPL is fatal and will cause the transfer to abort.
///
///
///
/// Return code
/// Description
///
/// -
/// S_OK
/// The method succeeded.
///
/// -
/// E_NOTIMPL
/// The method is not yet implemented
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/nf-photoacquire-iphotoacquireprogresscb-startdelete HRESULT
// StartDelete( [in] IPhotoAcquireSource *pPhotoAcquireSource );
[PreserveSig]
HRESULT StartDelete([In, Optional, MarshalAs(UnmanagedType.Interface)] IPhotoAcquireSource pPhotoAcquireSource);
///
/// The method provides extended functionality each time the deletion of an individual item from the device begins. The application
/// provides the implementation of the method.
///
/// Integer value containing the item index in the list of items to delete.
/// Pointer to the IPhotoAcquireItem object that is being deleted.
///
///
/// The method returns an HRESULT. Your implementation is not limited to the following return values. Any failing HRESULT
/// other than E_NOTIMPL is fatal and will cause the transfer to abort.
///
///
///
/// Return code
/// Description
///
/// -
/// S_OK
/// The method succeeded.
///
/// -
/// E_NOTIMPL
/// The method is not implemented.
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/nf-photoacquire-iphotoacquireprogresscb-startitemdelete HRESULT
// StartItemDelete( [in] UINT nItemIndex, [in] IPhotoAcquireItem *pPhotoAcquireItem );
[PreserveSig]
HRESULT StartItemDelete([In] uint nItemIndex, [In, Optional, MarshalAs(UnmanagedType.Interface)] IPhotoAcquireItem pPhotoAcquireItem);
///
/// The method provides extended functionality when the percentage of items deleted changes. The application provides the
/// implementation of the method.
///
/// Integer value containing the percentage of items deleted.
///
///
/// The method returns an HRESULT. Your implementation is not limited to the following return values. Any failing HRESULT
/// other than E_NOTIMPL is fatal and will cause the transfer to abort.
///
///
///
/// Return code
/// Description
///
/// -
/// S_OK
/// The method succeeded.
///
/// -
/// E_NOTIMPL
/// The method is not implemented
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/nf-photoacquire-iphotoacquireprogresscb-updatedeletepercent
// HRESULT UpdateDeletePercent( [in] UINT nPercent );
[PreserveSig]
HRESULT UpdateDeletePercent([In] uint nPercent);
///
/// The method provides extended functionality each time a file is deleted from the image source. The application provides the
/// implementation of the method.
///
/// Integer value containing the item index.
/// Pointer to the deleted IPhotoAcquireItem object.
/// Specifies the result of the delete operation.
///
///
/// The method returns an HRESULT. Your implementation is not limited to the following return values. Any failing HRESULT
/// other than E_NOTIMPL is fatal and will cause the transfer to abort.
///
///
///
/// Return code
/// Description
///
/// -
/// S_OK
/// The method succeeded.
///
/// -
/// E_NOTIMPL
/// This method is not yet implemented
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/nf-photoacquire-iphotoacquireprogresscb-enditemdelete HRESULT
// EndItemDelete( [in] UINT nItemIndex, [in] IPhotoAcquireItem *pPhotoAcquireItem, [in] HRESULT hr );
[PreserveSig]
HRESULT EndItemDelete([In] uint nItemIndex, [In, Optional, MarshalAs(UnmanagedType.Interface)] IPhotoAcquireItem pPhotoAcquireItem, HRESULT hr);
///
/// The method provides extended functionality when deletion of files from the image source is complete. The application provides the
/// implementation of the method.
///
/// Specifies the result of the delete operation.
///
///
/// The method returns an HRESULT. Your implementation is not limited to the following return values. Any failing HRESULT
/// other than E_NOTIMPL is fatal and will cause the transfer to abort.
///
///
///
/// Return code
/// Description
///
/// -
/// S_OK
/// The method succeeded.
///
/// -
/// E_NOTIMPL
/// The method is not yet implemented
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/nf-photoacquire-iphotoacquireprogresscb-enddelete HRESULT
// EndDelete( [in] HRESULT hr );
[PreserveSig]
HRESULT EndDelete(HRESULT hr);
///
/// The method provides extended functionality when an acquisition session is completed. The application provides the implementation
/// of the method.
///
/// Specifies the result of the acquisition.
///
///
/// The method returns an HRESULT. Your implementation is not limited to the following return values. Any failing HRESULT
/// other than E_NOTIMPL is fatal and will cause the transfer to abort.
///
///
///
/// Return code
/// Description
///
/// -
/// S_OK
/// The method succeeded.
///
/// -
/// E_NOTIMPL
/// The method is not yet implemented
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/nf-photoacquire-iphotoacquireprogresscb-endsession HRESULT
// EndSession( [in] HRESULT hr );
[PreserveSig]
HRESULT EndSession(HRESULT hr);
/// The method returns a value indicating whether photos should be deleted after acquisition.
///
/// Pointer to a flag that, when set to , indicates that photos should be deleted after acquisition.
///
///
///
/// The method returns an HRESULT. Your implementation is not limited to the following return values. Any failing HRESULT
/// other than E_NOTIMPL is fatal and will cause the transfer to abort.
///
///
///
/// Return code
/// Description
///
/// -
/// S_OK
/// The method succeeded.
///
/// -
/// E_NOTIMPL
/// The method is not yet implemented
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/nf-photoacquire-iphotoacquireprogresscb-getdeleteafteracquire
// HRESULT GetDeleteAfterAcquire( [out] BOOL *pfDeleteAfterAcquire );
[PreserveSig]
HRESULT GetDeleteAfterAcquire([MarshalAs(UnmanagedType.Bool)] out bool pfDeleteAfterAcquire);
///
/// The method provides custom error handling for errors that occur during acquisition. The application provides the implementation
/// of the method.
///
/// Specifies the error that occurred.
/// A string containing the error message.
///
/// Integer value containing the message type. May be one of the following.
///
///
/// Value
/// Description
///
/// -
/// PHOTOACQUIRE_ERROR_SKIPRETRYCANCEL
///
/// Specifies that the error that occurred requires a Skip, Retry, or Cancel response. The pnErrorAdviseResult parameter must
/// be set to one of the following: PHOTOACQUIRE_RESULT_SKIP, PHOTOACQUIRE_RESULT_SKIP_ALL,
/// PHOTOACQUIRE_RESULT_RETRY, or PHOTOACQUIRE_RESULT_ABORT.
///
///
/// -
/// PHOTOACQUIRE_ERROR_RETRYCANCEL
///
/// Specifies that the error that occurred requires a Retry or Cancel response. The pnErrorAdviseResult parameter must be set
/// to one of the following: PHOTOACQUIRE_RESULT_RETRY or PHOTOACQUIRE_RESULT_ABORT.
///
///
/// -
/// PHOTOACQUIRE_ERROR_YESNO
///
/// Specifies that the error that occurred requires a Yes or No response. The pnErrorAdviseResult parameter must be set to one
/// of the following: PHOTOACQUIRE_RESULT_YES or PHOTOACQUIRE_RESULT_NO.
///
///
/// -
/// PHOTOACQUIRE_ERROR_OK
///
/// Specifies that the error that occurred requires an OK response. The pnErrorAdviseResult parameter must be set to PHOTOACQUIRE_RESULT_OK.
///
///
///
///
///
///
/// Pointer to an integer value containing the error advise result. The result should be one of the acceptable types indicated by the
/// nMessageType parameter, and must be one of the following:
///
///
///
/// Value
/// Description
///
/// -
/// PHOTOACQUIRE_RESULT_YES
/// Specifies a Yes response. Valid if nMessageType is PHOTOACQUIRE_ERROR_YESNO.
///
/// -
/// PHOTOACQUIRE_RESULT_NO
/// Specifies a No response. Valid if nMessageType is PHOTOACQUIRE_ERROR_YESNO.
///
/// -
/// PHOTOACQUIRE_RESULT_OK
/// Specifies an OK response. Valid if nMessageType is PHOTOACQUIRE_ERROR_OK.
///
/// -
/// PHOTOACQUIRE_RESULT_SKIP
/// Specifies a Skip response. Valid if nMessageType is PHOTOACQUIRE_ERROR_SKIPRETRYCANCEL.
///
/// -
/// PHOTOACQUIRE_RESULT_SKIP_ALL
/// Specifies a Skip All response. Valid if nMessageType is PHOTOACQUIRE_ERROR_SKIPRETRYCANCEL.
///
/// -
/// PHOTOACQUIRE_RESULT_RETRY
/// Specifies a Retry response. Valid if nMessageType is PHOTOACQUIRE_ERROR_SKIPRETRYCANCEL or PHOTOACQUIRE_ERROR_RETRYCANCEL.
///
/// -
/// PHOTOACQUIRE_RESULT_ABORT
/// Specifies a Cancel response. Valid if nMessageType is PHOTOACQUIRE_ERROR_SKIPRETRYCANCEL or PHOTOACQUIRE_ERROR_RETRYCANCEL.
///
///
///
///
///
/// The method returns an HRESULT. Your implementation is not limited to the following return values. Any failing HRESULT
/// other than E_NOTIMPL is fatal and will cause the transfer to abort.
///
///
///
/// Return code
/// Description
///
/// -
/// S_OK
/// The method succeeded.
///
/// -
/// E_NOTIMPL
/// The method is not yet implemented
///
///
///
///
/// Normally, a message is displayed when an error occurs during image acquisition. If suppression of this message is desired,
/// implement .
///
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/nf-photoacquire-iphotoacquireprogresscb-erroradvise HRESULT
// ErrorAdvise( [in] HRESULT hr, [in] LPCWSTR pszErrorMessage, [in] ERROR_ADVISE_MESSAGE_TYPE nMessageType, [out] ERROR_ADVISE_RESULT
// *pnErrorAdviseResult );
[PreserveSig]
HRESULT ErrorAdvise(HRESULT hr, [In, MarshalAs(UnmanagedType.LPWStr)] string pszErrorMessage, [In] ERROR_ADVISE_MESSAGE_TYPE nMessageType,
out ERROR_ADVISE_RESULT pnErrorAdviseResult);
///
/// The method overrides the default functionality that displays a message prompting the user for string input during acquisition.
/// The application provides the implementation of the method.
///
/// Specifies the interface ID of the prompt type. This may only be IID_IUserInputString.
/// Pointer to an object of the prompt class. Currently, this must be an IUserInputString object.
///
///
/// Pointer to a property variant object representing the descriptive input to be obtained. Must be freed by the caller using PropVariantClear.
///
///
/// If the application's implementation of returns a value other than E_NOTIMPL, the value of pPropVarDefault must be copied
/// to the pPropVarResult parameter.
///
///
/// Pointer to a property variant object representing the default value of the input being requested.
///
///
/// The method returns an HRESULT. Your implementation is not limited to the following return values. Any failing HRESULT
/// other than E_NOTIMPL is fatal and will cause the transfer to abort.
///
///
///
/// Return code
/// Description
///
/// -
/// S_OK
/// The method succeeded.
///
/// -
/// E_NOTIMPL
/// Return E_NOTIMPL if the default functionality is desired
///
///
///
///
///
/// If this method is implemented, the implementation should copy the value of the pPropVarDefault argument to the
/// pPropVarResult parameter.
///
/// If this method returns an HRESULT other than E_NOTIMPL, the default dialog box that prompts the user will not be displayed.
///
/// If the progress dialog box is suppressed in IPhotoAcquire::Acquire, this method must be implemented in order to assign a default
/// value to the pPropVarResult parameter. Normally a value is supplied to pPropVarResult in the course of prompting
/// the user with the default dialog, but when the dialog is suppressed, the application must copy the value of the
/// pPropVarDefault argument to the pPropVarResult parameter.
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/nf-photoacquire-iphotoacquireprogresscb-getuserinput HRESULT
// GetUserInput( [in] REFIID riidType, [in] IUnknown *pUnknown, [out] PROPVARIANT *pPropVarResult, [in] const PROPVARIANT
// *pPropVarDefault );
[PreserveSig]
HRESULT GetUserInput(in Guid riidType, [In, Optional, MarshalAs(UnmanagedType.IUnknown, IidParameterIndex = 0)] object pUnknown,
[Out] PROPVARIANT pPropVarResult, [In, Optional] PROPVARIANT pPropVarDefault);
}
/// The interface is used to work with image acquisition settings, such as file name format.
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/nn-photoacquire-iphotoacquiresettings
[PInvokeData("photoacquire.h", MSDNShortId = "NN:photoacquire.IPhotoAcquireSettings")]
[ComImport, Guid("00F2B868-DD67-487C-9553-049240767E91"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IPhotoAcquireSettings
{
/// The method specifies a registry key from which to initialize settings.
/// A string containing the registry key.
/// The structure of the registry has not yet been determined at this point.
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/nf-photoacquire-iphotoacquiresettings-initializefromregistry
// HRESULT InitializeFromRegistry( [in] LPCWSTR pszRegistryKey );
void InitializeFromRegistry([In, MarshalAs(UnmanagedType.LPWStr)] string pszRegistryKey);
/// The method sets the photo acquire flags.
/// Double word value containing the photo acquire flags.
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/nf-photoacquire-iphotoacquiresettings-setflags HRESULT SetFlags(
// [in] DWORD dwPhotoAcquireFlags );
void SetFlags([In] PHOTOACQ dwPhotoAcquireFlags);
/// The method specifies a format string (template) that specifies the format of file names.
/// A string containing the format string.
///
/// Format strings contain a mix of path literals and tokens. A format string looks like the following:
/// $(MyPicturesFolder)\$(DateAcquired), $(EventName)\$(EventName) $(SequenceNumber).$(OriginalExtension)
/// The token format looks like the following, where and are suppressed if the replacement for the yields a zero-length string:
/// $([OptionalPrefix]TokenIdentifier:SubToken[OptionalSuffix]|AlternateString)
/// The caret ("^") is an escape character, so "^$" would yield "$" in the final path.
///
/// Parentheses and brackets are not allowed as literals within tokens, but can be used outside of tokens. This means you cannot use
/// "[", "]", "(", or ")" within the sub-token unless they are escaped with a caret ("^").
///
/// There are a few different classes of tokens, including the following:
/// SHGetSpecialFolder variables such as the following. These must be the first token, and can only occur once, at most:
///
/// - MyPicturesFolder
/// - MyDocumentsFolder
///
/// Session variables such as the following:
///
/// -
/// SequenceNumber (The sequence number is used to avoid filename collisions; if it exists, it must be in the file name
/// portion of the path.) -
///
/// - DateAcquired
/// - EventName
/// - UserName
/// - MachineName
///
/// File and metadata variables such as the following:
///
/// - DateTaken
/// - OriginalFilename
/// - OriginalExtension
/// - CameraModel
/// - Width
/// - Height
///
///
/// Since these tokens are not intended to be visible to users, they will not be localized. For example, $(DateTaken) will be
/// the same on all versions of Microsoft Windows, regardless of locale or language settings.
///
/// As an example, suppose EventName is "Meghan's Birthday" and the naming pattern is as follows:
/// The resulting files would be named as follows:
/// $(MyPicturesFolder)\$(DateAcquired)$([, ]EventName)\$(EventName[ ])$(SequenceNumber).$(OriginalExtension)
/// C:\Documents and Settings\shauniv\My Documents\My Pictures\2003-11-14, Meghan's Birthday\Meghan's Birthday 001.jpg
/// C:\Documents and Settings\shauniv\My Documents\My Pictures\2003-11-14, Meghan's Birthday\Meghan's Birthday 002.jpg
/// C:\Documents and Settings\shauniv\My Documents\My Pictures\2003-11-14, Meghan's Birthday\Meghan's Birthday 003.jpg
/// C:\Documents and Settings\shauniv\My Documents\My Pictures\2003-11-14, Meghan's Birthday\Meghan's Birthday 004.jpg
///
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/nf-photoacquire-iphotoacquiresettings-setoutputfilenametemplate
// HRESULT SetOutputFilenameTemplate( [in] LPCWSTR pszTemplate );
void SetOutputFilenameTemplate([In, MarshalAs(UnmanagedType.LPWStr)] string pszTemplate);
/// The method sets a value indicating how wide sequential fields in filenames will be.
/// Double word value containing the width of sequential fields.
///
///
/// If the value passed to is nonzero and the format string specified in SetOutputFileNameTemplate contains a sequential token, this
/// method sets the width allotted for the sequential token. For example, given the template , if padding is set to 0, a file name
/// might appear as
///
/// If padding is set to 3, the file name may appear as
///
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/nf-photoacquire-iphotoacquiresettings-setsequencepaddingwidth
// HRESULT SetSequencePaddingWidth( [in] DWORD dwWidth );
void SetSequencePaddingWidth([In] uint dwWidth);
/// The method sets a value indicating whether zeros or spaces are used to pad sequential file names.
/// Flag that, if set to , indicates that zeros pad sequential file names.
///
/// A file name padded with zeros might appear as
/// The same file name without zero padding might appear as
///
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/nf-photoacquire-iphotoacquiresettings-setsequencezeropadding
// HRESULT SetSequenceZeroPadding( [in] BOOL fZeroPad );
void SetSequenceZeroPadding([In, MarshalAs(UnmanagedType.Bool)] bool fZeroPad);
/// The method sets the group tag for an acquisition session.
/// A string containing the group tag.
///
/// The group tag is stored as a keyword in each file's metadata. It is also used in the file name if the token is present in the
/// format string passed to SetOutputFileNameTemplate.
///
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/nf-photoacquire-iphotoacquiresettings-setgrouptag HRESULT
// SetGroupTag( [in] LPCWSTR pszGroupTag );
void SetGroupTag([In, MarshalAs(UnmanagedType.LPWStr)] string pszGroupTag);
/// The method sets the acquisition time explicitly.
/// Specifies the acquisition time.
///
/// This method is typically used to force two sessions to show the same acquisition time. If not explicitly set, acquisition time
/// defaults to the current machine time.
///
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/nf-photoacquire-iphotoacquiresettings-setacquisitiontime HRESULT
// SetAcquisitionTime( [in] const FILETIME *pftAcquisitionTime );
void SetAcquisitionTime(in FILETIME pftAcquisitionTime);
/// The method retrieves the photo acquire flags.
/// Pointer to a double word value containing the photo acquire flags.
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/nf-photoacquire-iphotoacquiresettings-getflags HRESULT GetFlags(
// [out] DWORD *pdwPhotoAcquireFlags );
PHOTOACQ GetFlags();
/// The method retrieves a format string (template) that specifies the format of file names.
/// Pointer to a string containing the format string.
/// Format strings contain a mix of path literals and tokens. A format string looks like the following:
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/nf-photoacquire-iphotoacquiresettings-getoutputfilenametemplate
// HRESULT GetOutputFilenameTemplate( [out] BSTR *pbstrTemplate );
[return: MarshalAs(UnmanagedType.BStr)]
string? GetOutputFilenameTemplate();
/// The method retrieves a value indicating how wide sequential fields in file names will be.
/// Pointer to a double word value containing the width of sequential fields.
///
///
/// If the format string specified in SetOutputFileNameTemplate contains a sequential token, this method gets the width allotted for
/// the sequential token.
///
/// If the format string does not contain a sequential token, the value returned by this method is not defined.
///
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/nf-photoacquire-iphotoacquiresettings-getsequencepaddingwidth
// HRESULT GetSequencePaddingWidth( [out] DWORD *pdwWidth );
uint GetSequencePaddingWidth();
/// The method retrieves a value that indicates whether zeros or spaces will be used to pad sequential file names.
/// Pointer to a flag that, if set to , indicates that zeros will pad sequential file names.
///
/// A file name padded with zeros might appear as
/// The same file name without zero padding might appear as
///
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/nf-photoacquire-iphotoacquiresettings-getsequencezeropadding
// HRESULT GetSequenceZeroPadding( [out] BOOL *pfZeroPad );
[return: MarshalAs(UnmanagedType.Bool)]
bool GetSequenceZeroPadding();
/// The method retrieves a tag string for the group of files being downloaded from the device.
/// Pointer to a string containing the group tag.
///
/// The group tag is stored as a keyword in each file's metadata. It is also used in the file name if the token is present in the
/// format string passed to SetOutputFileNameTemplate.
///
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/nf-photoacquire-iphotoacquiresettings-getgrouptag HRESULT
// GetGroupTag( [out] BSTR *pbstrGroupTag );
[return: MarshalAs(UnmanagedType.BStr)]
string? GetGroupTag();
/// The method retrieves the acquisition time of the current session.
/// Specifies acquisition time.
/// If not set explicitly, the acquisition time defaults to the current machine time.
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/nf-photoacquire-iphotoacquiresettings-getacquisitiontime HRESULT
// GetAcquisitionTime( [out] FILETIME *pftAcquisitionTime );
FILETIME GetAcquisitionTime();
}
/// The interface is used for acquisition of items from a device.
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/nn-photoacquire-iphotoacquiresource
[PInvokeData("photoacquire.h", MSDNShortId = "NN:photoacquire.IPhotoAcquireSource")]
[ComImport, Guid("00F2C703-8613-4282-A53B-6EC59C5883AC"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IPhotoAcquireSource
{
/// The method retrieves the name of the device, formatted for display.
/// Pointer to a string containing the friendly name.
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/nf-photoacquire-iphotoacquiresource-getfriendlyname HRESULT
// GetFriendlyName( [out] BSTR *pbstrFriendlyName );
[return: MarshalAs(UnmanagedType.BStr)]
string? GetFriendlyName();
/// The method retrieves the icons that are used to represent the device.
/// Integer value containing the size of the icon to retrieve.
/// Specifies the large icon used for the device.
/// Specifies the small icon used for the device.
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/nf-photoacquire-iphotoacquiresource-getdeviceicons HRESULT
// GetDeviceIcons( [in] UINT nSize, [out] HICON *phLargeIcon, [out] HICON *phSmallIcon );
void GetDeviceIcons([In] uint nSize, out SafeHICON? phLargeIcon, out SafeHICON? phSmallIcon);
///
/// The InitializeItemList method enumerates transferable items on the device and passes each item to the optional progress callback,
/// if it is supplied.
///
///
/// Flag that, if set to , indicates that enumeration will be repeated even if the item list has already been
/// initialized. If set to FALSE, this flag indicates that repeated calls to after the item list has already been initialized
/// will not enumerate items again.
///
/// Optional. Pointer to an IPhotoAcquireProgressCB object.
/// Returns the number of items found.
///
/// If IPhotoAcquire::Acquire is called without first calling InitializeItemList, initialization of the item list is done implicitly.
///
/// The first time the item list is initialized—either implicitly through IPhotoAcquire::Acquire or explicitly by calling
/// InitializeItemList—each item is enumerated. During enumeration, if an IPhotoAcquireProgressCB object is passed to
/// InitializeItemList, its implementation of StartEnumeration, FoundItem, and EndEnumeration may be used to apply further filtering
/// or control to the list of items to be transferred.
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/nf-photoacquire-iphotoacquiresource-initializeitemlist HRESULT
// InitializeItemList( [in] BOOL fForceEnumeration, [in] IPhotoAcquireProgressCB *pPhotoAcquireProgressCB, [out] UINT *pnItemCount );
void InitializeItemList([In, MarshalAs(UnmanagedType.Bool)] bool fForceEnumeration,
[In, Optional, MarshalAs(UnmanagedType.Interface)] IPhotoAcquireProgressCB pPhotoAcquireProgressCB, out uint pnItemCount);
/// The method retrieves the number of items found by the InitializeItemList method.
/// Pointer to an integer value containing the item count.
/// Before calling this method, call InitializeItemList to initialize the item list.
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/nf-photoacquire-iphotoacquiresource-getitemcount HRESULT
// GetItemCount( [out] UINT *pnItemCount );
uint GetItemCount();
/// The method retrieves the IPhotoAcquireItem object at the given index in the list of items.
/// Integer value containing the index.
/// Pointer to the address of an IPhotoAcquireItem object.
/// Before calling this method, call InitializeItemList to initialize the item list.
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/nf-photoacquire-iphotoacquiresource-getitemat HRESULT GetItemAt(
// [in] UINT nIndex, [out] IPhotoAcquireItem **ppPhotoAcquireItem );
IPhotoAcquireItem? GetItemAt([In] uint nIndex);
/// The method obtains an IPhotoAcquireSettings object for working with acquisition settings.
/// Pointer to the address of a photo acquire settings object.
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/nf-photoacquire-iphotoacquiresource-getphotoacquiresettings
// HRESULT GetPhotoAcquireSettings( [out] IPhotoAcquireSettings **ppPhotoAcquireSettings );
IPhotoAcquireSettings? GetPhotoAcquireSettings();
/// The method retrieves the identifier (ID) of the device.
/// Pointer to a string containing the device ID.
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/nf-photoacquire-iphotoacquiresource-getdeviceid HRESULT
// GetDeviceId( [out] BSTR *pbstrDeviceId );
[return: MarshalAs(UnmanagedType.BStr)]
string? GetDeviceId();
/// Binds to object.
/// The IID of the object to which to bind.
/// The interface instance requested.
[return: MarshalAs(UnmanagedType.IUnknown, IidParameterIndex = 0)]
object? BindToObject(in Guid riid);
}
/// Implement this interface to get process from an .
[ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("00F242D0-B206-4E7D-B4C1-4755BCBB9C9F")]
public interface IPhotoProgressActionCB
{
/// Does the action.
/// The parent window handle.
/// S_OK on success.
[PreserveSig]
HRESULT DoAction(HWND hWndParent);
}
///
/// Provides the progress dialog box that may be displayed when enumerating or importing images. The dialog box is modal and runs in its
/// own thread.
///
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/nn-photoacquire-iphotoprogressdialog
[PInvokeData("photoacquire.h", MSDNShortId = "NN:photoacquire.IPhotoProgressDialog")]
[ComImport, Guid("00F246F9-0750-4F08-9381-2CD8E906A4AE"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown), CoClass(typeof(PhotoProgressDialog))]
public interface IPhotoProgressDialog
{
/// The method creates and displays a progress dialog box that can be shown during image enumeration and acquisition.
/// Handle of the parent window.
///
/// The dialog box that is created is modal, and runs in its own thread.
/// To close the dialog, call Destroy.
///
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/nf-photoacquire-iphotoprogressdialog-create HRESULT Create( [in]
// HWND hwndParent );
void Create([In] HWND hWndParent);
/// The method retrieves the handle to the progress dialog box.
/// Specifies the handle to the progress dialog box.
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/nf-photoacquire-iphotoprogressdialog-getwindow HRESULT GetWindow(
// [out] HWND *phwndProgressDialog );
HWND GetWindow();
/// The method closes and disposes of the progress dialog box shown during image enumeration and acquisition.
///
/// Calling is the only way to close the progress dialog box. If is not called, the dialog box will remain open. The dialog box is
/// not automatically closed when the operation in progress completes.
///
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/nf-photoacquire-iphotoprogressdialog-destroy HRESULT Destroy();
void Destroy();
/// The method sets the title of the progress dialog box.
/// A string containing the title.
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/nf-photoacquire-iphotoprogressdialog-settitle HRESULT SetTitle(
// [in] LPCWSTR pszTitle );
void SetTitle([In, MarshalAs(UnmanagedType.LPWStr)] string pszTitle);
///
/// The method indicates whether to show the check box in the progress dialog box indicating whether to delete images after transfer.
///
/// Integer containing the check box identifier (ID).
/// Flag that, when set to , indicates that the check box will appear.
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/nf-photoacquire-iphotoprogressdialog-showcheckbox HRESULT
// ShowCheckbox( [in] PROGRESS_DIALOG_CHECKBOX_ID nCheckboxId, [in] BOOL fShow );
void ShowCheckbox([In] PROGRESS_DIALOG_CHECKBOX_ID nCheckboxId, [In, MarshalAs(UnmanagedType.Bool)] bool fShow);
/// The method sets the text for the check box in the progress dialog box indicating whether to delete images after transfer.
/// Integer containing the check box identifier (ID).
/// A string containing the check box text.
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/nf-photoacquire-iphotoprogressdialog-setcheckboxtext HRESULT
// SetCheckboxText( [in] PROGRESS_DIALOG_CHECKBOX_ID nCheckboxId, [in] LPCWSTR pszCheckboxText );
void SetCheckboxText([In] PROGRESS_DIALOG_CHECKBOX_ID nCheckboxId, [In, MarshalAs(UnmanagedType.LPWStr)] string pszCheckboxText);
/// The method sets the text for the check box in the progress dialog box indicating whether to delete images after transfer.
/// Integer containing the check box identifier (ID).
/// Flag that, when set to , indicates that the check box will appear checked.
void SetCheckboxCheck([In] PROGRESS_DIALOG_CHECKBOX_ID nCheckboxId, [In, MarshalAs(UnmanagedType.Bool)] bool fChecked);
/// The method sets the tooltip text for the check box in the progress dialog box.
/// Integer containing the check box identifier (ID).
/// A string containing the check box tooltip text.
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/nf-photoacquire-iphotoprogressdialog-setcheckboxtooltip HRESULT
// SetCheckboxTooltip( [in] PROGRESS_DIALOG_CHECKBOX_ID nCheckboxId, [in] LPCWSTR pszCheckboxTooltipText );
void SetCheckboxTooltip([In] PROGRESS_DIALOG_CHECKBOX_ID nCheckboxId, [In, MarshalAs(UnmanagedType.LPWStr)] string pszCheckboxTooltipText);
///
/// The method indicates whether the check box in the progress dialog box (typically indicating whether to delete files after
/// transfer) is selected.
///
/// Integer value containing the check box identifier (ID).
/// Pointer to a flag that, if set to , indicates that the check box is selected.
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/nf-photoacquire-iphotoprogressdialog-ischeckboxchecked HRESULT
// IsCheckboxChecked( [in] PROGRESS_DIALOG_CHECKBOX_ID nCheckboxId, [out] BOOL *pfChecked );
[return: MarshalAs(UnmanagedType.Bool)]
bool IsCheckboxChecked([In] PROGRESS_DIALOG_CHECKBOX_ID nCheckboxId);
/// Sets the caption of the progress dialog box.
/// A string containing the title of the progress dialog box.
/// The caption text is displayed above the progress indicator bar in the dialog box.
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/nf-photoacquire-iphotoprogressdialog-setcaption HRESULT
// SetCaption( [in] LPCWSTR pszTitle );
void SetCaption([In, MarshalAs(UnmanagedType.LPWStr)] string pszTitle);
///
/// Sets either the thumbnail image displayed in the progress dialog box, the icon in the title bar of the progress dialog box, or
/// the icon in ALT+TAB key combination windows.
///
///
///
/// Integer value indicating the image type to set. Only one type of image type may be set at a time. The values passed to this
/// parameter should not be considered a bit field and may not be combined with bitwise OR.
///
///
///
/// Value
/// Meaning
///
/// -
/// PROGRESS_DIALOG_ICON_SMALL
/// The small icon used in the title bar (normally 16 x 16 pixels).
///
/// -
/// PROGRESS_DIALOG_ICON_LARGE
/// The icon used to represent the progress dialog box in Alt-Tab windows (normally 32 x 32 pixels).
///
/// -
/// PROGRESS_DIALOG_ICON_THUMBNAIL
/// An icon used in place of the thumbnail (up to 128 x 128 pixels).
///
/// -
/// PROGRESS_DIALOG_BITMAP_THUMBNAIL
/// A bitmap thumbnail (up to 128 x 128 pixels, although it will be scaled to fit if it is too large).
///
///
///
/// Handle to an icon object.
/// Handle to a bitmap object representing the thumbnail image.
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/nf-photoacquire-iphotoprogressdialog-setimage HRESULT SetImage(
// [in] PROGRESS_DIALOG_IMAGE_TYPE nImageType, [in] HICON hIcon, [in] HBITMAP hBitmap );
void SetImage([In] PROGRESS_DIALOG_IMAGE_TYPE nImageType, [In, Optional] HICON hIcon, [In, Optional] HBITMAP hBitmap);
/// The method sets a value indicating the completed portion of the current operation.
///
/// Integer value indicating the percentage of the operation that has completed. This value may be between 0 and 100 only.
///
///
/// If you pass PROGRESS_INDETERMINATE to , the progress bar will not progress from left to right (from 0 to 100%), but will instead
/// animate to indicate that an operation with an indeterminate end is taking place.
///
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/nf-photoacquire-iphotoprogressdialog-setpercentcomplete HRESULT
// SetPercentComplete( [in] int nPercent );
void SetPercentComplete([In] int nPercent);
/// The method sets the text for the progress bar in the progress dialog box.
/// A string containing the progress text.
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/nf-photoacquire-iphotoprogressdialog-setprogresstext HRESULT
// SetProgressText( [in] LPCWSTR pszProgressText );
void SetProgressText([In, MarshalAs(UnmanagedType.LPWStr)] string pszProgressText);
/// Sets the action link callback.
///
/// A reference to a derived class that responds to the action link click.
///
void SetActionLinkCallback([In, Optional, MarshalAs(UnmanagedType.Interface)] IPhotoProgressActionCB pPhotoProgressActionCB);
/// The method sets the text for the action link in the progress dialog box.
/// A string containing the action link text.
void SetActionLinkText([In, MarshalAs(UnmanagedType.LPWStr)] string pszCaption);
/// The method indicates whether to show the action link in the progress dialog box.
/// Flag that, when set to , indicates that the action link will appear.
void ShowActionLink([In, MarshalAs(UnmanagedType.Bool)] bool fShow);
/// The method indicates whether the operation has been canceled via the progress dialog box.
/// Pointer to a flag that, if set to , indicates the action has been canceled.
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/nf-photoacquire-iphotoprogressdialog-iscancelled HRESULT
// IsCancelled( [out] BOOL *pfCancelled );
[return: MarshalAs(UnmanagedType.Bool)]
bool IsCancelled();
/// Retrieves descriptive information entered by the user, such as the tag name of the images to store.
/// Specifies the interface identifier (ID) of the prompt type. Currently, the only supported value is IID_IUserInputString.
/// Pointer to an object of the prompt class. Currently, the only supported type is IUserInputString.
/// Pointer to a property variant that stores the user input. Must be freed by the caller using ClearPropVariant.
/// Pointer to a property variant containing the default value to be used if no input is supplied.
///
/// If the progress dialog box has been suppressed in IPhotoAcquire::Acquire, and IPhotoAcquireProgressCB::GetUserInput is either not
/// implemented, or returns E_NOTIMPL, this method will return S_FALSE, and pPropVarResult will contain the value stored in
/// the optional pPropVarDefault argument.
///
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/nf-photoacquire-iphotoprogressdialog-getuserinput HRESULT
// GetUserInput( [in] REFIID riidType, [in] IUnknown *pUnknown, [out] PROPVARIANT *pPropVarResult, [in] const PROPVARIANT
// *pPropVarDefault );
[PreserveSig]
HRESULT GetUserInput(in Guid riidType, [In, Optional, MarshalAs(UnmanagedType.IUnknown, IidParameterIndex = 0)] object pUnknown,
[Out] PROPVARIANT pPropVarResult, [In, Optional] PROPVARIANT pPropVarDefault);
}
/// Retrieves descriptive information entered by the user, such as the tag name of the images to store.
/// The instance.
/// Pointer to an object of the prompt class. Currently, the only supported type is IUserInputString.
/// The default value to be used if no input is supplied.
/// The user input value, or on error.
/// dlg
///
/// If the progress dialog box has been suppressed in IPhotoAcquire::Acquire, and IPhotoAcquireProgressCB::GetUserInput is either not
/// implemented, or returns E_NOTIMPL, this method will return S_FALSE, and pPropVarResult will contain the value stored in the
/// optional pPropVarDefault argument.
///
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/nf-photoacquire-iphotoprogressdialog-getuserinput HRESULT
// GetUserInput( [in] REFIID riidType, [in] IUnknown *pUnknown, [out] PROPVARIANT *pPropVarResult, [in] const PROPVARIANT
// *pPropVarDefault );
[PreserveSig]
public static string? GetUserInput(this IPhotoProgressDialog dlg, [In, Optional] IUserInputString pUnknown, [In, Optional] string? pPropVarDefault)
{
if (dlg == null) throw new ArgumentNullException(nameof(dlg));
using PROPVARIANT res = new();
using PROPVARIANT def = pPropVarDefault is null ? new() : new(pPropVarDefault, VarEnum.VT_BSTR);
return dlg.GetUserInput(typeof(IUserInputString).GUID, pUnknown, res, def) == HRESULT.S_OK ? res.bstrVal : null;
}
///
/// The IUserInputString interface represents the object created when asking the user for a string—for example, when obtaining the
/// name of a tag.
///
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/nn-photoacquire-iuserinputstring
[PInvokeData("photoacquire.h", MSDNShortId = "NN:photoacquire.IUserInputString")]
[ComImport, Guid("00f243a1-205b-45ba-ae26-abbc53aa7a6f"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IUserInputString
{
/// The method retrieves the text for the submit button.
/// Pointer to a string containing the submit button text.
///
/// The method returns an HRESULT. Possible values include, but are not limited to, those in the following table.
///
///
/// Return code
/// Description
///
/// -
/// S_OK
/// The method succeeded.
///
/// -
/// E_POINTER
/// A NULL pointer was passed where a non- NULL pointer is expected.
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/nf-photoacquire-iuserinputstring-getsubmitbuttontext HRESULT
// GetSubmitButtonText( [out] BSTR *pbstrSubmitButtonText );
[PreserveSig]
HRESULT GetSubmitButtonText([MarshalAs(UnmanagedType.BStr)] out string? pbstrSubmitButtonText);
/// The method retrieves the title of a prompt if the prompt is a modal dialog box.
/// Pointer to a string containing the title of the prompt.
///
/// The method returns an HRESULT. Possible values include, but are not limited to, those in the following table.
///
///
/// Return code
/// Description
///
/// -
/// S_OK
/// The method succeeded.
///
/// -
/// E_POINTER
/// A NULL pointer was passed where a non- NULL pointer is expected.
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/nf-photoacquire-iuserinputstring-getprompt HRESULT GetPrompt(
// [out] BSTR *pbstrPromptTitle );
[PreserveSig]
HRESULT GetPrompt([MarshalAs(UnmanagedType.BStr)] out string? pbstrPromptTitle);
///
/// The GetStringId method retrieves the unlocalized canonical name for the requested string. For example, when requesting a
/// tag name, the canonical name might be "TagName".
///
/// Pointer to a string containing the string identifier (ID).
///
/// The method returns an HRESULT. Possible values include, but are not limited to, those in the following table.
///
///
/// Return code
/// Description
///
/// -
/// S_OK
/// The method succeeded.
///
/// -
/// E_POINTER
/// A NULL pointer was passed where a non- NULL pointer is expected.
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/nf-photoacquire-iuserinputstring-getstringid HRESULT GetStringId(
// [out] BSTR *pbstrStringId );
[PreserveSig]
HRESULT GetStringId([MarshalAs(UnmanagedType.BStr)] out string? pbstrStringId);
/// The method retrieves a value indicating the type of string to obtain from the user.
///
/// Pointer to an integer value containing the string type.
///
///
/// Value
/// Description
///
/// -
/// USER_INPUT_DEFAULT
/// Specifies that any string is allowed.
///
/// -
/// USER_INPUT_PATH_ELEMENT
/// Specifies that the string will not accept characters that are illegal in file or directory names (such as * or /).
///
///
///
///
/// The method returns an HRESULT. Possible values include, but are not limited to, those in the following table.
///
///
/// Return code
/// Description
///
/// -
/// S_OK
/// The method succeeded.
///
/// -
/// E_POINTER
/// A NULL pointer was passed where a non- NULL pointer is expected.
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/nf-photoacquire-iuserinputstring-getstringtype HRESULT
// GetStringType( [out] USER_INPUT_STRING_TYPE *pnStringType );
[PreserveSig]
HRESULT GetStringType(out USER_INPUT_STRING_TYPE pnStringType);
/// The method retrieves the tooltip text displayed for a control.
/// Pointer to a string containing the tooltip text.
///
/// The method returns an HRESULT. Possible values include, but are not limited to, those in the following table.
///
///
/// Return code
/// Description
///
/// -
/// S_OK
/// The method succeeded.
///
/// -
/// E_POINTER
/// A NULL pointer was passed where a non- NULL pointer is expected.
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/nf-photoacquire-iuserinputstring-gettooltiptext HRESULT
// GetTooltipText( [out] BSTR *pbstrTooltipText );
[PreserveSig]
HRESULT GetTooltipText([MarshalAs(UnmanagedType.BStr)] out string? pbstrTooltipText);
/// The method retrieves the maximum string length the user interface (UI) should allow.
/// Pointer to the size of the maximum string length in characters.
///
/// The method returns an HRESULT. Possible values include, but are not limited to, those in the following table.
///
///
/// Return code
/// Description
///
/// -
/// S_OK
/// The method succeeded.
///
/// -
/// E_POINTER
/// A NULL pointer was passed where a non- NULL pointer is expected.
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/nf-photoacquire-iuserinputstring-getmaxlength HRESULT
// GetMaxLength( [out] UINT *pcchMaxLength );
[PreserveSig]
HRESULT GetMaxLength(out uint pcchMaxLength);
/// The method retrieves the default string used to initialize an edit control (or equivalent).
/// Pointer to a string containing the default value used to initialize the edit control.
///
/// The method returns an HRESULT. Possible values include, but are not limited to, those in the following table.
///
///
/// Return code
/// Description
///
/// -
/// S_OK
/// The method succeeded.
///
/// -
/// E_POINTER
/// The pointer passed was NULL.
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/nf-photoacquire-iuserinputstring-getdefault HRESULT GetDefault(
// [out] BSTR *pbstrDefault );
[PreserveSig]
HRESULT GetDefault([MarshalAs(UnmanagedType.BStr)] out string? pbstrDefault);
/// The method retrieves the number of items in the list of most recently used items.
/// Pointer to an integer value containing the number of items in the list of most recently used items.
///
/// The method returns an HRESULT. Possible values include, but are not limited to, those in the following table.
///
///
/// Return code
/// Description
///
/// -
/// S_OK
/// The method succeeded.
///
/// -
/// E_POINTER
/// A NULL pointer was passed where a non- NULL pointer is expected.
///
///
///
/// If an error occurs, pnMruCount will be set to 0.
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/nf-photoacquire-iuserinputstring-getmrucount HRESULT GetMruCount(
// [out] UINT *pnMruCount );
[PreserveSig]
HRESULT GetMruCount(out uint pnMruCount);
/// The method retrieves the entry at the given index in the most recently used list.
/// Integer containing the index at which to retrieve the entry.
/// Pointer to a string containing the most recently used entry.
///
/// The method returns an HRESULT. Possible values include, but are not limited to, those in the following table.
///
///
/// Return code
/// Description
///
/// -
/// S_OK
/// The method succeeded.
///
/// -
/// E_POINTER
/// A NULL pointer was passed where a non- NULL pointer is expected.
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/nf-photoacquire-iuserinputstring-getmruentryat HRESULT
// GetMruEntryAt( [in] UINT nIndex, [out] BSTR *pbstrMruEntry );
[PreserveSig]
HRESULT GetMruEntryAt(uint nIndex, [MarshalAs(UnmanagedType.BStr)] out string? pbstrMruEntry);
/// The method retrieves the default image used to initialize an edit control.
/// Integer containing the size of the image.
/// Pointer to the handle that specifies the image bitmap.
/// Pointer to the handle that specifies the image icon.
///
/// The method returns an HRESULT. Possible values include, but are not limited to, those in the following table.
///
///
/// Return code
/// Description
///
/// -
/// S_OK
/// The method succeeded.
///
/// -
/// E_POINTER
/// A NULL pointer was passed where a non- NULL pointer is expected.
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/photoacquire/nf-photoacquire-iuserinputstring-getimage HRESULT GetImage( [in]
// UINT nSize, [out] HBITMAP *phBitmap, [out] HICON *phIcon );
[PreserveSig]
HRESULT GetImage(uint nSize, out SafeHBITMAP? phBitmap, out SafeHICON? phIcon);
}
/// CLSID_PhotoAcquire
[ComImport, ClassInterface(ClassInterfaceType.None), Guid("00F26E02-E9F2-4A9F-9FDD-5A962FB26A98")]
public class PhotoAcquire { }
/// CLSID_PhotoAcquireAutoPlayDropTarget
[ComImport, ClassInterface(ClassInterfaceType.None), Guid("00F20EB5-8FD6-4D9D-B75E-36801766C8F1")]
public class PhotoAcquireAutoPlayDropTarget : IDropTarget
{
/// Indicates whether a drop can be accepted, and, if so, the effect of the drop.
///
/// A pointer to the IDataObject interface on the data object. This data object contains the data being transferred in the
/// drag-and-drop operation. If the drop occurs, this data object will be incorporated into the target.
///
///
/// The current state of the keyboard modifier keys on the keyboard. Possible values can be a combination of any of the flags
/// MK_CONTROL, MK_SHIFT, MK_ALT, MK_BUTTON, MK_LBUTTON, MK_MBUTTON, and MK_RBUTTON.
///
/// A POINTL structure containing the current cursor coordinates in screen coordinates.
///
/// On input, pointer to the value of the pdwEffect parameter of the DoDragDrop function. On return, must contain one of the
/// DROPEFFECT flags, which indicates what the result of the drop operation would be.
///
///
/// This method returns S_OK on success. Other possible values include the following.
///
///
/// Return code
/// Description
///
/// -
/// E_UNEXPECTED
/// An unexpected error has occurred.
///
/// -
/// E_INVALIDARG
/// The pdwEffect parameter is NULL on input.
///
/// -
/// E_OUTOFMEMORY
/// There was insufficient memory available for this operation.
///
///
///
///
///
/// You do not call DragEnter directly; instead the DoDragDrop function calls it to determine the effect of a drop the first
/// time the user drags the mouse into the registered window of a drop target.
///
///
/// To implement DragEnter, you must determine whether the target can use the data in the source data object by checking three things:
///
///
/// -
/// The format and medium specified by the data object
///
/// -
/// The input value of pdwEffect
///
/// -
/// The state of the modifier keys
///
///
///
/// To check the format and medium, use the IDataObject pointer passed in the pDataObject parameter to call
/// IDataObject::EnumFormatEtc so you can enumerate the FORMATETC structures the source data object supports. Then call
/// IDataObject::QueryGetData to determine whether the data object can render the data on the target by examining the formats and
/// medium specified for the data object.
///
///
/// On entry to IDropTarget::DragEnter, the pdwEffect parameter is set to the effects given to the pdwOkEffect parameter of
/// the DoDragDrop function. The IDropTarget::DragEnter method must choose one of these effects or disable the drop.
///
/// The following modifier keys affect the result of the drop.
///
///
/// Key Combination
/// User-Visible Feedback
/// Drop Effect
///
/// -
/// CTRL + SHIFT
/// =
/// DROPEFFECT_LINK
///
/// -
/// CTRL
/// +
/// DROPEFFECT_COPY
///
/// -
/// No keys or SHIFT
/// None
/// DROPEFFECT_MOVE
///
///
///
/// On return, the method must write the effect, one of the DROPEFFECT flags, to the pdwEffect parameter. DoDragDrop then takes this
/// parameter and writes it to its pdwEffect parameter. You communicate the effect of the drop back to the source through
/// DoDragDrop in the pdwEffect parameter. The DoDragDrop function then calls IDropSource::GiveFeedback so that the
/// source application can display the appropriate visual feedback to the user through the target window.
///
///
// https://docs.microsoft.com/en-us/windows/desktop/api/oleidl/nf-oleidl-idroptarget-dragenter HRESULT DragEnter( IDataObject
// *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect );
[PreserveSig]
public virtual extern HRESULT DragEnter([In] IDataObject pDataObj, [In] MouseButtonState grfKeyState, [In] POINT pt, [In, Out] ref DROPEFFECT pdwEffect);
///
/// Provides target feedback to the user and communicates the drop's effect to the DoDragDrop function so it can communicate the
/// effect of the drop back to the source.
///
///
/// The current state of the keyboard modifier keys on the keyboard. Valid values can be a combination of any of the flags
/// MK_CONTROL, MK_SHIFT, MK_ALT, MK_BUTTON, MK_LBUTTON, MK_MBUTTON, and MK_RBUTTON.
///
/// A POINTL structure containing the current cursor coordinates in screen coordinates.
///
/// On input, pointer to the value of the pdwEffect parameter of the DoDragDrop function. On return, must contain one of the
/// DROPEFFECT flags, which indicates what the result of the drop operation would be.
///
///
/// This method returns S_OK on success. Other possible values include the following.
///
///
/// Return code
/// Description
///
/// -
/// E_UNEXPECTED
/// An unexpected error has occurred.
///
/// -
/// E_INVALIDARG
/// The pdwEffect value is not valid.
///
/// -
/// E_OUTOFMEMORY
/// There was insufficient memory available for this operation.
///
///
///
///
///
/// You do not call DragOver directly. The DoDragDrop function calls this method each time the user moves the mouse across a
/// given target window. DoDragDrop exits the loop if the drag-and-drop operation is canceled, if the user drags the mouse out
/// of the target window, or if the drop is completed.
///
///
/// In implementing IDropTarget::DragOver, you must provide features similar to those in IDropTarget::DragEnter. You must
/// determine the effect of dropping the data on the target by examining the FORMATETC defining the data object's formats and medium,
/// along with the state of the modifier keys. The mouse position may also play a role in determining the effect of a drop. The
/// following modifier keys affect the result of the drop.
///
///
///
/// Key Combination
/// User-Visible Feedback
/// Drop Effect
///
/// -
/// CTRL + SHIFT
/// =
/// DROPEFFECT_LINK
///
/// -
/// CTRL
/// +
/// DROPEFFECT_COPY
///
/// -
/// No keys or SHIFT
/// None
/// DROPEFFECT_MOVE
///
///
///
/// You communicate the effect of the drop back to the source through DoDragDrop in pdwEffect. The DoDragDrop function then
/// calls IDropSource::GiveFeedback so the source application can display the appropriate visual feedback to the user.
///
///
/// On entry to IDropTarget::DragOver, the pdwEffect parameter must be set to the allowed effects passed to the pdwOkEffect
/// parameter of the DoDragDrop function. The IDropTarget::DragOver method must be able to choose one of these effects or
/// disable the drop.
///
///
/// Upon return, pdwEffect is set to one of the DROPEFFECT flags. This value is then passed to the pdwEffect parameter of DoDragDrop.
/// Reasonable values are DROPEFFECT_COPY to copy the dragged data to the target, DROPEFFECT_LINK to create a link to the source
/// data, or DROPEFFECT_MOVE to allow the dragged data to be permanently moved from the source application to the target.
///
///
/// You may also wish to provide appropriate visual feedback in the target window. There may be some target feedback already
/// displayed from a previous call to IDropTarget::DragOver or from the initial IDropTarget::DragEnter. If this feedback is no
/// longer appropriate, you should remove it.
///
///
/// For efficiency reasons, a data object is not passed in IDropTarget::DragOver. The data object passed in the most recent
/// call to IDropTarget::DragEnter is available and can be used.
///
///
/// When IDropTarget::DragOver has completed its operation, the DoDragDrop function calls IDropSource::GiveFeedback so the
/// source application can display the appropriate visual feedback to the user.
///
/// Notes to Implementers
///
/// This function is called frequently during the DoDragDrop loop so it makes sense to optimize your implementation of the
/// DragOver method as much as possible.
///
///
// https://docs.microsoft.com/en-us/windows/desktop/api/oleidl/nf-oleidl-idroptarget-dragover HRESULT DragOver( DWORD grfKeyState,
// POINTL pt, DWORD *pdwEffect );
[PreserveSig]
public virtual extern HRESULT DragOver([In] MouseButtonState grfKeyState, [In] POINT pt, [In, Out] ref DROPEFFECT pdwEffect);
/// Removes target feedback and releases the data object.
///
/// This method returns S_OK on success. Other possible values include the following.
///
///
/// Return code
/// Description
///
/// -
/// E_OUTOFMEMORY
/// There is insufficient memory available for this operation.
///
///
///
///
/// You do not call this method directly. The DoDragDrop function calls this method in either of the following cases:
///
/// -
/// When the user drags the cursor out of a given target window.
///
/// -
/// When the user cancels the current drag-and-drop operation.
///
///
///
/// To implement IDropTarget::DragLeave, you must remove any target feedback that is currently displayed. You must also
/// release any references you hold to the data transfer object.
///
///
// https://docs.microsoft.com/en-us/windows/desktop/api/oleidl/nf-oleidl-idroptarget-dragleave HRESULT DragLeave( );
[PreserveSig]
public virtual extern HRESULT DragLeave();
/// Incorporates the source data into the target window, removes target feedback, and releases the data object.
/// A pointer to the IDataObject interface on the data object being transferred in the drag-and-drop operation.
///
/// The current state of the keyboard modifier keys on the keyboard. Possible values can be a combination of any of the flags
/// MK_CONTROL, MK_SHIFT, MK_ALT, MK_BUTTON, MK_LBUTTON, MK_MBUTTON, and MK_RBUTTON.
///
/// A POINTL structure containing the current cursor coordinates in screen coordinates.
///
/// On input, pointer to the value of the pdwEffect parameter of the DoDragDrop function. On return, must contain one of the
/// DROPEFFECT flags, which indicates what the result of the drop operation would be.
///
///
/// This method returns S_OK on success. Other possible values include the following.
///
///
/// Return code
/// Description
///
/// -
/// E_UNEXPECTED
/// An unexpected error has occurred.
///
/// -
/// E_INVALIDARG
/// The pdwEffect parameter is not valid.
///
/// -
/// E_OUTOFMEMORY
/// There is insufficient memory available for this operation.
///
///
///
///
///
/// You do not call this method directly. The DoDragDrop function calls this method when the user completes the drag-and-drop operation.
///
///
/// In implementing Drop, you must incorporate the data object into the target. Use the formats available in IDataObject,
/// available through pDataObj, along with the current state of the modifier keys to determine how the data is to be incorporated,
/// such as linking or embedding.
///
/// In addition to incorporating the data, you must also clean up as you do in the IDropTarget::DragLeave method:
///
/// -
/// Remove any target feedback that is currently displayed.
///
/// -
/// Release any references to the data object.
///
///
///
/// You also pass the effect of this operation back to the source application through DoDragDrop, so the source application can clean
/// up after the drag-and-drop operation is complete:
///
///
/// -
/// Remove any source feedback that is being displayed.
///
/// -
/// Make any necessary changes to the data, such as removing the data if the operation was a move.
///
///
///
// https://docs.microsoft.com/en-us/windows/desktop/api/oleidl/nf-oleidl-idroptarget-drop HRESULT Drop( IDataObject *pDataObj, DWORD
// grfKeyState, POINTL pt, DWORD *pdwEffect );
[PreserveSig]
public virtual extern HRESULT Drop([In] IDataObject pDataObj, [In] MouseButtonState grfKeyState, [In] POINT pt, [In, Out] ref DROPEFFECT pdwEffect);
}
/// CLSID_PhotoAcquireAutoPlayHWEventHandler
[ComImport, ClassInterface(ClassInterfaceType.None), Guid("00F2B433-44E4-4D88-B2B0-2698A0A91DBA")]
public class PhotoAcquireAutoPlayHWEventHandler : IHWEventHandler
{
/// Initializes an object that contains an implementation of the IHWEventHandler interface.
///
/// Type: LPCWSTR
/// A pointer to a string buffer that contains the string from the following registry value.
///
/// HKEY_LOCAL_MACHINESoftwareMicrosoftWindowsCurrentVersionExplorerAutoPlayHandlersHandlers
/// HandlerName InitCmdLine = string
///
///
///
/// Type: HRESULT
/// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.
///
/// This method receives the registry string stored in the InitCmdLine value under the
// https://docs.microsoft.com/en-us/windows/win32/api/shobjidl/nf-shobjidl-ihweventhandler-initialize HRESULT Initialize( LPCWSTR
// pszParams );
[PreserveSig]
public virtual extern HRESULT Initialize([MarshalAs(UnmanagedType.LPWStr)] string pszParams);
/// Handles AutoPlay device events for which there is no content of the type the application is registered to handle.
///
/// Type: LPCWSTR
/// A pointer to a string buffer that contains the device ID.
///
///
/// Type: LPCWSTR
///
/// A pointer to a string buffer that contains the alternate device ID. The alternate device ID is more human-readable than the
/// primary device ID.
///
///
///
/// Type: LPCWSTR
///
/// A pointer to a string buffer that contains the event type. The event types include DeviceArrival, DeviceRemoval, MediaArrival,
/// and MediaRemoval.
///
///
///
/// Type: HRESULT
/// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.
///
/// The event types are not C/C++ language constants; they are literal text strings.
// https://docs.microsoft.com/en-us/windows/win32/api/shobjidl/nf-shobjidl-ihweventhandler-handleevent HRESULT HandleEvent( LPCWSTR
// pszDeviceID, LPCWSTR pszAltDeviceID, LPCWSTR pszEventType );
[PreserveSig]
public virtual extern HRESULT HandleEvent([MarshalAs(UnmanagedType.LPWStr)] string pszDeviceID,
[MarshalAs(UnmanagedType.LPWStr)] string pszAltDeviceID, [MarshalAs(UnmanagedType.LPWStr)] string pszEventType);
/// Not implemented.
/// This parameter is unused.
/// This parameter is unused.
/// This parameter is unused.
/// This parameter is unused.
/// This parameter is unused.
/// This method does not return a value.
// https://docs.microsoft.com/en-us/windows/win32/api/shobjidl/nf-shobjidl-ihweventhandler-handleeventwithcontent HRESULT
// HandleEventWithContent( LPCWSTR pszDeviceID, LPCWSTR pszAltDeviceID, LPCWSTR pszEventType, LPCWSTR pszContentTypeHandler,
// IDataObject *pdataobject );
[PreserveSig]
public virtual extern HRESULT HandleEventWithContent([MarshalAs(UnmanagedType.LPWStr)] string pszDeviceID,
[MarshalAs(UnmanagedType.LPWStr)] string pszAltDeviceID, [MarshalAs(UnmanagedType.LPWStr)] string pszEventType,
[MarshalAs(UnmanagedType.LPWStr)] string pszContentTypeHandler, IDataObject pdataobject);
}
/// CLSID_PhotoAcquireDeviceSelectionDialog
[ComImport, ClassInterface(ClassInterfaceType.None), Guid("00F29A34-B8A1-482C-BCF8-3AC7B0FE8F62")]
public class PhotoAcquireDeviceSelectionDialog { }
/// CLSID_PhotoAcquireOptionsDialog
[ComImport, Guid("00F210A1-62F0-438B-9F7E-9618D72A1831"), ClassInterface(ClassInterfaceType.None)]
public class PhotoAcquireOptionsDialog { }
/// CLSID_PhotoProgressDialog
[ComImport, Guid("00F24CA0-748F-4E8A-894F-0E0357C6799F"), ClassInterface(ClassInterfaceType.None)]
public class PhotoProgressDialog { }
}