IStillImageW::LaunchApplicationForDevice method (sti.h)
The IStillImage::LaunchApplicationForDevice method starts a specified application for a specified still image device.
Syntax
HRESULT LaunchApplicationForDevice(
[in] LPWSTR pwszDeviceName,
[in] LPWSTR pwszAppName,
[in] LPSTINOTIFY pStiNotify
);
Parameters
[in] pwszDeviceName
Caller-supplied pointer to a string representing an internal device name, obtained by calling IStillImage::GetSTILaunchInformation or IStillImage::GetDeviceList.
[in] pwszAppName
Caller-supplied pointer to a string representing the short name of an application that was registered by calling IStillImage::RegisterLaunchApplication.
[in] pStiNotify
Caller-supplied pointer to an STINOTIFY structure describing a device event. Typically, the event's GUID is obtained by calling IStiDevice::GetLastNotificationData.
Return value
If the operation succeeds, the method returns S_OK. Otherwise, it returns one of the STIERR-prefixed error codes defined in stierr.h.
Remarks
The IStillImage::LaunchApplicationForDevice method can only start applications that have registered themselves by calling IStillImage::RegisterLaunchApplication. The specified event must be one that the specified device supports. The method mimics the occurrence of a device event, and is useful for applications that intercept events from devices and reroute them. When a user starts the scanner, such an application might, for example, ask the user whether they want to store the scanned image, make a copy, or send a fax.
Before calling IStillImage::LaunchApplicationForDevice, clients of the IStillImage COM interface must call IStillImage::StiCreateInstance to obtain an IStillImage interface pointer.
Examples
HRESULT hRes;
hRes = pStiDevice->GetLastNotificationData(&pNotify);
if (!SUCCEEDED(hRes))
{
DisplayOutput("->GetLastNotificationData returned %xh %u",
hReturn,hReturn);
}
// Process or filter events here
// Send event on to app
hRes = pSti->LaunchApplicationForDevice(pStiInfoPtr->szDeviceInternalName,
L"AppName",
pNotify);
if (!SUCCEEDED(hRes))
{
DisplayOutput("->LaunchApplicationForDevice on %S returned %xh %u",
pStiInfoPtr->szDeviceInternalName,hReturn,hReturn);
}
Requirements
Requirement | Value |
---|---|
Target Platform | Desktop |
Header | sti.h (include Sti.h) |