本文整理匯總了C++中AfxMessageBox函數的典型用法代碼示例。如果您正苦於以下問題:C++ AfxMessageBox函數的具體用法?C++ AfxMessageBox怎麽用?C++ AfxMessageBox使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了AfxMessageBox函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: switch
//---------------------------------------------------------------------------
void CXMMRCtrl::OnTimer(UINT nIDEvent)
{
if( nIDEvent == m_nTimerID ){
switch(m_TimerMode){
case 0:
if( m_TimerCount ){
m_TimerCount--;
break;
}
if( m_pCom ){
m_pCom->smpFFT = m_smpFFT;
STRNCPY(m_pCom->title, m_Title, sizeof(m_pCom->title));
if( m_ComName.IsEmpty() ){
m_ComName = m_pCom->comName;
}
else {
STRNCPY(m_pCom->comName, m_ComName, sizeof(m_pCom->comName));
}
if( m_RadioName.IsEmpty() ){
m_RadioName = m_pCom->comRadio;
}
else {
STRNCPY(m_pCom->comRadio, m_RadioName, sizeof(m_pCom->comRadio));
}
}
VERIFY(m_hWnd == (HWND)GetHwnd());
if( !m_hWnd ){
AfxMessageBox(IDS_XMMR_NO_WINDOW);
return;
}
{
TCHAR bf[512];
wsprintf(bf, _T("%s -h%X"), m_InvokeCommand, (DWORD)m_hWnd);
#ifdef _UNICODE
char bbf[512];
STRNCPY(bbf, bf, sizeof(bbf));
UINT r = ::WinExec(bbf, SW_SHOW);
#else
UINT r = ::WinExec(bf, SW_SHOW);
#endif
m_TimerMode++;
m_TimerCount = (r > 31) ? m_Timeup : 1;
}
//break;
case 1:
m_TimerCount--;
if( !m_TimerCount ){
DeleteTimer();
FireOnDisconnected(2);
}
else if( !m_bConnected && m_bInitialClose && (m_TimerCount < (m_Timeup-50)) ){
// For insurance
HWND hWnd = ::FindWindow(_T("TMmttyWd"), NULL);
if( hWnd ){
::PostMessage(hWnd, gMsgMmtty, RXM_HANDLE, (DWORD)m_hWnd);
::PostMessage(hWnd, gMsgMmtty, RXM_REQHANDLE, 0);
}
}
break;
}
}
else {
COleControl::OnTimer(nIDEvent);
}
}
示例2: MessageBox
//.........這裏部分代碼省略.........
//CString str3d = "[1,2,3,4,5,](4,3,2)"
//CString str = "[1e150,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24](2,3,4)";
// CString str = "[\"\\\\\\\",,1e150\",\"2\"](2)";
//{
// CString str1;
// for (int a=0;a<2;a++)
// {
// for (int b=0;b<3;b++)
// {
// for (int c=0;c<4;c++)
// {
// }
// }
// }
//}
//
//CxArrayND nd( DT_ARRAY1D_STRING );
//nd.Parse( str );
//vector<int> vPos;
//vPos.push_back(0);
////vPos.push_back(0);
////vPos.push_back(0);
//LPARAM lpData = nd.GetDataPtr( vPos );
//CString * pData = reinterpret_cast< CString * > ( lpData );
//nd.Clear();
// Initialize OLE libraries
if (!AfxOleInit())
{
AfxMessageBox(IDP_OLE_INIT_FAILED);
return FALSE;
}
AfxEnableControlContainer();
EnableTaskBarInteraction(FALSE);
globalData.SetDPIAware ();
//globalData.bDisableAero = TRUE;
//Bar挺靠後,Slider寬度,由於Splitter最小寬度為4,所以此值不應小於4,否則與Splitter不協調。
CBCGPSlider::m_nDefaultWidth = 4;
// All registry read/write operations will be produced via CBCGPXMLSettings gateway:
CBCGPRegistrySP::SetRuntimeClass (RUNTIME_CLASS (CBCGPXMLSettings));
// Read settings:
CBCGPXMLSettings::ReadXMLFromFile (FALSE, GetExecDir() + _T("\\user.xml"));
// Standard initialization
// If you are not using these features and wish to reduce the size
// of your final executable, you should remove from the following
// the specific initialization routines you do not need
// Change the registry key under which our settings are stored
// TODO: You should modify this string to be something appropriate
// such as the name of your company or organization
//SetRegistryKey(_T("PeraProcessDesigner"));
//LoadStdProfileSettings(0); // Load standard INI file options (including MRU)
//SetRegistryBase (_T("Settings"));
RECT rectDesktop;
SystemParametersInfo(SPI_GETWORKAREA,0,(PVOID)&rectDesktop,0);
示例3: AfxMessageBox
void CKeyValue::OnOK()
{
BOOL bRetVal = TRUE;
// Check for duplicate selection
// Get key handler array from the document
// Check for valid pointer
if (m_pDoc != NULL && m_bDataSaved == false)
{
CStringArray* pKeyArray = m_pDoc->omStrGetKeyHandlerPrototypes();
if (pKeyArray)
{
CString omStrMsgPro = STR_EMPTY;
UINT unKeyHandlerCount = 0;
unKeyHandlerCount = (COMMANUINT)pKeyArray->GetSize();
for (UINT nCount = 0; nCount < unKeyHandlerCount; nCount++)
{
omStrMsgPro = pKeyArray->GetAt( nCount );
CString omStrFuncName = defKEY_HANDLER;
CString omStrKeyPressed = "";
if((*m_pcKeyVal) == defGENERIC_KEY)
{
omStrKeyPressed = defGENERIC_KEY_HANDLER_TEXT;
}
else
{
omStrKeyPressed = m_pcKeyVal;
}
omStrFuncName += omStrKeyPressed;
// Construct Function definiton
CString omStrFuncPrototype = defDEFAULT_KEY_HANDLER_CODE;
omStrFuncPrototype.Replace("KEYNAME", omStrKeyPressed );
if ( omStrMsgPro == omStrFuncPrototype )
{
omStrMsgPro = defMSG_DUPL_KEY_HANDLER;
omStrMsgPro.Replace( "KEYNAME", m_pcKeyVal );
// Duplicate message hanlder, shout
AfxMessageBox( omStrMsgPro, MB_OK|MB_ICONINFORMATION );
nCount = (COMMANUINT)pKeyArray->GetSize();
bRetVal = FALSE;
}
}
}
}
if ( bRetVal == TRUE && m_bDataSaved == false)
{
CDialog::OnOK();
}
else
{
if ( m_bDataSaved == true)
{
m_bDataSaved = false;
CDialog::OnCancel();
}
else
{
CDialog::OnOK();
}
}
}
示例4: UpdateData
void CDlgCrearUsuario::OnBnClickedOk()
{
UpdateData(TRUE);
/* Se comprueba si se ha introducido el usuario*/
if (m_strUsuario.IsEmpty())
{
AfxMessageBox(IDS_NO_USUARIO);
return;
}
/* Se comprueba que se haya introducido la contraseña */
if (m_strPassword.IsEmpty())
{
AfxMessageBox(IDS_NO_PASSW);
return;
}
/* Se comprueba que se haya introducido la comprobación de la contraseña */
if (m_strPassword2.IsEmpty())
{
AfxMessageBox(IDS_NO_PASSW2);
return;
}
/* Se comprueba que el usuario no haya excedido de 8 caracteres */
if (m_strUsuario.GetLength() > LONG_USUARIO)
{
AfxMessageBox(IDS_USUARIO_LARGO);
return;
}
/* Se comprueba que no la contraseña y su comprobación son iguales */
if (m_strPassword != m_strPassword2)
{
AfxMessageBox(IDS_INVALID_PASSW);
return;
}
/* Se comprueba que la contraseña no exceda de 8 caracteres */
if (m_strPassword.GetLength() > LONG_USUARIO)
{
AfxMessageBox(IDS_PASSW_LARGA);
return;
}
/* Se obtiene el identificador del perfil */
CPerfiles rsPerfiles(m_db);
m_strPerfil = m_strPerfil.Trim();
rsPerfiles.m_strFilter = "DESCRIPCION LIKE '" + m_strPerfil + "'";
if (!rsPerfiles.Open(CRecordset::dynaset))
{
AfxMessageBox(IDC_ERROR_BD);
return;
}
if (rsPerfiles.GetRecordCount() != 1)
{
AfxMessageBox(IDC_INVALID_PERFIL);
return;
}
int iIdPerfil = rsPerfiles.m_ID;
rsPerfiles.Close();
/* Se inserta el usuario en la tabla de Usuario */
CUsuario rsUsuario(m_db);
rsUsuario.m_USUARIO = m_strUsuario;
/* Se cifra la contraseña */
CEncriptar cEncriptar;
CString strPasswCifrada = m_strPassword;
cEncriptar.Encriptar (strPasswCifrada);
strPasswCifrada.Replace("'", "''");
rsUsuario.m_PASSWORD = strPasswCifrada;
rsUsuario.m_IDPERFIL = iIdPerfil;
HRESULT hErr = rsUsuario.Insert();
OnOK();
}
示例5: ASSERT
bool CCommunicationManager::Init(void)
{
ASSERT(m_pSettings); //ты забыл меня инициализировать!
ASSERT(m_pBootLoader);
ASSERT(m_pControlApp);
ASSERT(m_pAppAdapter);
ASSERT(m_pBldAdapter);
bool status = true;
m_pBootLoader->SetPlatformParameters(PlatformParamHolder(m_pSettings->GetECUPlatformType()));
//останавливаем работу контроллеров интерфейсов, конкретный контроллер будет активирован
//позже - в зависимости от текущего контекста программы
m_pControlApp->SwitchOn(false);
m_pBootLoader->SwitchOn(false);
//для того чтобы можно было применить новые настройки к порту, необходимо его заново открыть
m_pComPort->Terminate();
//Set protocol data encoding/decoding mode (Hex or Bin)
m_pControlApp->SetProtocolDataMode(m_pSettings->GetHexDataMode());
//Set parameters for speed sensor calculations
m_pControlApp->SetNumPulsesPer1Km(m_pSettings->GetNumPulsesPer1Km());
//Set clock frequency (16 or 20 mHz)
m_pControlApp->SetQuartzFrq((EP_ATMEGA644==m_pSettings->GetECUPlatformType()) ? 20000000 : 16000000);
try
{
//на скорость переданную в эту функцию не нужно обращать внимания (она будет установлена конкретным контроллером интрерфейса)
m_pComPort->Initialize(_TSTRING(m_pSettings->GetPortName()), 9600, NOPARITY, ONESTOPBIT, false, true);
}
catch(CComPort::xInitialize e)
{
//говорим пользователю что нам не удалось открыть указанный порт!
AfxMessageBox(e.GetDetailStr());
status = false;
}
m_pComPort->Purge();
//инициализируем контроллеры интерфейсов
try
{
m_pControlApp->Initialize(m_pComPort,m_pSettings->GetBaudRateApplication(),500);
}
catch(CControlApp::xThread)
{
ASSERT(0); //because, strange situation!
status = false;
}
try
{
m_pBootLoader->Initialize(m_pComPort,m_pSettings->GetBaudRateBootloader());
}
catch (CBootLoader::xThread)
{
ASSERT(0);
status = false;
}
//Инициализруем адаптеры коммуникационных контроллеров
CWnd* pParent = AfxGetApp()->m_pMainWnd;
VERIFY(m_pAppAdapter->Create(pParent));
VERIFY(m_pBldAdapter->Create(pParent));
//Связываем адаптеры с коммуникационными контроллерами
m_pControlApp->SetEventHandler(m_pAppAdapter);
m_pBootLoader->SetEventHandler(m_pBldAdapter);
//оповещаем объект слушателя об изменении настроек. Получатель этого оповещения должен активировать
//необходимый ему коммуникационный контроллер.
if (m_OnSettingsChanged)
m_OnSettingsChanged();
return status;
}
示例6: AfxMessageBox
BOOL CAOIDApp::InitInstance()
{
CWinAppEx::InitInstance();
// 初始化 OLE 庫
if (!AfxOleInit())
{
AfxMessageBox(IDP_OLE_INIT_FAILED);
return FALSE;
}
AfxEnableControlContainer();
EnableTaskbarInteraction(FALSE);
// 使用 RichEdit 控件需要 AfxInitRichEdit2()
// AfxInitRichEdit2();
// 標準初始化
// 如果未使用這些功能並希望減小
// 最終可執行文件的大小,則應移除下列
// 不需要的特定初始化例程
// 更改用於存儲設置的注冊表項
// TODO: 應適當修改該字符串,
// 例如修改為公司或組織名
SetRegistryKey(_T("應用程序向導生成的本地應用程序"));
LoadStdProfileSettings(4); // 加載標準 INI 文件選項(包括 MRU)
InitContextMenuManager();
InitKeyboardManager();
InitTooltipManager();
CMFCToolTipInfo ttParams;
ttParams.m_bVislManagerTheme = TRUE;
theApp.GetTooltipManager()->SetTooltipParams(AFX_TOOLTIP_TYPE_ALL,
RUNTIME_CLASS(CMFCToolTipCtrl), &ttParams);
// 注冊應用程序的文檔模板。文檔模板
// 將用作文檔、框架窗口和視圖之間的連接
CSingleDocTemplate* pDocTemplate;
pDocTemplate = new CSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(CAOIDDoc),
RUNTIME_CLASS(CMainFrame), // 主 SDI 框架窗口
RUNTIME_CLASS(CAOIDView));
if (!pDocTemplate)
return FALSE;
AddDocTemplate(pDocTemplate);
// 分析標準 shell 命令、DDE、打開文件操作的命令行
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
#if !defined(_WIN32_WCE) || defined(_CE_DCOM)
// 通過 CoRegisterClassObject() 注冊類工廠。
if (FAILED(_AtlModule.RegisterClassObjects(CLSCTX_LOCAL_SERVER, REGCLS_MULTIPLEUSE)))
return FALSE;
#endif // !defined(_WIN32_WCE) || defined(_CE_DCOM)
// 應用程序是用 /Embedding 或 /Automation 開關啟動的。
// 將應用程序作為自動化服務器運行。
if (cmdInfo.m_bRunEmbedded || cmdInfo.m_bRunAutomated)
{
// 不顯示主窗口
return TRUE;
}
// 應用程序是用 /Unregserver 或 /Unregister 開關啟動的。
if (cmdInfo.m_nShellCommand == CCommandLineInfo::AppUnregister)
{
_AtlModule.UpdateRegistryAppId(FALSE);
_AtlModule.UnregisterServer(TRUE);
return FALSE;
}
// 應用程序是用 /Register 或 /Regserver 開關啟動的。
if (cmdInfo.m_nShellCommand == CCommandLineInfo::AppRegister)
{
_AtlModule.UpdateRegistryAppId(TRUE);
_AtlModule.RegisterServer(TRUE);
return FALSE;
}
// 調度在命令行中指定的命令。如果
// 用 /RegServer、/Register、/Unregserver 或 /Unregister 啟動應用程序,則返回 FALSE。
if (!ProcessShellCommand(cmdInfo))
return FALSE;
m_pMainWnd->SetWindowText(_T("AOID"));//在主窗口顯示的程序名
// 唯一的一個窗口已初始化,因此顯示它並對其進行更新
m_pMainWnd->ShowWindow(SW_SHOW);//SW_SHOWMAXIMIZED);顯示應用程序框架窗口
m_pMainWnd->UpdateWindow();
//****
CMainFrame * pwnd = (CMainFrame *)AfxGetMainWnd();
pwnd->m_pOpPaneWnd->SwitchToView(VIEW_F8SUBITEM1);//主界麵為工作狀態界麵
//.........這裏部分代碼省略.........
示例7: Enable3dControls
BOOL CCalcApp::InitInstance()
{
// Standard initialization
// If you are not using these features and wish to reduce the size
// of your final executable, you should remove from the following
// the specific initialization routines you do not need.
#if _MFC_VER < 0x0700
Enable3dControls();
#endif
// Initialize OLE 2.0 libraries
if (!AfxOleInit())
{
AfxMessageBox(IDP_OLE_INIT_FAILED);
return FALSE;
}
// Parse command line for automation or reg/unreg switches.
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
if (RunEmbedded() || RunAutomated())
{
// Register all OLE server (factories) as running. This enables the
// OLE 2.0 libraries to create objects from other applications.
COleTemplateServer::RegisterAll();
// Do not continue with rest of initialization. Wait for
// client to create a CCalcDlg object instead.
return TRUE;
}
// App was launched with /Unregserver or /Unregister switch. Remove
// entries from the registry.
else if (cmdInfo.m_nShellCommand == CCommandLineInfo::AppUnregister)
{
COleObjectFactory::UpdateRegistryAll(FALSE);
AfxOleUnregisterTypeLib(_tlid, _wVerMajor, _wVerMinor);
return FALSE;
}
// App was launched standalone or with other switches (e.g. /Register
// or /Regserver). Update registry entries, including typelibrary.
else
{
COleObjectFactory::UpdateRegistryAll();
AfxOleRegisterTypeLib(AfxGetInstanceHandle(), _tlid);
if (cmdInfo.m_nShellCommand == CCommandLineInfo::AppRegister)
return FALSE;
}
// create a modeless dialog as the main window of the application
//suppress warning because an object of CDialog is self-destructing
#pragma warning (suppress: 6014)
CCalcDlg* pDlg = new CCalcDlg;
pDlg->SetVisible(TRUE);
if (!pDlg->GetVisible())
{
AfxMessageBox(IDP_UNABLE_TO_SHOW_CALC);
return FALSE;
}
pDlg->RegisterActive();
// We are using a modeless dialog so we can translate accelerator keys
// against the dialog. In order to run the main message pump,
// InitInstance must return TRUE even though this application is
// a dialog-based application.
return TRUE;
}
示例8: GetFileAttributes
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
// 要求用戶設置工作控件目錄
///*
CWorkSpaceDlg workSpaceDlg ;
if(workSpaceDlg.DoModal()==IDOK && workSpaceDlg.folderpath != ""){
// 取得用戶指定的文件夾
m_workSpacePath = workSpaceDlg.folderpath;
// 將該文件夾名稱留存,以便下次回填
CStdioFile workspace ;
workspace.Open("workspace.txt",CFile::modeCreate|CFile::modeWrite|CFile::typeText);
workspace.WriteString(m_workSpacePath);
// 如果工作空間目錄不存在則創建
DWORD dwAttr = GetFileAttributes(m_workSpacePath);
if(dwAttr==-1||(dwAttr&FILE_ATTRIBUTE_DIRECTORY)==0)//目錄不存在
{
if ( !MakeDir(m_workSpacePath))
{
AfxMessageBox("can't create directionary:"+m_workSpacePath);
PostMessage(WM_QUIT,0,0);
//return;
}
}
}else{
PostMessage(WM_QUIT,0,0);
}
//*/
if (CMDIFrameWndEx::OnCreate(lpCreateStruct) == -1)
return -1;
BOOL bNameValid;
// set the visual manager and style based on persisted value
OnApplicationLook(theApp.m_nAppLook);
CMDITabInfo mdiTabParams;
mdiTabParams.m_style = CMFCTabCtrl::STYLE_3D_ONENOTE; // other styles available...
mdiTabParams.m_bActiveTabCloseButton = TRUE; // set to FALSE to place close button at right of tab area
mdiTabParams.m_bTabIcons = FALSE; // set to TRUE to enable document icons on MDI taba
mdiTabParams.m_bAutoColor = TRUE; // set to FALSE to disable auto-coloring of MDI tabs
mdiTabParams.m_bDocumentMenu = TRUE; // enable the document menu at the right edge of the tab area
EnableMDITabbedGroups(TRUE, mdiTabParams);
if (!m_wndMenuBar.Create(this))
{
TRACE0("Failed to create menubar\n");
return -1; // fail to create
}
m_wndMenuBar.SetPaneStyle(m_wndMenuBar.GetPaneStyle() | CBRS_SIZE_DYNAMIC | CBRS_TOOLTIPS | CBRS_FLYBY);
// prevent the menu bar from taking the focus on activation
CMFCPopupMenu::SetForceMenuFocus(FALSE);
if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
!m_wndToolBar.LoadToolBar(theApp.m_bHiColorIcons ? IDR_MAINFRAME_256 : IDR_MAINFRAME))
{
TRACE0("Failed to create toolbar\n");
return -1; // fail to create
}
CString strToolBarName;
bNameValid = strToolBarName.LoadString(IDS_TOOLBAR_STANDARD);
ASSERT(bNameValid);
m_wndToolBar.SetWindowText(strToolBarName);
CString strCustomize;
bNameValid = strCustomize.LoadString(IDS_TOOLBAR_CUSTOMIZE);
ASSERT(bNameValid);
m_wndToolBar.EnableCustomizeButton(TRUE, ID_VIEW_CUSTOMIZE, strCustomize);
// Allow user-defined toolbars operations:
InitUserToolbars(NULL, uiFirstUserToolBarId, uiLastUserToolBarId);
if (!m_wndStatusBar.Create(this))
{
TRACE0("Failed to create status bar\n");
return -1; // fail to create
}
m_wndStatusBar.SetIndicators(indicators, sizeof(indicators)/sizeof(UINT));
// TODO: Delete these five lines if you don't want the toolbar and menubar to be dockable
m_wndMenuBar.EnableDocking(CBRS_ALIGN_ANY);
m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
EnableDocking(CBRS_ALIGN_ANY);
DockPane(&m_wndMenuBar);
DockPane(&m_wndToolBar);
// enable Visual Studio 2005 style docking window behavior
CDockingManager::SetDockingMode(DT_SMART);
// enable Visual Studio 2005 style docking window auto-hide behavior
EnableAutoHidePanes(CBRS_ALIGN_ANY);
// Load menu item image (not placed on any standard toolbars):
CMFCToolBar::AddToolBarForImageCollection(IDR_MENU_IMAGES, theApp.m_bHiColorIcons ? IDB_MENU_IMAGES_24 : 0);
// create docking windows
if (!CreateDockingWindows())
{
//.........這裏部分代碼省略.........
示例9: UpdateData
BOOL CPPageFormats::OnApply()
{
m_bHaveRegisteredCategory = false;
if (!m_bInsufficientPrivileges) {
UpdateData();
int iSelectedItem = m_list.GetSelectionMark();
if (iSelectedItem >= 0) {
DWORD_PTR i = m_list.GetItemData(iSelectedItem);
m_mf[i].SetExts(m_exts);
m_exts = m_mf[i].GetExtsWithPeriod();
UpdateData(FALSE);
}
CFileAssoc::RegisterApp();
int fSetContextFiles = m_fContextFiles.GetCheck();
int fSetAssociatedWithIcon = m_fAssociatedWithIcons.GetCheck();
if (m_bFileExtChanged) {
if (fSetAssociatedWithIcon && IsNeededIconsLib() && !CFileAssoc::LoadIconLib()) {
AfxMessageBox(IDS_MISSING_ICONS_LIB, MB_ICONEXCLAMATION | MB_OK, 0);
}
for (int i = 0, cnt = m_list.GetItemCount(); i < cnt; i++) {
int iChecked = IsCheckedMediaCategory(i);
if (!m_bHaveRegisteredCategory && iChecked) {
m_bHaveRegisteredCategory = true;
}
if (iChecked == 2) {
continue;
}
CFileAssoc::Register(m_mf[m_list.GetItemData(i)], !!iChecked, !!fSetContextFiles, !!fSetAssociatedWithIcon);
}
m_bFileExtChanged = false;
if (fSetAssociatedWithIcon) {
CFileAssoc::FreeIconLib();
}
}
CFileAssoc::RegisterFolderContextMenuEntries(!!m_fContextDir.GetCheck());
UpdateMediaCategoryState(m_list.GetSelectionMark());
CFileAssoc::RegisterAutoPlay(CFileAssoc::AP_VIDEO, !!m_apvideo.GetCheck());
CFileAssoc::RegisterAutoPlay(CFileAssoc::AP_MUSIC, !!m_apmusic.GetCheck());
CFileAssoc::RegisterAutoPlay(CFileAssoc::AP_AUDIOCD, !!m_apaudiocd.GetCheck());
CFileAssoc::RegisterAutoPlay(CFileAssoc::AP_DVDMOVIE, !!m_apdvd.GetCheck());
m_mf.SetRtspHandler(m_iRtspHandler == 0 ? RealMedia : m_iRtspHandler == 1 ? QuickTime : DirectShow, !!m_fRtspFileExtFirst);
CAppSettings& s = AfxGetAppSettings();
s.m_Formats = m_mf;
s.fAssociatedWithIcons = !!m_fAssociatedWithIcons.GetCheck();
SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, NULL, NULL);
}
return __super::OnApply();
}
示例10: ASSERT
bool NoteGenerator::Ask_User_Merge_or_Save_New_Notes( long lastProcessedSampleIdx, bool& retUserDidMerge, CString& retErrorMesg )
{
retErrorMesg.Empty();
retUserDidMerge = false;
if( m_tempNoteList == NULL )
{
retErrorMesg = "NoteGenerator::Ask_User_Merge_or_Save_New_Notes FAILED, m_tempNoteList is NULL." ;
return false;
}
if( m_masterNoteList == NULL )
{
retErrorMesg = "NoteGenerator::Ask_User_Merge_or_Save_New_Notes FAILED, m_masterNoteList is NULL." ;
return false;
}
ASSERT( m_bitSourceStreaming != NULL );
long noteCount = m_tempNoteList->Count();
if( noteCount < 3 )
{
retErrorMesg = "Not enough notes were recorded during your Recording Session. Try again to record more notes." ;
return false;
}
int reslt = AfxMessageBox( "Do you want to MERGE the Recorded Notes to the Current NoteList? \n\n( YES: Merge, NO: Save notes to a new File )",
MB_YESNOCANCEL | MB_ICONQUESTION );
if( reslt == IDYES )
{
Begin_Wait_Cursor_GLB();
if( ! Merge_TempList_to_Master_Notelist( retErrorMesg ) )
{
m_bitSourceStreaming->m_recordNotesNow = false;
End_Wait_Cursor_GLB();
return false;
}
End_Wait_Cursor_GLB();
retUserDidMerge = true; // tell calling function of this action
}
else if( reslt == IDNO )
{
if( ! Save_Recorded_Notes_withDialog( lastProcessedSampleIdx, retErrorMesg ) )
{
m_bitSourceStreaming->m_recordNotesNow = false;
return false;
}
}
else if( reslt == IDCANCEL )
{
int dummy = 9;
}
return true;
}
示例11: AfxMessageBox
// ----------------------------------------------------------------------------
// 2006-10-23 오전 4:36:18 추가(New), Sun.H.D
// 호출 시점 : Arrow Line
//
// 특 징 :
//
// 매개 변수 :
//
// 리 턴 값 :
// ----------------------------------------------------------------------------
void CArrowLine::Draw(CDC* pDC)
{
CPen aPen;
UINT nType = 0;
CPoint ArrowPoint;
if(!aPen.CreatePen(PS_SOLID, 1, m_clrColor)) {
// Pen creation failed. Close the program
AfxMessageBox("Pen creation failed drawing a curve", MB_OK);
AfxAbort();
}
CPen* pOldPen = pDC->SelectObject(&aPen); // Select the pen
pDC->MoveTo(m_ptStartPoint);
pDC->LineTo(m_ptEndPoint);
if(m_ptStartPoint.y == m_ptEndPoint.y)
nType = 0;
else
nType = 1;
// 수평선
if(nType==0) {
ArrowPoint = m_ptStartPoint;
ArrowPoint.x += m_nArrowSize;
ArrowPoint.y -= m_nArrowSize;
pDC->MoveTo(ArrowPoint);
pDC->LineTo(m_ptStartPoint);
ArrowPoint = m_ptStartPoint;
ArrowPoint.x += m_nArrowSize;
ArrowPoint.y += m_nArrowSize;
pDC->LineTo(ArrowPoint);
ArrowPoint = m_ptEndPoint;
ArrowPoint.x -= m_nArrowSize;
ArrowPoint.y -= m_nArrowSize;
pDC->MoveTo(ArrowPoint);
pDC->LineTo(m_ptEndPoint);
ArrowPoint = m_ptEndPoint;
ArrowPoint.x -= m_nArrowSize;
ArrowPoint.y += m_nArrowSize;
pDC->LineTo(ArrowPoint);
} else { // 수직선
ArrowPoint = m_ptStartPoint;
ArrowPoint.x -= m_nArrowSize;
ArrowPoint.y += m_nArrowSize;
pDC->MoveTo(ArrowPoint);
pDC->LineTo(m_ptStartPoint);
ArrowPoint = m_ptStartPoint;
ArrowPoint.x += m_nArrowSize;
ArrowPoint.y += m_nArrowSize;
pDC->LineTo(ArrowPoint);
ArrowPoint = m_ptEndPoint;
ArrowPoint.x -= m_nArrowSize;
ArrowPoint.y -= m_nArrowSize;
pDC->MoveTo(ArrowPoint);
pDC->LineTo(m_ptEndPoint);
ArrowPoint = m_ptEndPoint;
ArrowPoint.x += m_nArrowSize;
ArrowPoint.y -= m_nArrowSize;
pDC->LineTo(ArrowPoint);
}
pDC->SelectObject(pOldPen); // Restore the old pen
}
示例12: AfxMessageBox
bool NoteGenerator::Merge_TempList_to_Master_Notelist( CString& retErrorMesg )
{
retErrorMesg.Empty();
if( m_tempNoteList == NULL ) // the TEMP-list has the newly recorded notes ( Recorded notes go directly here, then they can be saved to harddisk
{
retErrorMesg = "NoteGenerator::Merge_TempList_to_Master_Notelist FAILED, m_tempNoteList is NULL. " ;
return false;
}
if( m_masterNoteList == NULL ) // These are the notes that we HEAR and SEE on the display.
{
retErrorMesg = "NoteGenerator::Merge_TempList_to_Master_Notelist FAILED, m_masterNoteList is NULL. " ;
return false;
}
if( m_tempNoteList->Count() < 3 )
{
retErrorMesg = "Record some notes. (not enough notes were recorded)" ; // also get this if not in Detection for Mini-Source Mode
return false;
}
long retStartOffset = -1, retEndOffset = -1, retConcurentCount = -1, retNoteCountAdded = -1;
short retDeleteCount= -1;
if( ! SPitchCalc::Calc_StartOffset_EndOffset_for_NoteLists_Merge( retStartOffset, retEndOffset, *m_tempNoteList, retErrorMesg ) )
return false; // Now excluding the FIRST and LAST detected-notes
if( ! SPitchCalc::Delete_Notes_in_TimeSpan( retStartOffset, retEndOffset, retDeleteCount, *m_masterNoteList, *m_tempNoteList, retErrorMesg ) )
return false; // Its OK for this to NOT delete anyting. Just means that the new notes' Zone did not intersect any old notes.
if( ! SPitchCalc::Add_TempLists_Notes_to_Master_Notelist( *m_tempNoteList, *m_masterNoteList,
// m_sampleIdxRecordingStart, m_sampleIdxRecordingEnd,
retStartOffset, retEndOffset,
retNoteCountAdded, retErrorMesg ) )
return false;
long swapCount = SPitchCalc::Sort_NoteList_by_TimePosition( *m_masterNoteList, retErrorMesg ); // since we blindly added the notes to the end of list
if( swapCount == 0 )
{
int dummy = 0; // Can easily happen, if user's Recorded-Notes go into a LATER Time-Zone that is EMPTY of notes
}
if( ! SPitchCalc::Count_Concurrent_Notes_in_List( *m_masterNoteList, retConcurentCount, retErrorMesg ) ) // check for error in my Algo. 1/21/2012
AfxMessageBox( retErrorMesg );
long totalNotesInMasterList = m_masterNoteList->Count();
long totalNotesInTempList = m_tempNoteList->Count();
m_masterNoteList->m_lastFoundCalcNoteLink = NULL; // Reset the CACHE. BIG, the next play command will have to do a FULL Notelist search. 1/23/2012
TRACE( "MERGE is completed. [ NoteCOUNT in TempList %d ] [ %d notes deleted ] [ %d Notes added ] [ Master %d notes ] \n" ,
totalNotesInTempList, retDeleteCount, retNoteCountAdded, totalNotesInMasterList );
if( retConcurentCount >= 1 ) // ******************** TEMP, DEBUG ****************
{
CString mesg;
mesg.Format( "*** MERGE PROBLEM: Found %d CONCURRENT Notes." , retConcurentCount );
AfxMessageBox( mesg ); // ******** OMIT for RELEASE ****************
}
// ******* Should I automatically switch to NoteList-Mode for Midi-Source ?????? 1/12 *********
return true;
//.........這裏部分代碼省略.........
示例13: _tmakepath
void CIPFilterDlg::OnBnClickedAppend()
{
CString strFilePath;
if (DialogBrowseFile(strFilePath, GetResString(IDS_IPFILTERFILES)))
{
CWaitCursor curWait;
CString strTempUnzipFilePath;
CZIPFile zip;
if (zip.Open(strFilePath))
{
CZIPFile::File* zfile = zip.GetFile(_T("guarding.p2p"));
if (zfile)
{
_tmakepath(strTempUnzipFilePath.GetBuffer(MAX_PATH), NULL, thePrefs.GetConfigDir(), DFLT_IPFILTER_FILENAME, _T(".unzip.tmp"));
strTempUnzipFilePath.ReleaseBuffer();
if (zfile->Extract(strTempUnzipFilePath))
strFilePath = strTempUnzipFilePath;
else
{
CString strError;
strError.Format(_T("Failed to extract IP filter file \"guarding.p2p\" from ZIP file \"%s\"."), strFilePath);
AfxMessageBox(strError);
}
}
else
{
CString strError;
strError.Format(_T("Failed to find IP filter file \"guarding.p2p\" in ZIP file \"%s\"."), strFilePath);
AfxMessageBox(strError);
}
zip.Close();
}
else
{
CGZIPFile gz;
if (gz.Open(strFilePath))
{
_tmakepath(strTempUnzipFilePath.GetBuffer(MAX_PATH), NULL, thePrefs.GetConfigDir(), DFLT_IPFILTER_FILENAME, _T(".unzip.tmp"));
strTempUnzipFilePath.ReleaseBuffer();
// add filename and extension of uncompressed file to temporary file
CString strUncompressedFileName = gz.GetUncompressedFileName();
if (!strUncompressedFileName.IsEmpty())
{
strTempUnzipFilePath += _T('.');
strTempUnzipFilePath += strUncompressedFileName;
}
if (gz.Extract(strTempUnzipFilePath))
strFilePath = strTempUnzipFilePath;
}
gz.Close();
}
if (theApp.ipfilter->AddFromFile(strFilePath, true))
{
InitIPFilters();
m_ipfilter.Update(-1);
}
if (!strTempUnzipFilePath.IsEmpty())
_tremove(strTempUnzipFilePath);
}
}
示例14: ASSERT_VALID
void CRTEXToolView::OnDraw(CDC* pDC)
{
//CRTEXToolDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
if (!pDoc)
return;
// TODO: 在此加入原生資料的描繪程式碼
UINT sizenum = pDoc->m_view_resolution * 5 / uiscale;
CPen axisPen;
if(!axisPen.CreatePen(PS_DOT,10,RGB(255,0,0)))
{
// Pen creation failed. Abort the program
AfxMessageBox(_T("Pen creation failed drawing a line"), MB_OK);
AfxAbort();
}
CPen* pOldPen = pDC->SelectObject(&axisPen); // Select the pen
CRect cr;
CSize size;
GetClientRect(&cr);
pDC->DPtoLP(&cr);
int showaxis = pDoc->m_view_resolution;
CPoint ptAxis;
pDC->MoveTo(0,0);
ptAxis = Cpt3DptTo2Dpt(showaxis,0,0);
pDC->LineTo(ptAxis.x,ptAxis.y);
pDC->Ellipse(ptAxis.x-sizenum,ptAxis.y+sizenum,ptAxis.x+sizenum,ptAxis.y-sizenum);
pDC->TextOut(ptAxis.x,ptAxis.y,"X");
pDC->MoveTo(0,0);
ptAxis = Cpt3DptTo2Dpt(0,showaxis,0);
pDC->LineTo(ptAxis.x,ptAxis.y);
pDC->Ellipse(ptAxis.x-sizenum,ptAxis.y+sizenum,ptAxis.x+sizenum,ptAxis.y-sizenum);
pDC->TextOut(ptAxis.x,ptAxis.y,"Y");
pDC->MoveTo(0,0);
ptAxis = Cpt3DptTo2Dpt(0,0,showaxis);
pDC->LineTo(ptAxis.x,ptAxis.y);
pDC->Ellipse(ptAxis.x-sizenum,ptAxis.y+sizenum,ptAxis.x+sizenum,ptAxis.y-sizenum);
pDC->TextOut(ptAxis.x,ptAxis.y,"Z");
/*
pDC->MoveTo(cr.TopLeft().x,0);
pDC->LineTo(cr.BottomRight().x,0);
pDC->MoveTo(0,cr.BottomRight().y);
pDC->LineTo(0,cr.TopLeft().y);
pDC->TextOut(cr.TopLeft().x,cr.TopLeft().y,"X vs Y");
*/
pDC->SelectObject(pOldPen);
CPen axisPen1;
if(!axisPen1.CreatePen(PS_DOT,10,RGB(0,0,255)))
{
// Pen creation failed. Abort the program
AfxMessageBox(_T("Pen creation failed drawing a line"), MB_OK);
AfxAbort();
}
pOldPen = pDC->SelectObject(&axisPen1); // Select the pen
pDC->MoveTo(0,0);
ptAxis = Cpt3DptTo2Dpt(-showaxis,0,0);
pDC->LineTo(ptAxis.x,ptAxis.y);
pDC->MoveTo(0,0);
ptAxis = Cpt3DptTo2Dpt(0,-showaxis,0);
pDC->LineTo(ptAxis.x,ptAxis.y);
pDC->MoveTo(0,0);
ptAxis = Cpt3DptTo2Dpt(0,0,-showaxis);
pDC->LineTo(ptAxis.x,ptAxis.y);
pDC->TextOut(cr.TopLeft().x,cr.TopLeft().y,"X vs Y vs Z");
pDC->SelectObject(pOldPen);
/*
CPoint* currentPt;
for(auto iter = pDoc->begin() ; iter != pDoc->end() ; ++iter)
{
currentPt = *iter;
pDC->Ellipse(currentPt->x-sizenum,currentPt->y+sizenum,currentPt->x+sizenum,currentPt->y-sizenum);
}
*/
if(!pDoc->m_fgskipRedraw)
{
sizenum = pDoc->m_view_resolution / uiscale;
CString str;
int xx,yy,zz;
pDoc->savefile.SeekToBegin();
while(pDoc->savefile.ReadString(str))
{
if(str.Left(4) =="XYZ:")
{
xx = atoi((LPCSTR)str.Mid(39,9));
yy = atoi((LPCSTR)str.Mid(49,9));
zz = atoi((LPCSTR)str.Mid(59,9));
CPoint pt;
pt = Cpt3DptTo2Dpt(xx,yy,zz);
pDC->Ellipse(pt.x-sizenum,pt.y+sizenum,pt.x+sizenum,pt.y-sizenum);
//pDC->Ellipse(xx-sizenum,yy+sizenum,xx+sizenum,yy-sizenum);
}
}
//.........這裏部分代碼省略.........
示例15: Enable3dControlsStatic
BOOL CAStudioApp::InitInstance()
{
Enable3dControlsStatic(); // Call this when linking to MFC statically
AOptions *Options = NULL; // options structure holds INI file options
char IniFilePath[MAX_PATH] ;
// Set up INI file path
{
char AppPath[MAX_PATH];
::GetModuleFileName (NULL, AppPath, MAX_PATH);
::FilePath_GetDriveAndDir (AppPath, AppPath);
::FilePath_AppendName (AppPath, rcstring_Load (AfxGetInstanceHandle (), IDS_INIFILE_NAME), IniFilePath);
// Set our INI file
::free ((void *)m_pszProfileName);
m_pszProfileName = ::_tcsdup (IniFilePath);
}
// Parse command line for filename
CAStudioCommandLineInfo cmdInfo;
ParseCommandLine (cmdInfo);
AProject *pProject = NULL;
// load program options
Options = AOptions_CreateFromFile (IniFilePath);
bool KeepGoing = true;
if (Options == NULL)
{
// couldn't load options. Man, we're REALLY out of memory...
AfxMessageBox (IDS_OPTIONSERR);
return FALSE;
}
char LoadProjectName[2*MAX_PATH] = "";
// if filename specified on command line, then try to load it
if ((cmdInfo.ErrFlag == false) && (cmdInfo.InputFile != ""))
{
char Ext[MAX_PATH];
if (::ShortPathToLongPath (cmdInfo.InputFile, LoadProjectName) == false)
{
// ShortPathToLongPath failed for some reason. Use short filename.
strcpy (LoadProjectName, cmdInfo.InputFile);
}
// if no extension, then append .apj
if (FilePath_GetExt (LoadProjectName, Ext) == GE_FALSE)
{
FilePath_SetExt (LoadProjectName, ".apj", LoadProjectName);
}
pProject = AProject_CreateFromFilename (LoadProjectName);
if (pProject == NULL)
{
// If unable to load, then tell user and ask for Ok/Cancel
// Ok will create new project and launch program.
// Cancel will exit program.
CString ErrMsg;
AfxFormatString1 (ErrMsg, IDS_READERROR, LoadProjectName);
if (AfxMessageBox (ErrMsg, MB_ICONEXCLAMATION | MB_OKCANCEL) == IDCANCEL)
{
KeepGoing = false;
}
}
}
if (KeepGoing)
{
CAStudioPropSheet dlg (NULL, &pProject, Options, LoadProjectName);
m_pMainWnd = &dlg;
dlg.DoModal ();
// all done. Save options.
AOptions_WriteToFile (Options, IniFilePath);
}
// Cleanup
// Destroy options structure
if (Options != NULL)
{
AOptions_Destroy (&Options);
}
// Destroy project structure
if (pProject != NULL)
{
AProject_Destroy (&pProject);
}
geRam_ReportAllocations();
//.........這裏部分代碼省略.........