Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

966 lines
21 KiB

  1. /*******************************************************************************
  2. *
  3. * (C) COPYRIGHT MICROSOFT CORP., 1998
  4. *
  5. * TITLE: Device.Cpp
  6. *
  7. * VERSION: 2.0
  8. *
  9. * AUTHOR: ReedB
  10. *
  11. * DATE: 5 Jan, 1999
  12. *
  13. * DESCRIPTION:
  14. * Implementation of the WIA test scanner device methods. This sample WIA USD
  15. * supports push events by detecting when %windir%\temp\TESTUSD.BMP file has
  16. * been modified. This file becomes the new source of scanning data. An
  17. * event is generated the first time the device is loaded.
  18. *
  19. *******************************************************************************/
  20. #include <windows.h>
  21. #include <tchar.h>
  22. #include "testusd.h"
  23. #include "resource.h"
  24. #include "tcamprop.h"
  25. extern HINSTANCE g_hInst;
  26. //
  27. // Function prototypes, implemented in this file:
  28. //
  29. VOID FileChangeThread(LPVOID lpParameter);
  30. /**************************************************************************\
  31. * TestUsdDevice::TestUsdDevice
  32. *
  33. * Device class constructor
  34. *
  35. * Arguments:
  36. *
  37. * None
  38. *
  39. * Return Value:
  40. *
  41. * None
  42. *
  43. * History:
  44. *
  45. * 9/11/1998 Original Version
  46. *
  47. \**************************************************************************/
  48. TestUsdDevice::TestUsdDevice(LPUNKNOWN punkOuter):
  49. m_cRef(1),
  50. m_punkOuter(NULL),
  51. m_fValid(FALSE),
  52. m_pIStiDevControl(NULL),
  53. m_hShutdownEvent(INVALID_HANDLE_VALUE),
  54. m_hSignalEvent(INVALID_HANDLE_VALUE),
  55. m_hEventNotifyThread(NULL),
  56. m_guidLastEvent(GUID_NULL),
  57. m_pIWiaEventCallback(NULL),
  58. m_pStiDevice(NULL),
  59. m_bstrDeviceID(NULL),
  60. m_bstrRootFullItemName(NULL),
  61. m_pIDrvItemRoot(NULL)
  62. {
  63. WIAS_TRACE((g_hInst,"TestUsdDevice::TestUsdDevice"));
  64. *m_szSrcDataName = L'\0';
  65. //
  66. // See if we are aggregated. If we are (almost always the case) save
  67. // pointer to the controlling Unknown , so subsequent calls will be
  68. // delegated. If not, set the same pointer to "this".
  69. //
  70. if (punkOuter) {
  71. m_punkOuter = punkOuter;
  72. }
  73. else {
  74. //
  75. // Cast below is needed in order to point to right virtual table
  76. //
  77. m_punkOuter = reinterpret_cast<IUnknown*>
  78. (static_cast<INonDelegatingUnknown*>
  79. (this));
  80. }
  81. //
  82. // init camera search path
  83. //
  84. LPTSTR lpwszEnvString = TEXT("%CAMERA_ROOT%");
  85. DWORD dwRet = ExpandEnvironmentStrings(lpwszEnvString,
  86. gpszPath, MAX_PATH);
  87. if ((dwRet == 0) || (dwRet == (ULONG)_tcslen(lpwszEnvString)+1)) {
  88. _tcscpy(gpszPath, TEXT("C:\\Image"));
  89. }
  90. }
  91. /**************************************************************************\
  92. * TestUsdDevice::PrivateInitialize
  93. *
  94. * Device class private initialization
  95. *
  96. * Arguments:
  97. *
  98. * None
  99. *
  100. * Return Value:
  101. *
  102. * None
  103. *
  104. \**************************************************************************/
  105. HRESULT TestUsdDevice::PrivateInitialize()
  106. {
  107. HRESULT hr = S_OK;
  108. __try {
  109. if(!InitializeCriticalSectionAndSpinCount(&m_csShutdown, MINLONG)) {
  110. hr = HRESULT_FROM_WIN32(::GetLastError());
  111. WIAS_ERROR((g_hInst,"TestUsdDevice::PrivateInitialize init CritSect failed"));
  112. }
  113. }
  114. __except(EXCEPTION_EXECUTE_HANDLER) {
  115. hr = E_OUTOFMEMORY;
  116. }
  117. if(hr == S_OK) {
  118. //
  119. // Create event for syncronization of notifications shutdown.
  120. //
  121. m_hShutdownEvent = CreateEvent(NULL,
  122. FALSE,
  123. FALSE,
  124. NULL);
  125. if (m_hShutdownEvent && (INVALID_HANDLE_VALUE != m_hShutdownEvent)) {
  126. m_fValid = TRUE;
  127. }
  128. else {
  129. hr = HRESULT_FROM_WIN32(::GetLastError());
  130. WIAS_ERROR((g_hInst,"TestUsdDevice::PrivateInitialize, create shutdown event failed"));
  131. }
  132. }
  133. return hr;
  134. }
  135. /**************************************************************************\
  136. * TestUsdDevice::~TestUsdDevice
  137. *
  138. * Device class destructor
  139. *
  140. * Arguments:
  141. *
  142. * None
  143. *
  144. * Return Value:
  145. *
  146. * None
  147. *
  148. * History:
  149. *
  150. * 9/11/1998 Original Version
  151. *
  152. \**************************************************************************/
  153. TestUsdDevice::~TestUsdDevice(void)
  154. {
  155. WIAS_TRACE((g_hInst,"TestUsdDevice::~TestUsdDevice"));
  156. //
  157. // Kill notification thread if it exists.
  158. //
  159. SetNotificationHandle(NULL);
  160. //
  161. // Close event for syncronization of notifications shutdown.
  162. //
  163. if (m_hShutdownEvent && (m_hShutdownEvent != INVALID_HANDLE_VALUE)) {
  164. CloseHandle(m_hShutdownEvent);
  165. }
  166. //
  167. // Release the device control interface.
  168. //
  169. if (m_pIStiDevControl) {
  170. m_pIStiDevControl->Release();
  171. m_pIStiDevControl = NULL;
  172. }
  173. //
  174. // WIA member destruction
  175. //
  176. // Cleanup the WIA event sink.
  177. //
  178. if (m_pIWiaEventCallback) {
  179. m_pIWiaEventCallback->Release();
  180. }
  181. //
  182. // Free the storage for the device ID.
  183. //
  184. if (m_bstrDeviceID) {
  185. SysFreeString(m_bstrDeviceID);
  186. }
  187. //
  188. // Release the objects supporting device property storage.
  189. //
  190. if (m_bstrRootFullItemName) {
  191. SysFreeString(m_bstrRootFullItemName);
  192. }
  193. //
  194. // Free the critical section.
  195. //
  196. DeleteCriticalSection(&m_csShutdown);
  197. }
  198. /**************************************************************************\
  199. * TestUsdDevice::GetCapabilities
  200. *
  201. * Get the device STI capabilities.
  202. *
  203. * Arguments:
  204. *
  205. * pUsdCaps - Pointer to USD capabilities data.
  206. *
  207. * Return Value:
  208. *
  209. * Status.
  210. *
  211. * History:
  212. *
  213. * 9/11/1998 Original Version
  214. *
  215. \**************************************************************************/
  216. STDMETHODIMP TestUsdDevice::GetCapabilities(PSTI_USD_CAPS pUsdCaps)
  217. {
  218. ZeroMemory(pUsdCaps, sizeof(*pUsdCaps));
  219. pUsdCaps->dwVersion = STI_VERSION;
  220. //
  221. // We do support device notifications, but do not requiring polling.
  222. //
  223. pUsdCaps->dwGenericCaps = STI_USD_GENCAP_NATIVE_PUSHSUPPORT;
  224. return STI_OK;
  225. }
  226. /**************************************************************************\
  227. * TestUsdDevice::GetStatus
  228. *
  229. * Query device online and/or event status.
  230. *
  231. * Arguments:
  232. *
  233. * pDevStatus - Pointer to device status data.
  234. *
  235. * Return Value:
  236. *
  237. * Status.
  238. *
  239. * History:
  240. *
  241. * 9/11/1998 Original Version
  242. *
  243. \**************************************************************************/
  244. STDMETHODIMP TestUsdDevice::GetStatus(PSTI_DEVICE_STATUS pDevStatus)
  245. {
  246. WIAS_TRACE((g_hInst,"TestUsdDevice::GetStatus"));
  247. //
  248. // Validate parameters.
  249. //
  250. if (!pDevStatus) {
  251. WIAS_ERROR((g_hInst,"TestUsdDevice::GetStatus, NULL parameter"));
  252. return E_INVALIDARG;
  253. }
  254. //
  255. // If we are asked, verify whether device is online.
  256. //
  257. pDevStatus->dwOnlineState = 0L;
  258. if (pDevStatus->StatusMask & STI_DEVSTATUS_ONLINE_STATE) {
  259. //
  260. // The test device is always on-line.
  261. //
  262. pDevStatus->dwOnlineState |= STI_ONLINESTATE_OPERATIONAL;
  263. }
  264. //
  265. // If we are asked, verify state of event.
  266. //
  267. pDevStatus->dwEventHandlingState &= ~STI_EVENTHANDLING_PENDING;
  268. if (pDevStatus->StatusMask & STI_DEVSTATUS_EVENTS_STATE) {
  269. //
  270. // Generate an event the first time we load.
  271. //
  272. if (m_bUsdLoadEvent) {
  273. pDevStatus->dwEventHandlingState = STI_EVENTHANDLING_PENDING;
  274. m_guidLastEvent = guidEventFirstLoaded;
  275. m_bUsdLoadEvent = FALSE;
  276. }
  277. //
  278. // event pending ???
  279. //
  280. }
  281. return STI_OK;
  282. }
  283. /**************************************************************************\
  284. * TestUsdDevice::DeviceReset
  285. *
  286. * Reset data file pointer to start of file.
  287. *
  288. * Arguments:
  289. *
  290. * None
  291. *
  292. * Return Value:
  293. *
  294. * Status.
  295. *
  296. * History:
  297. *
  298. * 9/11/1998 Original Version
  299. *
  300. \**************************************************************************/
  301. STDMETHODIMP TestUsdDevice::DeviceReset(void)
  302. {
  303. WIAS_TRACE((g_hInst,"DeviceReset"));
  304. return STI_OK;
  305. }
  306. /**************************************************************************\
  307. * TestUsdDevice::Diagnostic
  308. *
  309. * The test device always passes the diagnostic.
  310. *
  311. * Arguments:
  312. *
  313. * pBuffer - Pointer o diagnostic result data.
  314. *
  315. * Return Value:
  316. *
  317. * None
  318. *
  319. * History:
  320. *
  321. * 9/11/1998 Original Version
  322. *
  323. \**************************************************************************/
  324. STDMETHODIMP TestUsdDevice::Diagnostic(LPSTI_DIAG pBuffer)
  325. {
  326. WIAS_TRACE((g_hInst,"TestUsdDevice::Diagnostic"));
  327. //
  328. // Initialize response buffer
  329. //
  330. pBuffer->dwStatusMask = 0;
  331. ZeroMemory(&pBuffer->sErrorInfo,sizeof(pBuffer->sErrorInfo));
  332. pBuffer->sErrorInfo.dwGenericError = NOERROR;
  333. pBuffer->sErrorInfo.dwVendorError = 0;
  334. return STI_OK;
  335. }
  336. /**************************************************************************\
  337. * TestUsdDevice::SetNotificationHandle
  338. *
  339. * Starts and stops the event notification thread.
  340. *
  341. * Arguments:
  342. *
  343. * hEvent - If not valid start the notification thread otherwise kill
  344. * the notification thread.
  345. *
  346. * Return Value:
  347. *
  348. * Status.
  349. *
  350. * History:
  351. *
  352. * 9/11/1998 Original Version
  353. *
  354. \**************************************************************************/
  355. STDMETHODIMP TestUsdDevice::SetNotificationHandle(HANDLE hEvent)
  356. {
  357. WIAS_TRACE((g_hInst,"TestUsdDevice::SetNotificationHandle"));
  358. HRESULT hr = S_OK;
  359. EnterCriticalSection(&m_csShutdown);
  360. //
  361. // Are we starting or stopping the notification thread?
  362. //
  363. if (hEvent && (hEvent != INVALID_HANDLE_VALUE)) {
  364. m_hSignalEvent = hEvent;
  365. //
  366. // Initialize to no event.
  367. //
  368. m_guidLastEvent = GUID_NULL;
  369. //
  370. // Create the notification thread.
  371. //
  372. if (!m_hEventNotifyThread) {
  373. DWORD dwThread;
  374. m_hEventNotifyThread = CreateThread(NULL,
  375. 0,
  376. (LPTHREAD_START_ROUTINE)FileChangeThread,
  377. (LPVOID)this,
  378. 0,
  379. &dwThread);
  380. if (m_hEventNotifyThread) {
  381. WIAS_TRACE((g_hInst,"TestUsdDevice::SetNotificationHandle, Enabling event notification"));
  382. }
  383. else {
  384. WIAS_ERROR((g_hInst,"TestUsdDevice::SetNotificationHandle, unable to create notification thread"));
  385. hr = HRESULT_FROM_WIN32(::GetLastError());
  386. }
  387. }
  388. else {
  389. WIAS_ERROR((g_hInst,"TestUsdDevice::SetNotificationHandle, spurious notification thread"));
  390. hr = STIERR_UNSUPPORTED;
  391. }
  392. }
  393. else {
  394. //
  395. // Disable event notifications.
  396. //
  397. SetEvent(m_hShutdownEvent);
  398. if (m_hEventNotifyThread) {
  399. WIAS_TRACE((g_hInst,"Disabling event notification"));
  400. WaitForSingleObject(m_hEventNotifyThread, 400);
  401. CloseHandle(m_hEventNotifyThread);
  402. m_hEventNotifyThread = NULL;
  403. m_guidLastEvent = GUID_NULL;
  404. //
  405. // close dlg
  406. //
  407. if (m_hDlg != NULL) {
  408. SendMessage(m_hDlg,WM_COMMAND,IDOK,0);
  409. m_hDlg = NULL;
  410. }
  411. }
  412. }
  413. LeaveCriticalSection(&m_csShutdown);
  414. return hr;
  415. }
  416. /**************************************************************************\
  417. * TestUsdDevice::GetNotificationData
  418. *
  419. * Provides data on n event.
  420. *
  421. * Arguments:
  422. *
  423. * pBuffer - Pointer to event data.
  424. *
  425. * Return Value:
  426. *
  427. * Status.
  428. *
  429. * History:
  430. *
  431. * 9/11/1998 Original Version
  432. *
  433. \**************************************************************************/
  434. STDMETHODIMP TestUsdDevice::GetNotificationData( LPSTINOTIFY pBuffer )
  435. {
  436. WIAS_TRACE((g_hInst,"TestUsdDevice::GetNotificationData"));
  437. //
  438. // If we have notification ready - return it's guid
  439. //
  440. if (!IsEqualIID(m_guidLastEvent, GUID_NULL)) {
  441. pBuffer->guidNotificationCode = m_guidLastEvent;
  442. m_guidLastEvent = GUID_NULL;
  443. pBuffer->dwSize = sizeof(STINOTIFY);
  444. ZeroMemory(&pBuffer->abNotificationData, sizeof(pBuffer->abNotificationData));
  445. //
  446. // private event
  447. //
  448. if (IsEqualIID(m_guidLastEvent, WIA_EVENT_NAME_CHANGE)) {
  449. }
  450. }
  451. else {
  452. return STIERR_NOEVENTS;
  453. }
  454. return STI_OK;
  455. }
  456. /**************************************************************************\
  457. * TestUsdDevice::Escape
  458. *
  459. * Issue a command to the device.
  460. *
  461. * Arguments:
  462. *
  463. * EscapeFunction - Command to be issued.
  464. * pInData - Input data to be passed with command.
  465. * cbInDataSize - Size of input data.
  466. * pOutData - Output data to be passed back from command.
  467. * cbOutDataSize - Size of output data buffer.
  468. * pcbActualData - Size of output data actually written.
  469. *
  470. * Return Value:
  471. *
  472. * None
  473. *
  474. * History:
  475. *
  476. * 9/11/1998 Original Version
  477. *
  478. \**************************************************************************/
  479. STDMETHODIMP TestUsdDevice::Escape(
  480. STI_RAW_CONTROL_CODE EscapeFunction,
  481. LPVOID pInData,
  482. DWORD cbInDataSize,
  483. LPVOID pOutData,
  484. DWORD cbOutDataSize,
  485. LPDWORD pcbActualData)
  486. {
  487. WIAS_TRACE((g_hInst,"TestUsdDevice::Escape, unsupported"));
  488. //
  489. // Write command to device if needed.
  490. //
  491. return STIERR_UNSUPPORTED;
  492. }
  493. /**************************************************************************\
  494. * TestUsdDevice::GetLastError
  495. *
  496. * Get the last error from the device.
  497. *
  498. * Arguments:
  499. *
  500. * pdwLastDeviceError - Pointer to last error data.
  501. *
  502. * Return Value:
  503. *
  504. * Status.
  505. *
  506. * History:
  507. *
  508. * 9/11/1998 Original Version
  509. *
  510. \**************************************************************************/
  511. STDMETHODIMP TestUsdDevice::GetLastError(LPDWORD pdwLastDeviceError)
  512. {
  513. WIAS_TRACE((g_hInst,"TestUsdDevice::GetLastError"));
  514. if (IsBadWritePtr(pdwLastDeviceError, sizeof(DWORD))) {
  515. return STIERR_INVALID_PARAM;
  516. }
  517. *pdwLastDeviceError = m_dwLastOperationError;
  518. return STI_OK;
  519. }
  520. /**************************************************************************\
  521. * TestUsdDevice::GetLastErrorInfo
  522. *
  523. * Get extended error information from the device.
  524. *
  525. * Arguments:
  526. *
  527. * pLastErrorInfo - Pointer to extended device error data.
  528. *
  529. * Return Value:
  530. *
  531. * Status.
  532. *
  533. * History:
  534. *
  535. * 9/11/1998 Original Version
  536. *
  537. \**************************************************************************/
  538. STDMETHODIMP TestUsdDevice::GetLastErrorInfo(STI_ERROR_INFO *pLastErrorInfo)
  539. {
  540. WIAS_TRACE((g_hInst,"TestUsdDevice::GetLastErrorInfo"));
  541. if (IsBadWritePtr(pLastErrorInfo, sizeof(STI_ERROR_INFO))) {
  542. return STIERR_INVALID_PARAM;
  543. }
  544. pLastErrorInfo->dwGenericError = m_dwLastOperationError;
  545. pLastErrorInfo->szExtendedErrorText[0] = '\0';
  546. return STI_OK;
  547. }
  548. /**************************************************************************\
  549. * TestUsdDevice::LockDevice
  550. *
  551. * Lock access to the device.
  552. *
  553. * Arguments:
  554. *
  555. * None
  556. *
  557. * Return Value:
  558. *
  559. * Status.
  560. *
  561. * History:
  562. *
  563. * 9/11/1998 Original Version
  564. *
  565. \**************************************************************************/
  566. STDMETHODIMP TestUsdDevice::LockDevice(void)
  567. {
  568. return STI_OK;
  569. }
  570. /**************************************************************************\
  571. * TestUsdDevice::UnLockDevice
  572. *
  573. * Unlock access to the device.
  574. *
  575. * Arguments:
  576. *
  577. * None
  578. *
  579. * Return Value:
  580. *
  581. * Status.
  582. *
  583. * History:
  584. *
  585. * 9/11/1998 Original Version
  586. *
  587. \**************************************************************************/
  588. STDMETHODIMP TestUsdDevice::UnLockDevice(void)
  589. {
  590. return STI_OK;
  591. }
  592. /**************************************************************************\
  593. * TestUsdDevice::RawReadData
  594. *
  595. * Read raw data from the device.
  596. *
  597. * Arguments:
  598. *
  599. * lpBuffer -
  600. * lpdwNumberOfBytes -
  601. * lpOverlapped -
  602. *
  603. * Return Value:
  604. *
  605. * Status.
  606. *
  607. * History:
  608. *
  609. * 9/11/1998 Original Version
  610. *
  611. \**************************************************************************/
  612. STDMETHODIMP TestUsdDevice::RawReadData(
  613. LPVOID lpBuffer,
  614. LPDWORD lpdwNumberOfBytes,
  615. LPOVERLAPPED lpOverlapped)
  616. {
  617. WIAS_TRACE((g_hInst,"TestUsdDevice::RawReadData"));
  618. return STI_OK;
  619. }
  620. /**************************************************************************\
  621. * TestUsdDevice::RawWriteData
  622. *
  623. * Write raw data to the device.
  624. *
  625. * Arguments:
  626. *
  627. * lpBuffer -
  628. * dwNumberOfBytes -
  629. * lpOverlapped -
  630. *
  631. * Return Value:
  632. *
  633. * Status.
  634. *
  635. * History:
  636. *
  637. * 9/11/1998 Original Version
  638. *
  639. \**************************************************************************/
  640. STDMETHODIMP TestUsdDevice::RawWriteData(
  641. LPVOID lpBuffer,
  642. DWORD dwNumberOfBytes,
  643. LPOVERLAPPED lpOverlapped)
  644. {
  645. WIAS_TRACE((g_hInst,"TestUsdDevice::RawWriteData"));
  646. return STI_OK;
  647. }
  648. /**************************************************************************\
  649. * TestUsdDevice::RawReadCommand
  650. *
  651. *
  652. *
  653. * Arguments:
  654. *
  655. * lpBuffer -
  656. * lpdwNumberOfBytes -
  657. * lpOverlapped -
  658. *
  659. * Return Value:
  660. *
  661. * Status
  662. *
  663. * History:
  664. *
  665. * 9/11/1998 Original Version
  666. *
  667. \**************************************************************************/
  668. STDMETHODIMP TestUsdDevice::RawReadCommand(
  669. LPVOID lpBuffer,
  670. LPDWORD lpdwNumberOfBytes,
  671. LPOVERLAPPED lpOverlapped)
  672. {
  673. WIAS_TRACE((g_hInst,"TestUsdDevice::RawReadCommand, unsupported"));
  674. return STIERR_UNSUPPORTED;
  675. }
  676. /**************************************************************************\
  677. * TestUsdDevice::RawWriteCommand
  678. *
  679. *
  680. *
  681. * Arguments:
  682. *
  683. * lpBuffer -
  684. * nNumberOfBytes -
  685. * lpOverlapped -
  686. *
  687. * Return Value:
  688. *
  689. * Status.
  690. *
  691. * History:
  692. *
  693. * 9/11/1998 Original Version
  694. *
  695. \**************************************************************************/
  696. STDMETHODIMP TestUsdDevice::RawWriteCommand(
  697. LPVOID lpBuffer,
  698. DWORD nNumberOfBytes,
  699. LPOVERLAPPED lpOverlapped)
  700. {
  701. WIAS_TRACE((g_hInst,"TestUsdDevice::RawWriteCommand, unsupported"));
  702. return STIERR_UNSUPPORTED;
  703. }
  704. /**************************************************************************\
  705. * TestUsdDevice::Initialize
  706. *
  707. * Initialize the device object.
  708. *
  709. * Arguments:
  710. *
  711. * pIStiDevControlNone -
  712. * dwStiVersion -
  713. * hParametersKey -
  714. *
  715. * Return Value:
  716. *
  717. * Status.
  718. *
  719. * History:
  720. *
  721. * 9/11/1998 Original Version
  722. *
  723. \**************************************************************************/
  724. STDMETHODIMP TestUsdDevice::Initialize(
  725. PSTIDEVICECONTROL pIStiDevControl,
  726. DWORD dwStiVersion,
  727. HKEY hParametersKey)
  728. {
  729. HRESULT hr = STI_OK;
  730. UINT uiNameLen = 0;
  731. CAMERA_STATUS camStatus;
  732. WIAS_TRACE((g_hInst,"TestUsdDevice::Initialize"));
  733. if (!pIStiDevControl) {
  734. WIAS_ERROR((g_hInst,"TestUsdDevice::Initialize, invalid device control interface"));
  735. return STIERR_INVALID_PARAM;
  736. }
  737. //
  738. // Cache the device control interface.
  739. //
  740. m_pIStiDevControl = pIStiDevControl;
  741. m_pIStiDevControl->AddRef();
  742. //
  743. // Try to open the camera only once here during Initialize
  744. //
  745. hr = CamOpenCamera(&camStatus);
  746. return (hr);
  747. }
  748. /**************************************************************************\
  749. * TestUsdDevice::RunNotifications
  750. *
  751. * Monitor changes to the source data file parent directory.
  752. *
  753. * Arguments:
  754. *
  755. * None
  756. *
  757. * Return Value:
  758. *
  759. * Status.
  760. *
  761. * History:
  762. *
  763. * 9/11/1998 Original Version
  764. *
  765. \**************************************************************************/
  766. VOID TestUsdDevice::RunNotifications(void)
  767. {
  768. //
  769. // start up camera event dlg
  770. //
  771. WIAS_TRACE((g_hInst,"TestUsdDevice::RunNotifications: start up event dlg"));
  772. HWND hWnd = GetDesktopWindow();
  773. int iret = (int)DialogBoxParam(
  774. g_hInst,
  775. MAKEINTRESOURCE(IDD_EVENT_DLG),
  776. hWnd,
  777. (DLGPROC)CameraEventDlgProc,
  778. (LPARAM)this
  779. );
  780. WIAS_TRACE((g_hInst,"TestUsdDevice::RunNotifications, iret = 0x%lx",iret));
  781. if (iret == -1) {
  782. int err = ::GetLastError();
  783. WIAS_TRACE((g_hInst,"TestUsdDevice::RunNotifications, dlg error = 0x%lx",err));
  784. }
  785. }
  786. /**************************************************************************\
  787. * FileChangeThread
  788. *
  789. * Calls RunNotifications to detect changing source data file.
  790. *
  791. * Arguments:
  792. *
  793. * lpParameter - Pointer to device object.
  794. *
  795. * Return Value:
  796. *
  797. * None
  798. *
  799. * History:
  800. *
  801. * 9/11/1998 Original Version
  802. *
  803. \**************************************************************************/
  804. VOID FileChangeThread(LPVOID lpParameter)
  805. {
  806. WIAS_TRACE((g_hInst,"TestUsdDevice::"));
  807. TestUsdDevice *pThisDevice = (TestUsdDevice *)lpParameter;
  808. pThisDevice->RunNotifications();
  809. }