Leaked source code of windows server 2003
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.

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