diff --git a/TegraRcmGUI.rc b/TegraRcmGUI.rc index 8890aa2..9caaf84 100644 Binary files a/TegraRcmGUI.rc and b/TegraRcmGUI.rc differ diff --git a/TegraRcmGUIDlg.cpp b/TegraRcmGUIDlg.cpp index 04d123e..c3ba047 100644 --- a/TegraRcmGUIDlg.cpp +++ b/TegraRcmGUIDlg.cpp @@ -21,6 +21,7 @@ BOOL WAITING_RECONNECT = FALSE; BOOL AUTOINJECT_CURR= FALSE; BOOL PREVENT_AUTOINJECT= TRUE; BOOL DELAY_AUTOINJECT = FALSE; +BOOL ASK_FOR_DRIVER = FALSE; CString csPath; // CTegraRcmGUIDlg dialog @@ -59,6 +60,8 @@ BOOL CTegraRcmGUIDlg::OnInitDialog() { CDialog::OnInitDialog(); + EnableActiveAccessibility(); + TCHAR szPath[_MAX_PATH]; VERIFY(::GetModuleFileName(AfxGetApp()->m_hInstance, szPath, _MAX_PATH)); CString csPathf(szPath); @@ -100,20 +103,14 @@ BOOL CTegraRcmGUIDlg::OnInitDialog() } } - // Set the icon for this dialog. The framework does this automatically - // when the application's main window is not a dialog SetIcon(m_hIcon, TRUE); // Set big icon SetIcon(m_hIcon, FALSE); // Set small icon - // TODO: Add extra initialization here CTegraRcmGUIDlg::StartTimer(); - return TRUE; // return TRUE unless you set the focus to a control + return TRUE; } - - - void CTegraRcmGUIDlg::OnSysCommand(UINT nID, LPARAM lParam) { CDialog::OnSysCommand(nID, lParam); @@ -224,8 +221,13 @@ void CTegraRcmGUIDlg::OnTimer(UINT nIDEvent) pCtrl3->ShowWindow(SW_HIDE); this->GetDlgItem(IDC_INJECT)->EnableWindow(FALSE); this->GetDlgItem(IDC_SHOFEL2)->EnableWindow(FALSE); - s = "Install lbusbK driver (download Zadig)"; - + s = "lbusbK driver is needed !"; + if (!ASK_FOR_DRIVER) + { + ASK_FOR_DRIVER = TRUE; + InstallDriver(); + + } } else { @@ -507,3 +509,28 @@ void CTegraRcmGUIDlg::SetPreset(string param, string value) remove(rfile_c); rename(wfile_c, rfile_c); } + + +void CTegraRcmGUIDlg::InstallDriver() +{ + CString message = _T("APX device driver is missing. Do you want to install it now ?"); + const int result = MessageBox(message, _T("APX driver not found !"), MB_YESNOCANCEL | MB_ICONQUESTION); + if (result == IDYES) + { + SHELLEXECUTEINFO shExInfo = { 0 }; + shExInfo.cbSize = sizeof(shExInfo); + shExInfo.fMask = SEE_MASK_NOCLOSEPROCESS; + shExInfo.hwnd = 0; + shExInfo.lpVerb = _T("runas"); + CString exe_file = csPath + _T("\\apx_driver\\InstallDriver.exe"); + shExInfo.lpFile = exe_file; + shExInfo.lpDirectory = 0; + shExInfo.nShow = SW_SHOW; + shExInfo.hInstApp = 0; + + if (ShellExecuteEx(&shExInfo)) + { + CloseHandle(shExInfo.hProcess); + } + } +} diff --git a/TegraRcmGUIDlg.h b/TegraRcmGUIDlg.h index c91f754..c0843e4 100644 --- a/TegraRcmGUIDlg.h +++ b/TegraRcmGUIDlg.h @@ -62,4 +62,5 @@ public: afx_msg void OnBnClickedShofel2(); afx_msg string GetPreset(string param); afx_msg void SetPreset(string param, string value); + afx_msg void InstallDriver(); };