LRESULT CRenameDialog::OnClose(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/) { CEdit wndName(GetDlgItem(IDC_DEVICE_NAME)); _ASSERTE(NULL != wndName.m_hWnd); wndName.GetWindowText(m_szName, MAX_NAME_LEN + 1); if (IDOK == wID && 0 != ::lstrcmp(m_szOldName, m_szName)) { // name is changed! // check duplicate ndas::Device* pExistingDevice = _pDeviceColl->FindDeviceByName(m_szName); if (NULL != pExistingDevice) { pExistingDevice->Release(); AtlMessageBox( m_hWnd, IDS_ERROR_DUPLICATE_NAME, IDS_MAIN_TITLE, MB_OK | MB_ICONWARNING); m_wndName.SetFocus(); m_wndName.SetSel(0, -1); return 0; } } EndDialog(wID); return 0; }
/// \see http://stackoverflow.com/questions/324974/in-wia-how-can-i-add-my-program-in-the-program-list-of-acquiring-images-from-a void App::RegisterWIAHandler(bool bRegister) { CComPtr<IWiaDevMgr> spWiaDevMgr; HRESULT hr = spWiaDevMgr.CoCreateInstance(CLSID_WiaDevMgr, NULL, CLSCTX_LOCAL_SERVER); if (FAILED(hr)) return; CComBSTR bstrCommandline(_T("\"") + Path::ModuleFilename() + _T("\" --open-wia \"%1\" \"%2\"")); CComBSTR bstrName(CString(MAKEINTRESOURCE(IDR_MAINFRAME))); CComBSTR bstrDescription(CString(MAKEINTRESOURCE(IDR_WIA_DESC))); CComBSTR bstrIcon(Path::ModuleFilename() + _T(",0")); hr = spWiaDevMgr->RegisterEventCallbackProgram( bRegister ? WIA_REGISTER_EVENT_CALLBACK : WIA_UNREGISTER_EVENT_CALLBACK, NULL, &WIA_EVENT_DEVICE_CONNECTED, bstrCommandline, bstrName, bstrDescription, bstrIcon); // when this fails, the user isn't an elevated user if (FAILED(hr)) AtlMessageBox(NULL, _T("Error registering/unregisterin WIA event! Are you administrator?"), IDR_MAINFRAME, MB_OK); }
bool HDRPhotoModeManager::CheckManualMode() { ShootingMode mode(m_spRemoteReleaseControl); // shooting mode change supported? if (!mode.IsSupportedChanging()) { // no, notify user to switch to M ImageProperty shootingModeM = mode.Manual(); ImageProperty currentShootingMode = mode.Current(); if (currentShootingMode != shootingModeM) { AtlMessageBox(m_hWnd, _T("Please switch to Manual mode on camera!"), IDR_MAINFRAME, MB_OK); return false; } } else { // yes, switch to M try { ImageProperty shootingModeM = mode.Manual(); m_spRemoteReleaseControl->SetImageProperty(shootingModeM); } catch (CameraException& ex) { CameraErrorDlg dlg(_T("Couldn't switch to Manual mode"), ex); dlg.DoModal(m_hWnd); return false; } } return true; }
PSDash::_void CLoginDlg::OnValidateResult( _dword byCode ) { if(byCode != AP_E_ValidateSucc) { AtlMessageBox(m_hWnd,(LPCTSTR)GetFramework()->GetError(byCode)); } }
bool CScriptEditView::OnFileSaveAs() { bool bRet = false; TCHAR szFilter[256]; ::ZeroMemory( szFilter, DIMOF(szFilter) ); int nChar = AtlLoadString( IDS_FILE_FILTER, szFilter, DIMOF(szFilter) ); DWORD dwFlags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT; CFileDialog dlg( FALSE, _T("*.txt"), m_szFilePath, dwFlags, szFilter ); if( dlg.DoModal() == IDOK ) { ATLTRACE( _T("File path: %s\n"), dlg.m_ofn.lpstrFile ); bRet = SaveFile( dlg.m_szFileName ); if( bRet ) { Init( dlg.m_szFileName, dlg.m_szFileTitle ); } else { AtlMessageBox( WtlGetMainWnd(), IDS_WRITE_FILE_FAILED, IDR_MAINFRAME, MB_OK|MB_ICONERROR ); } } return bRet; }
void HDRPhotoModeManager::OnReleasedAEBLast() { // close viewfinder, if used at all m_spViewfinder.reset(); m_bAEBInProgress = false; // now send images to Photomatix PhotomatixInterface pi(m_host.GetAppSettings().m_cszPhotomatixPath); if (!pi.IsInstalled()) { AtlMessageBox(m_hWnd, _T("Photomatix is not installed"), IDR_MAINFRAME, MB_OK); return; } m_host.SetStatusText(_T("Starting Photomatix...")); pi.RunUI(m_vecAEBFilenameList); // enable viewfinder again when active if (m_bViewfinderActiveBeforeStart) { ViewFinderView* pViewfinder = m_host.GetViewFinderView(); if (pViewfinder != NULL) pViewfinder->EnableUpdate(true); m_bViewfinderActiveBeforeStart = false; } }
int Run(LPTSTR /*lpstrCmdLine*/ = NULL, int nCmdShow = SW_SHOWDEFAULT) { if( !RunTimeHelper::IsVista() ) { AtlMessageBox(NULL, L"Windows Vista or greater is required to run this program."); return 0; } CDwm dwm; cIsComposited = dwm.DwmIsCompositionEnabled()!=FALSE; CMessageLoop theLoop; _Module.AddMessageLoop(&theLoop); int basex = 314;//320 int basey = 290;//285 CMainFrame frame; if( frame.CreateEx(0, CRect(0, 0, basex, basey))==NULL ) { ATLTRACE(_T("Main window creation failed!\n")); return 0; } _wndMain = frame; _wndMain.ShowWindow(nCmdShow); int nRet = theLoop.Run(); _Module.RemoveMessageLoop(); return nRet; }
LRESULT CDeviceRenameDialog::OnClose(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/) { CEdit wndName(GetDlgItem(IDC_DEVICE_NAME)); wndName.GetWindowText(m_szName, MAX_NAME_LEN + 1); if (IDOK == wID && 0 != ::lstrcmp(m_szOldName, m_szName)) { // // name is changed! check duplicate // ndas::DevicePtr pExistingDevice; if (ndas::FindDeviceByName(pExistingDevice, m_szName)) { AtlMessageBox( m_hWnd, IDS_ERROR_DUPLICATE_NAME, IDS_MAIN_TITLE, MB_OK | MB_ICONWARNING); m_wndName.SetFocus(); m_wndName.SetSel(0, -1); return 0; } } EndDialog(wID); return 0; }
PSDash::_void CLoginDlg::OnCreateSessionResult( _dword dwCode ) { if(GetFramework()->GetLocalPSUID().IDType() == PSUID_GameServer) { return; } if(dwCode != E_SP_SUCCESS) { AtlMessageBox(m_hWnd,(LPCTSTR)GetFramework()->GetError(dwCode)); } else { BSTR Username = NULL, Password = NULL; GetDlgItemText(IDC_USERNAME, Username); GetDlgItemText(IDC_PASSWORD, Password); if(Username == NULL) Username = L""; if(Password == NULL) Password = L""; m_cfg.Set(L"Config", L"UserName",Username); m_cfg.Set(L"Config", L"Password",Password); GetLogWindow().SetParent(NULL); DestroyWindow(); AtlTrace(L"[LOGINDLG] Post Quit MSG 1\n"); ::PostQuitMessage(1); } }
INT CAppOptGeneralPage::OnApply() { BOOL fSuccess = FALSE; ATLTRACE("CAppOptGeneral::OnApply\n"); BOOL fUseDisconnectAlert = (BST_CHECKED == m_wndAlertDisconnect.GetCheck()); BOOL fUseReconnectAlert = (BST_CHECKED == m_wndAlertReconnect.GetCheck()); pSetAppConfigValue(_T("UseDisconnectAlert"), fUseDisconnectAlert); pSetAppConfigValue(_T("UseReconnectAlert"), fUseReconnectAlert); if (m_disableAutoPlay != TriStateUnknown) { TRI_STATE newState = (BST_CHECKED == m_wndDisableAutoPlay.GetCheck()) ? TriStateYes : TriStateNo; if (m_disableAutoPlay != newState) { CComPtr<IAutoPlayConfig> pAutoPlayConfig; HRESULT hr = CoCreateInstanceAsAdmin(m_hWnd, CLSID_CAutoPlayConfig, IID_IAutoPlayConfig, (void**) &pAutoPlayConfig); if (FAILED(hr)) { ATLTRACE("CoCreateInstanceAsAdmin failed, hr=0x%X\n", hr); } else { hr = pAutoPlayConfig->SetNoDriveTypeAutoRun( reinterpret_cast<ULONG_PTR>(HKEY_CURRENT_USER), AutorunFixedDrive, newState == TriStateYes ? AutorunFixedDrive : 0); if (FAILED(hr)) { ATLTRACE("IID_IAutoPlayConfig.SetNoDriveTypeAutoRun failed, hr=0x%X\n", hr); } } } } INT nSelItem = m_wndUILangList.GetCurSel(); DWORD_PTR dwSelLangID = m_wndUILangList.GetItemData(nSelItem); if (m_wConfigLangID != (LANGID) dwSelLangID) { pSetAppConfigValue(_T("Language"), (DWORD)dwSelLangID); AtlMessageBox( m_hWnd, IDS_LANGUAGE_CHANGE, IDS_MAIN_TITLE, MB_OK | MB_ICONINFORMATION); } return PSNRET_NOERROR; }
void PanoramaPhotoModeManager::StartPanorama() { HuginInterface hi(m_host.GetAppSettings().m_cszHuginPath); if (!hi.IsInstalled()) AtlMessageBox(m_hWnd, _T("Hugin is not installed; panorama pictures will not be stitched at the end."), IDR_MAINFRAME, MB_OK); m_bStarted = true; m_vecPanoramaFilenameList.clear(); }
void CApplicationImpl::RemoveItems(int* pBuf, int nSize, bool bConfirm /*= true*/, bool bRemove /*= true*/) { if (bConfirm && IDCANCEL == AtlMessageBox(GetMainViewHwnd(), IDS_DELETION_CONFIRM, IDR_MAINFRAME, MB_OKCANCEL | MB_ICONQUESTION)) { return; } CWaitCursor wc; CItems::Delete(std::vector<int>(pBuf, pBuf + nSize), bRemove); }
LRESULT CChildFrame::OnFileDelNode(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) { USES_CONVERSION; wNotifyCode, wID, hWndCtl, bHandled; HRESULT hr = E_FAIL; ATLTRACE(_T("CChildFrame::OnFileDelNode\r\n")); TREE_ITEM_DATA * pTmp = NULL; TREE_ITEM_DATA * pParent = NULL; LPBYTE pFileData = NULL; HANDLE hFile = NULL; do { pTmp = (TREE_ITEM_DATA *)m_pData.GetData(); if (NULL == pTmp) { break; } pParent = (TREE_ITEM_DATA *) m_pData.GetParent().GetData(); if (NULL == pParent) { AtlMessageBox(*this, IDS_DEL_NODE, IDS_WARNING); break; } if (IDOK != AtlMessageBox(*this, IDS_CONFORM, IDS_WARNING, MB_OKCANCEL)) { break; } ATLASSERT(pParent->dwStgType == STGTY_STORAGE); CComPtr<IStorage> spParent; hr = pParent->spStgOrStrm->QueryInterface(&spParent); if (FAILED(hr)) { break; } TCHAR szName[MAX_PATH] = { 0 }; m_pData.GetText(szName, _countof(szName)); hr = spParent->DestroyElement( T2CW(szName) ); if (FAILED(hr)) { break; } m_wndCatalog.DeleteItem(m_pData.m_hTreeItem); } while (FALSE); return 0; }
PSDash::_void CLoginDlg::OnConnectIS( _bool bConnect, const PSUID is_id, _dword Reason, const _char *desp /*= _null*/ ) { GetDlgItem(IDC_BUTTON4).EnableWindow(TRUE); GetDlgItem(IDC_USERNAME).SetFocus(); if(bConnect) { GetDlgItem(IDC_BUTTON4).SetWindowText(L"Disconnect"); if(StringPtr(desp).Length()>0) AtlMessageBox(m_hWnd, desp); GetDlgItem(IDC_APPID).EnableWindow(FALSE); GetDlgItem(IDC_SUBID).EnableWindow(FALSE); GetDlgItem(IDC_COMBO1).EnableWindow(FALSE); } else { GetDlgItem(IDC_BUTTON4).SetWindowText(L"Connect"); AtlMessageBox(m_hWnd, (LPCTSTR)GetFramework()->GetError(Reason)); } }
bool PanoramaPhotoModeView::CanClose() const { if (!m_manager.IsStarted()) return true; // ask to cancel panorama int iRet = AtlMessageBox(m_hWnd, _T("A panorama shooting is in progress. Do you want to abort taking the panorama?"), IDR_MAINFRAME, MB_YESNO | MB_ICONQUESTION); if (iRet == IDNO) return false; return true; }
bool MainFrame::DoFileOpen(LPCTSTR lpstrFileName, LPCTSTR lpstrFileTitle) { bool bRet = m_view.Load(lpstrFileName) != FALSE; if (bRet) { m_view.Init(lpstrFileName, lpstrFileTitle); UpdateTitle(); } else { CString cszText; cszText.Format(_T("Error reading file!\nFilename: %s"), lpstrFileName); AtlMessageBox(m_hWnd, cszText.GetString(), IDR_MAINFRAME, MB_OK | MB_ICONERROR); } return bRet; }
bool LuaScriptEditorView::DoFileSaveAs() { CFileDialog dlg(FALSE, NULL, m_cszFilePath, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, g_pszLuaScriptingFilter, m_hWnd); int iRet = dlg.DoModal(m_hWnd); if (iRet != IDOK) return false; bool bRet = Save(dlg.m_ofn.lpstrFile) != FALSE; if (bRet) Init(dlg.m_ofn.lpstrFile, dlg.m_ofn.lpstrFileTitle); else AtlMessageBox(m_hWnd, _T("Error writing file!\n"), IDR_MAINFRAME, MB_OK | MB_ICONERROR); return bRet; }
bool LuaScriptEditorView::QueryClose() { if (!GetModify()) return true; CWindow wndMain(GetParent()); CString cszText; cszText.Format(_T("Save changes to %s ?"), m_cszFileTitle.GetString()); int iRet = AtlMessageBox(wndMain, cszText.GetString(), IDR_MAINFRAME, MB_YESNOCANCEL | MB_ICONQUESTION); if (iRet == IDCANCEL) return false; else if (iRet == IDYES && !DoFileSaveAs()) return false; return true; }
void CMainFrame::OnCmdMountDeviceRW(NDAS_LOGICALDEVICE_ID logDeviceId) { ndas::LogicalDevicePtr pLogDevice; if (!ndas::FindLogicalDevice(pLogDevice, logDeviceId)) { ATLTRACE("Invalid logical device id specified: %d\n", logDeviceId); return; } if (!pLogDevice->PlugIn(TRUE)) { if (NDASSVC_ERROR_MULTIPLE_WRITE_ACCESS_NOT_ALLOWED == ::GetLastError()) { int response = AtlMessageBox( m_hWnd, IDS_REQUEST_SURRENDER_RW_ACCESS, IDS_MAIN_TITLE, MB_YESNO | MB_ICONEXCLAMATION); if (IDYES == response) { pRequestSurrenderAccess(m_hWnd,pLogDevice); } } else { ErrorMessageBox(IDS_ERROR_MOUNT_DEVICE_RW); } return; } // // Wait Mount Dialog // if (!pLogDevice->UpdateStatus()) { // Service Communication failure? return; } if (NDAS_LOGICALDEVICE_STATUS_MOUNT_PENDING == pLogDevice->GetStatus()) { CWaitMountDialog().DoModal(m_hWnd, pLogDevice); } }
LRESULT CServerURLDlg::OnCloseCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/) { m_szURL[0] = _T('0'); if (wID == IDOK) { GetDlgItemText(IDC_URL, m_szURL, sizeof(m_szURL)/sizeof(m_szURL[0])); if (::_tcslen(m_szURL) == 0) { return 0; } CString sURL = m_szURL; sURL.MakeLower(); if (sURL.Find(_T("http://")) != 0 && sURL.Find(_T("https://")) != 0) { AtlMessageBox(m_hWnd, _T("Please enter the fully qualified URL beginning with \"http://\" or \"https://\"")); return 0; } } EndDialog(wID); return 0; }
/// main function int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPTSTR lpstrCmdLine, int nCmdShow) { HRESULT hRes = ::CoInitialize(NULL); ATLASSERT(SUCCEEDED(hRes)); AtlInitCommonControls(ICC_BAR_CLASSES); // add flags to support other controls hRes = _Module.Init(NULL, hInstance); ATLASSERT(SUCCEEDED(hRes)); int ret = 0; if (RunTimeHelper::IsRibbonUIAvailable()) ret = Run(lpstrCmdLine, nCmdShow); else AtlMessageBox(NULL, L"Cannot run with this version of Windows", IDR_MAINFRAME); _Module.Term(); ::CoUninitialize(); return ret; }
int _tWinMain( __in HINSTANCE hInstance, __in_opt HINSTANCE hPrevInstance, __in_opt LPTSTR lpCmdLine, __in int nShowCmd ) { COMVERIFY(CoInitialize(NULL)); // this resolves ATL window thunking problem when Microsoft Layer for Unicode (MSLU) is used (void) DefWindowProc(NULL, 0, 0, 0L); // add flags to support other controls ATLVERIFY(AtlInitCommonControls(ICC_WIN95_CLASSES | ICC_INTERNET_CLASSES)); COMVERIFY(_Module.Init(NULL, hInstance)); int retCode = -1; if (!VerifyNdasComm()) { AtlMessageBox( NULL, IDS_NDASCOMM_NOT_AVAILABLE, IDS_APP_ERROR_TITLE, MB_OK | MB_ICONSTOP); } else { ATLVERIFY( NdasCommInitialize() ); retCode = Run(lpCmdLine, nShowCmd); ATLVERIFY( NdasCommUninitialize() ); } _Module.Term(); CoUninitialize(); return retCode; }
LRESULT CLoginDlg::OnBnConnect(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) { // TODO: Add your control notification handler code here if(GetFramework()->IsConnected()) { GetFramework()->Disconnect(); GetDlgItem(IDC_BUTTON4).SetWindowText(L"Connect"); GetDlgItem(IDC_APPID).EnableWindow(TRUE); GetDlgItem(IDC_SUBID).EnableWindow(TRUE); GetDlgItem(IDC_COMBO1).EnableWindow(TRUE); } else { CComboBox box = GetDlgItem(IDC_COMBO1); BSTR text = NULL; box.GetWindowText(text); if(text == NULL) { AtlMessageBox(m_hWnd, L"Please select a interface server!"); return 0; } box = GetDlgItem(IDC_APPID); int AppID = box.GetCurSel(); box = GetDlgItem(IDC_SUBID); int SubID = box.GetCurSel(); GetFramework()->SetAppInfo(AppID, SubID,1,1); if(CString(L"auto") != text) { GetFramework()->SetISAddress(ClientCommon::StrToAddress(text)); } GetProcessor()->ConnectToIS(); GetDlgItem(IDC_BUTTON4).EnableWindow(FALSE); } return 0; }
bool CScriptEditView::QueryClose() { if( !GetModify() ) return true; TCHAR szFmt[32]; AtlLoadString( IDS_SAVE_MODIFIED, szFmt, DIMOF(szFmt) ); TCHAR szBuff[MAX_PATH + 40]; wsprintf( szBuff, szFmt, m_szFileName ); int nRet = AtlMessageBox( WtlGetMainWnd(), szBuff, IDR_MAINFRAME, MB_YESNOCANCEL | MB_ICONEXCLAMATION ); if(nRet == IDCANCEL) return false; if(nRet == IDYES) return OnFileSave(); return true; }
bool CScriptEditView::DoFileSave() { ATLASSERT( m_szFilePath[0] != 0 ); if( !GetModify() ) return true; bool bRet = SaveFile( m_szFilePath ); if( bRet ) { SetModify( FALSE ); } else { AtlMessageBox( WtlGetMainWnd(), IDS_WRITE_FILE_FAILED, IDR_MAINFRAME, MB_OK|MB_ICONERROR ); } return bRet; }
bool MainFrame::DoFileSave() { if (!m_view.GetFilePath().IsEmpty()) { if (m_view.Save(m_view.GetFilePath())) { m_mru.AddToList(m_view.GetFilePath()); m_mru.WriteToRegistry(c_pszSettingsRegkey); UpdateTitle(); } else { AtlMessageBox(m_hWnd, _T("Error writing file!\n"), IDR_MAINFRAME, MB_OK | MB_ICONERROR); return false; } } else { return DoFileSaveAs(); } return true; }
bool CImportDlg::_ProcessRegistration(NifEntry& entry) { ndas::DevicePtr pExistingDevice; if (ndas::FindDeviceByNdasId(pExistingDevice, entry.DeviceId)) { AtlMessageBox( m_hWnd, IDS_ERROR_DUPLICATE_ENTRY, IDS_MAIN_TITLE, MB_OK | MB_ICONWARNING); return false; } CDeviceRenameDialog renameDlg; while (ndas::FindDeviceByName(pExistingDevice, entry.Name)) { int response = AtlMessageBox( m_hWnd, IDS_ERROR_DUPLICATE_NAME, IDS_MAIN_TITLE, MB_OKCANCEL | MB_ICONWARNING); if (IDOK == response) { renameDlg.SetName(entry.Name); renameDlg.DoModal(m_hWnd); entry.Name = renameDlg.GetName(); } else { return false; } } LPCWSTR lpWriteKey = entry.WriteKey.GetLength() > 0 ? static_cast<LPCTSTR>(entry.WriteKey) : NULL; DWORD dwSlotNo = ::NdasRegisterDevice( entry.DeviceId, lpWriteKey, entry.Name, NDAS_DEVICE_REG_FLAG_NONE); // Registration failure will not close dialog if (0 == dwSlotNo) { ErrorMessageBox(m_hWnd, IDS_ERROR_REGISTER_DEVICE_FAILURE); return false; } // // Enable on register is an optional feature // Even if it's failed, still go on to close. // if (!ndas::UpdateDeviceList()) { DWORD err = ::GetLastError(); ATLTRACE("Enabling device at slot %d failed\n", dwSlotNo); ::SetLastError(err); return false; } ndas::DevicePtr pDevice; if (!ndas::FindDeviceBySlotNumber(pDevice, dwSlotNo)) { DWORD err = ::GetLastError(); ATLTRACE("Enabling device at slot %d failed\n", dwSlotNo); ::SetLastError(err); return false; } if (!pDevice->Enable()) { DWORD err = ::GetLastError(); ATLTRACE("Enabling device at slot %d failed\n", dwSlotNo); ::SetLastError(err); return false; } //CString strMessage; //strMessage.FormatMessage(IDS_IMPORT_SUCCESS, lpszDeviceName); // //AtlMessageBox(m_hWnd, static_cast<LPCTSTR>(strMessage), IDS_MAIN_TITLE); return true; }
int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPTSTR lpstrCmdLine, int nCmdShow) { HRESULT hRes = ::CoInitialize(NULL); // If you are running on NT 4.0 or higher you can use the following call instead to // make the EXE free threaded. This means that calls come in on a random RPC thread. // HRESULT hRes = ::CoInitializeEx(NULL, COINIT_MULTITHREADED); ATLASSERT(SUCCEEDED(hRes)); #ifdef _DEBUG // ATLTRACEで日本語を使うために必要 _tsetlocale( LC_ALL, _T("japanese") ); #endif // this resolves ATL window thunking problem when Microsoft Layer for Unicode (MSLU) is used ::DefWindowProc(NULL, 0, 0, 0L); AtlInitCommonControls(ICC_BAR_CLASSES); // add flags to support other controls // リッチエディットコントロール初期化 HINSTANCE hRich = LoadLibrary(CRichEditCtrl::GetLibraryName()); if(hRich == NULL){ AtlMessageBox(NULL, _T("リッチエディットコントロール初期化失敗"), _T("エラー"), MB_OK | MB_ICONERROR); return 0; } hRes = _Module.Init(NULL, hInstance); ATLASSERT(SUCCEEDED(hRes)); int nRet = 0; try { CVersionControl::Run(); CSettings::LoadSettings(); CSocket::Init(); WinHTTPWrapper::InitWinHTTP(); CSettings::s_SSLFilter = InitSSL(); nRet = Run(lpstrCmdLine, nCmdShow); if (CSettings::s_SSLFilter) TermSSL(); WinHTTPWrapper::TermWinHTTP(); CSocket::Term(); CSettings::SaveSettings(); } catch (std::exception& e) { ERROR_LOG << e.what(); } FreeLibrary(hRich); _Module.Term(); ::CoUninitialize(); return nRet; }
void CMainFrame::OnNdasServiceRejectedSuspend() { AtlMessageBox(m_hWnd, IDS_SUSPEND_REJECTED, IDS_MAIN_TITLE); }
LRESULT CChildFrame::OnFileExtractData(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) { HRESULT hr = E_FAIL; TREE_ITEM_DATA * pTmp = (TREE_ITEM_DATA *)m_pData.GetData(); if (NULL == pTmp) return 0; TCHAR szText[MAX_PATH] = { 0 }; m_pData.GetText(szText, _countof(szText)); ATLTRACE(_T("---------%s\n"), szText); if (STGTY_STREAM == pTmp->dwStgType) { TCHAR szFileName[MAX_PATH] = { 0 }; if (NULL == _tcschr(szText, '.')) { _tcscat(szText, _T(".bin")); } AdjustFileName(szText); TCHAR szFilter[MAX_PATH] = { 0 }; { // assembling filter string TCHAR szAllFiles[MAX_PATH] = { 0 }; AtlLoadString(IDS_ALL_FILES, szAllFiles, _countof(szAllFiles)); wnsprintf(szFilter, _countof(szFilter), _T("%s(*.*)|*.*||"), szAllFiles); } CModifiedFileDialog fd ( FALSE, _T(""), szText, OFN_HIDEREADONLY, szFilter, m_hWnd ); if ( IDOK != fd.DoModal(this->m_hWnd) ) return 0; lstrcpyn(szFileName, fd.m_szFileName, _countof(szFileName)); if (PathFileExists(szFileName)) { TCHAR szFmt[MAX_PATH] = { 0 }; AtlLoadString(IDS_FILE_EXISTS, szFmt, _countof(szFmt)); TCHAR szMsg[MAX_PATH*2] = { 0 }; wnsprintf(szMsg, _countof(szMsg), szFmt, szFileName); if ( IDYES != AtlMessageBox(m_hWnd, szMsg, IDS_WARNING, MB_YESNO|MB_ICONWARNING)) { return 0; } } CComPtr<IStream> spFile; hr = pTmp->spStgOrStrm->QueryInterface(&spFile); if (FAILED(hr)) return hr; hr = WriteStreamToFile(szFileName, spFile); } else if (STGTY_STORAGE == pTmp->dwStgType) { CModifiedFolderDialog fd ( GetTopLevelParent(), IDS_SELECT_DIR, BIF_RETURNONLYFSDIRS|BIF_NEWDIALOGSTYLE ); TCHAR szCurrPath[MAX_PATH] = { 0 }; GetCurrentDirectory(_countof(szCurrPath), szCurrPath); fd.SetInitialDir( szCurrPath ); if ( IDOK != fd.DoModal() ) return 0; lstrcpyn(szCurrPath, fd.GetFolderPath(), _countof(szCurrPath)); PathAddBackslash(szCurrPath); SHCreateDirectoryEx(*this, szCurrPath, NULL); // recursion _RecursionExtractData(szCurrPath, m_pData, &m_wndCatalog); } return 0; }