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.

190 lines
3.8 KiB

  1. /*++
  2. Copyright (c) 1989-1998 Microsoft Corporation
  3. Module Name:
  4. camevent.cpp
  5. Abstract:
  6. Enumerate disk images to emulate camera
  7. Author:
  8. Mark Enstrom (marke) 1/13/1999
  9. Environment:
  10. user mode
  11. Revision History:
  12. --*/
  13. #include <stdio.h>
  14. #include <objbase.h>
  15. #include <sti.h>
  16. #include "ircamera.h"
  17. #include "tcamprop.h"
  18. #include "resource.h"
  19. extern HINSTANCE g_hInst; // Global hInstance
  20. CAM_EVENT gCamEvent[] = {
  21. {
  22. TEXT("Pathname Change"),
  23. &WIA_EVENT_NAME_CHANGE
  24. },
  25. {
  26. TEXT("Disconnect"),
  27. &WIA_EVENT_DEVICE_DISCONNECTED
  28. },
  29. {
  30. TEXT("Connect"),
  31. &WIA_EVENT_DEVICE_CONNECTED
  32. }
  33. };
  34. TCHAR gpszPath[MAX_PATH];
  35. /**************************************************************************\
  36. * CameraEventDlgProp
  37. *
  38. *
  39. * Arguments:
  40. *
  41. * hDlg
  42. * message
  43. * wParam
  44. * lParam
  45. *
  46. * Return Value:
  47. *
  48. * Status
  49. *
  50. * History:
  51. *
  52. * 1/11/1999 Original Version
  53. *
  54. \**************************************************************************/
  55. BOOL _stdcall
  56. CameraEventDlgProc(
  57. HWND hDlg,
  58. unsigned message,
  59. DWORD wParam,
  60. LONG lParam )
  61. /*++
  62. Routine Description:
  63. Process message for about box, show a dialog box that says what the
  64. name of the program is.
  65. Arguments:
  66. hDlg - window handle of the dialog box
  67. message - type of message
  68. wParam - message-specific information
  69. lParam - message-specific information
  70. Return Value:
  71. status of operation
  72. Revision History:
  73. 03-21-91 Initial code
  74. --*/
  75. {
  76. static IrUsdDevice *pDevice;
  77. switch (message)
  78. {
  79. case WM_INITDIALOG:
  80. {
  81. //
  82. // get event list from device
  83. //
  84. SendDlgItemMessage(
  85. hDlg,
  86. IDC_COMBO1,
  87. CB_INSERTSTRING, 0, (long)gCamEvent[0].pszEvent);
  88. SendDlgItemMessage(
  89. hDlg,
  90. IDC_COMBO1,
  91. CB_INSERTSTRING, 1, (long)gCamEvent[1].pszEvent);
  92. SendDlgItemMessage(
  93. hDlg,
  94. IDC_COMBO1,
  95. CB_INSERTSTRING, 2, (long)gCamEvent[2].pszEvent);
  96. SendDlgItemMessage(hDlg, IDC_COMBO1, CB_SETCURSEL, 0, 0);
  97. pDevice = (IrUsdDevice*)lParam;
  98. pDevice->m_hDlg = hDlg;
  99. SetDlgItemText(hDlg, IDC_EDIT1, gpszPath);
  100. }
  101. break;
  102. case WM_COMMAND:
  103. switch(wParam)
  104. {
  105. case IDCANCEL:
  106. case IDOK:
  107. {
  108. //if (IDYES == MessageBox( hDlg, TEXT("Are you sure you want to close the event dialog?"), TEXT("IR Camera"), MB_ICONQUESTION|MB_YESNOCANCEL ))
  109. EndDialog( hDlg, wParam );
  110. }
  111. break;
  112. case IDD_GEN_EVENT:
  113. {
  114. //
  115. // if event is not already set
  116. //
  117. //
  118. // get selected
  119. //
  120. int i = SendDlgItemMessage(
  121. hDlg,
  122. IDC_COMBO1,
  123. CB_GETCURSEL, 0, 0);
  124. pDevice->m_guidLastEvent = *gCamEvent[i].pguid;
  125. //
  126. // private event
  127. //
  128. if (IsEqualIID(pDevice->m_guidLastEvent,WIA_EVENT_NAME_CHANGE))
  129. {
  130. UINT ui = GetDlgItemText( hDlg, IDC_EDIT1, gpszPath, MAX_PATH );
  131. }
  132. SetEvent(pDevice->m_hSignalEvent);
  133. WIAS_TRACE((g_hInst,"CameraEventDlgProc(): SetEvent()"));
  134. return TRUE;
  135. }
  136. }
  137. break;
  138. }
  139. return FALSE;
  140. }