newclient.cpp 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. // newclient.cpp : Defines the class behaviors for the application.
  2. //
  3. #include "stdafx.h"
  4. #include "newclient.h"
  5. #include "newclientDlg.h"
  6. #ifdef _DEBUG
  7. #define new DEBUG_NEW
  8. #undef THIS_FILE
  9. static char THIS_FILE[] = __FILE__;
  10. #endif
  11. /////////////////////////////////////////////////////////////////////////////
  12. // CNewclientApp
  13. BEGIN_MESSAGE_MAP(CNewclientApp, CWinApp)
  14. //{{AFX_MSG_MAP(CNewclientApp)
  15. // NOTE - the ClassWizard will add and remove mapping macros here.
  16. // DO NOT EDIT what you see in these blocks of generated code!
  17. //}}AFX_MSG
  18. ON_COMMAND(ID_HELP, CWinApp::OnHelp)
  19. END_MESSAGE_MAP()
  20. /////////////////////////////////////////////////////////////////////////////
  21. // CNewclientApp construction
  22. CNewclientApp::CNewclientApp()
  23. {
  24. // TODO: add construction code here,
  25. // Place all significant initialization in InitInstance
  26. }
  27. /////////////////////////////////////////////////////////////////////////////
  28. // The one and only CNewclientApp object
  29. CNewclientApp theApp;
  30. /////////////////////////////////////////////////////////////////////////////
  31. // CNewclientApp initialization
  32. BOOL CNewclientApp::InitInstance()
  33. {
  34. AfxEnableControlContainer();
  35. // Standard initialization
  36. // If you are not using these features and wish to reduce the size
  37. // of your final executable, you should remove from the following
  38. // the specific initialization routines you do not need.
  39. #ifdef _AFXDLL
  40. Enable3dControls(); // Call this when using MFC in a shared DLL
  41. #else
  42. Enable3dControlsStatic(); // Call this when linking to MFC statically
  43. #endif
  44. NET_DVR_Init();
  45. int isupport = NET_DVR_IsSupport();
  46. if (!(isupport & NET_DVR_SUPPORT_DDRAW))
  47. {
  48. AfxMessageBox("显卡无法支持");
  49. return FALSE;
  50. }
  51. if (!(isupport & NET_DVR_SUPPORT_SSE))
  52. {
  53. AfxMessageBox("硬件无法支持,需要PIII及PIII以上CPU");
  54. return FALSE;
  55. }
  56. if (!(isupport & NET_DVR_SUPPORT_BLT))
  57. {
  58. AfxMessageBox("显卡无法支持");
  59. return FALSE;
  60. }
  61. if(!F_GetSystemInfo())
  62. {
  63. AfxMessageBox("获取系统信息错误!");
  64. }
  65. CNewclientDlg dlg;
  66. m_pMainWnd = &dlg;
  67. int nResponse = dlg.DoModal();
  68. if (nResponse == IDOK)
  69. {
  70. // TODO: Place code here to handle when the dialog is
  71. // dismissed with OK
  72. }
  73. else if (nResponse == IDCANCEL)
  74. {
  75. // TODO: Place code here to handle when the dialog is
  76. // dismissed with Cancel
  77. }
  78. // Since the dialog has been closed, return FALSE so that we exit the
  79. // application, rather than start the application's message pump.
  80. return FALSE;
  81. }
  82. BOOL CNewclientApp::F_GetSystemInfo()
  83. {
  84. DWORD dw=GetLogicalDriveStrings(0,NULL);
  85. LPTSTR pAllDrivers=new char[dw];
  86. ::GetLogicalDriveStrings(dw,pAllDrivers);
  87. LPTSTR pDriver=pAllDrivers;
  88. char tempDriver[26];
  89. DWORD DriverNum=0;
  90. while(pDriver[0]!=0)
  91. {
  92. tempDriver[DriverNum++]=*pDriver;
  93. pDriver=_tcschr(pDriver,0)+1; //定位到下一个盘符
  94. }
  95. //volume information
  96. TCHAR lpVolumeNameBuffer[200];
  97. DWORD dwVolumeSerialNumber,dwMaxComLength;
  98. DWORD dwFileSystemFlags;
  99. TCHAR lpFileSystemNameBuffer[50];
  100. DWORD HardNum=0;
  101. for(DWORD num=0;num<DriverNum;num++)
  102. {
  103. CString csRootPath;
  104. csRootPath.Format("%c%s",tempDriver[num],":\\");
  105. if(GetDriveType(csRootPath)==DRIVE_FIXED)
  106. {
  107. if(GetVolumeInformation(csRootPath,lpVolumeNameBuffer,sizeof(lpVolumeNameBuffer),&dwVolumeSerialNumber,
  108. &dwMaxComLength,&dwFileSystemFlags,lpFileSystemNameBuffer,sizeof(lpFileSystemNameBuffer)))
  109. {
  110. this->m_cHardDriver[HardNum++]=tempDriver[num];
  111. }
  112. }
  113. }
  114. m_iDriverNum=HardNum;
  115. delete[] pAllDrivers;
  116. return TRUE;
  117. }
  118. int CNewclientApp::ExitInstance()
  119. {
  120. // TODO: Add your specialized code here and/or call the base class
  121. NET_DVR_Cleanup();
  122. return CWinApp::ExitInstance();
  123. }