From: Drakier D. <dra...@us...> - 2004-02-13 23:45:11
|
Log Message: ----------- Added MORE error checking... Modified Files: -------------- /cvsroot/decaldev/source/DenAgent: ExportDlg.cpp Revision Data ------------- Index: ExportDlg.cpp =================================================================== RCS file: /cvsroot/decaldev/source/DenAgent/ExportDlg.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- ExportDlg.cpp 13 Feb 2004 00:08:07 -0000 1.3 +++ ExportDlg.cpp 13 Feb 2004 23:39:12 -0000 1.4 @@ -86,7 +86,10 @@ { USES_CONVERSION; std::string szDelim = ", "; - + // Set Cursor + HCURSOR hCurDefault = GetCursor(); + HCURSOR hCurWaiting = LoadCursor(NULL, IDC_WAIT); + SetCursor(hCurWaiting); // Drakier: Get plugins/filters/services/etc from decal cPluginGroup _groups[] = { @@ -112,7 +115,7 @@ if ( ::SendMessage( GetDlgItem( IDC_CHKCLSID )->m_hWnd, BM_GETCHECK, 0, 0 ) ) szOutput += "clsid"; szOutput += "\r\n"; - //::SendMessage( GetDlgItem( IDC_EDITEXPORT )->m_hWnd, WM_SETTEXT, 0, (LPARAM)szOutput.c_str() ); + //::SendMessage( GetDlgItem( IDC_EDITEXPORT )->m_hWnd, WM_SETTEXT, 0, (LPARAM)szOutput.c_str() ); AppendExportText(szOutput.c_str()); // Go through all the groups exporting their sub-lists @@ -128,17 +131,23 @@ szOutput = ""; CLSID clsid; CComBSTR strName; - CString strDLL; - CString strDLLVersion; + CString strDLL = ""; + CString strDLLVersion = ""; LPOLESTR szCLSID; hRes = pEnum->get_ComClass ( &clsid ); _ASSERTE ( SUCCEEDED ( hRes ) ); - if ( !CDenAgentApp::getCOMObjectDLL ( clsid, strDLL ) ) - strDLL = "<No DLL>"; - if ( !CDenAgentApp::getVersionString ( strDLL, strDLLVersion ) ) - strDLLVersion = _T( "<No Version>" ); + if (hRes == S_OK) + { + if ( CDenAgentApp::getCOMObjectDLL ( clsid, strDLL ) ) + { + if ( !CDenAgentApp::getVersionString ( strDLL, strDLLVersion ) ) + strDLLVersion = _T( "<No Version>" ); + } + else + strDLL = _T( "<No DLL>" ); + } szOutput += i->m_groupName; @@ -154,7 +163,10 @@ hRes = pEnum->get_FriendlyName( &strName ); _ASSERTE ( SUCCEEDED ( hRes ) ); szOutput += szDelim; - szOutput += OLE2T ( strName ); + if (hRes == S_OK) + szOutput += OLE2T ( strName ); + else + szOutput += "<No Name>"; szOutput += szDelim; szOutput += strDLLVersion; @@ -167,10 +179,14 @@ if ( ::SendMessage( GetDlgItem( IDC_CHKCLSID )->m_hWnd, BM_GETCHECK, 0, 0 ) ) { - StringFromCLSID(clsid, &szCLSID); szOutput += szDelim; - szOutput += OLE2T(szCLSID); - ::CoTaskMemFree ( szCLSID ); + if ( StringFromCLSID(clsid, &szCLSID) == S_OK ) + { + szOutput += OLE2T(szCLSID); + ::CoTaskMemFree ( szCLSID ); + } + else + szOutput += "<No CLSID>"; } szOutput += "\r\n"; //::SendMessage( GetDlgItem( IDC_EDITEXPORT )->m_hWnd, WM_SETTEXT, 0, (LPARAM)szOutput.c_str() ); @@ -407,6 +423,8 @@ szOutput += "NEW\r\n"; } } + else + szOutput += "Error Reading Key"; key.Close(); } //::SendMessage( GetDlgItem( IDC_EDITEXPORT )->m_hWnd, WM_SETTEXT, 0, (LPARAM)szOutput.c_str() ); @@ -423,13 +441,16 @@ else { char strDllFilePath[MAX_PATH] = {""}; - CString strDLLVersion; + CString strDLLVersion = ""; GetModuleFileName(hLib, strDllFilePath, MAX_PATH); if ( !CDenAgentApp::getVersionString ( strDllFilePath, strDLLVersion ) ) strDLLVersion = _T( "(No Version)" ); - szOutput += "Installed ("; - szOutput += strDLLVersion; - szOutput += ")\r\n"; + else + { + szOutput += "Installed ("; + szOutput += strDLLVersion; + szOutput += ")\r\n"; + } } ::FreeLibrary(hLib); AppendExportText(szOutput.c_str()); @@ -442,13 +463,16 @@ else { char strDllFilePath[MAX_PATH] = {""}; - CString strDLLVersion; + CString strDLLVersion = ""; GetModuleFileName(hLib, strDllFilePath, MAX_PATH); if ( !CDenAgentApp::getVersionString ( strDllFilePath, strDLLVersion ) ) strDLLVersion = _T( "(No Version)" ); - szOutput += "Installed ("; - szOutput += strDLLVersion; - szOutput += ")\r\n"; + else + { + szOutput += "Installed ("; + szOutput += strDLLVersion; + szOutput += ")\r\n"; + } } ::FreeLibrary(hLib); AppendExportText(szOutput.c_str()); @@ -461,13 +485,16 @@ else { char strDllFilePath[MAX_PATH] = {""}; - CString strDLLVersion; + CString strDLLVersion = ""; GetModuleFileName(hLib, strDllFilePath, MAX_PATH); if ( !CDenAgentApp::getVersionString ( strDllFilePath, strDLLVersion ) ) strDLLVersion = _T( "(No Version)" ); - szOutput += "Installed ("; - szOutput += strDLLVersion; - szOutput += ")\r\n"; + else + { + szOutput += "Installed ("; + szOutput += strDLLVersion; + szOutput += ")\r\n"; + } } ::FreeLibrary(hLib); AppendExportText(szOutput.c_str()); @@ -480,13 +507,16 @@ else { char strDllFilePath[MAX_PATH] = {""}; - CString strDLLVersion; + CString strDLLVersion = ""; GetModuleFileName(hLib, strDllFilePath, MAX_PATH); if ( !CDenAgentApp::getVersionString ( strDllFilePath, strDLLVersion ) ) strDLLVersion = _T( "(No Version)" ); - szOutput += "Installed ("; - szOutput += strDLLVersion; - szOutput += ")\r\n"; + else + { + szOutput += "Installed ("; + szOutput += strDLLVersion; + szOutput += ")\r\n"; + } } ::FreeLibrary(hLib); AppendExportText(szOutput.c_str()); @@ -499,13 +529,16 @@ else { char strDllFilePath[MAX_PATH] = {""}; - CString strDLLVersion; + CString strDLLVersion = ""; GetModuleFileName(hLib, strDllFilePath, MAX_PATH); if ( !CDenAgentApp::getVersionString ( strDllFilePath, strDLLVersion ) ) strDLLVersion = _T( "(No Version)" ); - szOutput += "Installed ("; - szOutput += strDLLVersion; - szOutput += ")\r\n"; + else + { + szOutput += "Installed ("; + szOutput += strDLLVersion; + szOutput += ")\r\n"; + } } ::FreeLibrary(hLib); AppendExportText(szOutput.c_str()); @@ -519,13 +552,16 @@ else { char strDllFilePath[MAX_PATH] = {""}; - CString strDLLVersion; + CString strDLLVersion = ""; GetModuleFileName(hLib, strDllFilePath, MAX_PATH); if ( !CDenAgentApp::getVersionString ( strDllFilePath, strDLLVersion ) ) strDLLVersion = _T( "(No Version)" ); - szOutput += "Installed ("; - szOutput += strDLLVersion; - szOutput += ")\r\n"; + else + { + szOutput += "Installed ("; + szOutput += strDLLVersion; + szOutput += ")\r\n"; + } } ::FreeLibrary(hLib); AppendExportText(szOutput.c_str()); @@ -538,13 +574,16 @@ else { char strDllFilePath[MAX_PATH] = {""}; - CString strDLLVersion; + CString strDLLVersion = ""; GetModuleFileName(hLib, strDllFilePath, MAX_PATH); if ( !CDenAgentApp::getVersionString ( strDllFilePath, strDLLVersion ) ) strDLLVersion = _T( "(No Version)" ); - szOutput += "Installed ("; - szOutput += strDLLVersion; - szOutput += ")\r\n"; + else + { + szOutput += "Installed ("; + szOutput += strDLLVersion; + szOutput += ")\r\n"; + } } ::FreeLibrary(hLib); AppendExportText(szOutput.c_str()); @@ -557,13 +596,16 @@ else { char strDllFilePath[MAX_PATH] = {""}; - CString strDLLVersion; + CString strDLLVersion = ""; GetModuleFileName(hLib, strDllFilePath, MAX_PATH); if ( !CDenAgentApp::getVersionString ( strDllFilePath, strDLLVersion ) ) strDLLVersion = _T( "(No Version)" ); - szOutput += "Installed ("; - szOutput += strDLLVersion; - szOutput += ")\r\n"; + else + { + szOutput += "Installed ("; + szOutput += strDLLVersion; + szOutput += ")\r\n"; + } } ::FreeLibrary(hLib); AppendExportText(szOutput.c_str()); @@ -576,13 +618,16 @@ else { char strDllFilePath[MAX_PATH] = {""}; - CString strDLLVersion; + CString strDLLVersion = ""; GetModuleFileName(hLib, strDllFilePath, MAX_PATH); if ( !CDenAgentApp::getVersionString ( strDllFilePath, strDLLVersion ) ) strDLLVersion = _T( "(No Version)" ); - szOutput += "Installed ("; - szOutput += strDLLVersion; - szOutput += ")\r\n"; + else + { + szOutput += "Installed ("; + szOutput += strDLLVersion; + szOutput += ")\r\n"; + } } ::FreeLibrary(hLib); AppendExportText(szOutput.c_str()); @@ -599,13 +644,16 @@ else { char strDllFilePath[MAX_PATH] = {""}; - CString strDLLVersion; + CString strDLLVersion = ""; GetModuleFileName(hLib, strDllFilePath, MAX_PATH); if ( !CDenAgentApp::getVersionString ( strDllFilePath, strDLLVersion ) ) strDLLVersion = _T( "(No Version)" ); - szOutput += "Installed ("; - szOutput += strDLLVersion; - szOutput += ")\r\n"; + else + { + szOutput += "Installed ("; + szOutput += strDLLVersion; + szOutput += ")\r\n"; + } } ::FreeLibrary(hLib); AppendExportText(szOutput.c_str()); @@ -618,13 +666,16 @@ else { char strDllFilePath[MAX_PATH] = {""}; - CString strDLLVersion; + CString strDLLVersion = ""; GetModuleFileName(hLib, strDllFilePath, MAX_PATH); if ( !CDenAgentApp::getVersionString ( strDllFilePath, strDLLVersion ) ) strDLLVersion = _T( "(No Version)" ); - szOutput += "Installed ("; - szOutput += strDLLVersion; - szOutput += ")\r\n"; + else + { + szOutput += "Installed ("; + szOutput += strDLLVersion; + szOutput += ")\r\n"; + } } ::FreeLibrary(hLib); AppendExportText(szOutput.c_str()); @@ -672,6 +723,9 @@ } key.Close(); + // Set Cursor back... + SetCursor(hCurDefault); + // Display information if (::MessageBox(NULL, "Would you like to export the data to the clipboard?", "Export Data...", MB_YESNO | MB_ICONQUESTION) == IDYES ) { |