本文整理汇总了C++中ShowMessageBox函数的典型用法代码示例。如果您正苦于以下问题:C++ ShowMessageBox函数的具体用法?C++ ShowMessageBox怎么用?C++ ShowMessageBox使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ShowMessageBox函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ShowMessageBox
//网络关闭消息
bool __cdecl CPlazaViewItem::OnEventTCPSocketShut(WORD wSocketID, BYTE cbShutReason)
{
if (m_bLogonPlaza==false)
{
if (cbShutReason!=SHUT_REASON_NORMAL)
{
g_GlobalAttemper.DestroyStatusWnd(this);
ShowMessageBox(TEXT("登录服务器连接失败,请稍后再试或留意网站公告!"),MB_ICONINFORMATION);
SendLogonMessage();
}
}
//自定义头像
CGameFrame *pGameFrame = (CGameFrame *)AfxGetMainWnd() ;
CDlgCustomFace &DlgCustomFace = pGameFrame->m_DlgCustomFace;
if ( DlgCustomFace.m_hWnd != NULL ) DlgCustomFace.SetStatus(enOperateStatus_NULL);
//释放内存
if ( m_CustomFace.pFaceData != NULL ) m_CustomFace.Clear();
return true;
}
示例2: CheckProfilePasswordResult
bool
CheckProfilePasswordResult(ProfilePasswordResult result, const Error &error)
{
switch (result) {
case ProfilePasswordResult::UNPROTECTED:
case ProfilePasswordResult::MATCH:
return true;
case ProfilePasswordResult::MISMATCH:
ShowMessageBox(_("Wrong password."), _("Password"), MB_OK);
return false;
case ProfilePasswordResult::CANCEL:
return false;
case ProfilePasswordResult::ERROR:
ShowError(error, _("Password"));
return false;
}
gcc_unreachable();
}
示例3: OrderedTaskSave
bool
OrderedTaskSave(const OrderedTask& task, bool noask)
{
assert(protected_task_manager != NULL);
if (!noask
&& ShowMessageBox(_("Save task?"), _("Task Selection"),
MB_YESNO | MB_ICONQUESTION) != IDYES)
return false;
TCHAR fname[69] = _T("");
if (!dlgTextEntryShowModal(fname, 64))
return false;
TCHAR path[MAX_PATH];
LocalPath(path, _T("tasks"));
Directory::Create(path);
_tcscat(fname, _T(".tsk"));
LocalPath(path, _T("tasks"), fname);
protected_task_manager->TaskSave(path, task);
return true;
}
示例4: _T
inline void
ProfileListWidget::NewClicked()
{
StaticString<64> name;
name.clear();
if (!TextEntryDialog(name, _("Profile name")))
return;
StaticString<80> filename;
filename = name;
filename += _T(".prf");
StaticString<MAX_PATH> path;
LocalPath(path.buffer(), filename);
if (!File::CreateExclusive(path)) {
ShowMessageBox(name, _("File exists already."), MB_OK|MB_ICONEXCLAMATION);
return;
}
UpdateList();
SelectPath(path);
}
示例5: sourcePath
LRESULT SnapshotWizardPage1::OnWizardNext() {
CAutoPtr<wchar_t> sourcePath(new wchar_t[sourceEdit_.GetWindowTextLengthW() + 1]);
sourceEdit_.GetWindowTextW(sourcePath, sourceEdit_.GetWindowTextLengthW() + 1);
CAutoPtr<wchar_t> destinationPath(new wchar_t[destinationEdit_.GetWindowTextLengthW() + 1]);
destinationEdit_.GetWindowTextW(destinationPath, destinationEdit_.GetWindowTextLengthW() + 1);
wchar_t expandedSourcePath[MAX_PATH];
wchar_t expandedDestinationPath[MAX_PATH];
if (0 == ::ExpandEnvironmentStrings(sourcePath, expandedSourcePath, MAX_PATH)) {
ShowMessageBox(L"Bad source path format.");
return -1;
}
if (0 == ::ExpandEnvironmentStrings(destinationPath, expandedDestinationPath, MAX_PATH)) {
ShowMessageBox(L"Bad destination path format.");
return -1;
}
if (!ATLPath::FileExists(expandedSourcePath)) {
ShowMessageBox(L"The source file does not exists.");
return -1;
}
if (ATLPath::FileExists(expandedDestinationPath)) {
ShowMessageBox(L"The Destination file already exists.");
return -1;
}
auto hr = Vss::CopyFileFromSnapshot(sourcePath, destinationPath);
if (FAILED(hr)) {
CString errorMessage;
errorMessage.Format(L"%s : %d", L"Vss copy Failed.", hr);
ShowMessageBox(errorMessage);
return -1;
}
if (!InvokeEsentutilP(destinationPath)) {
CString errorMessage;
errorMessage.Format(L"%s : %d", L"Database repair Failed. : ", GetLastError());
ShowMessageBox(errorMessage);
return -1;
}
wcscpy_s(sharedStringPage1_, MAX_PATH + 1, destinationPath);
return 0;
}
示例6: Cmd_MessageBoxEx_Execute
bool Cmd_MessageBoxEx_Execute(COMMAND_ARGS)
{
*result = 0;
char buffer[kMaxMessageLength];
if(!ExtractFormatStringArgs(0, buffer, paramInfo, scriptData, opcodeOffsetPtr, scriptObj, eventList, kCommandInfo_MessageBoxEx.numParams))
return true;
//extract the buttons
char * b[10] = {0};
UInt32 btnIdx = 0;
for(char* ch = buffer; *ch && btnIdx < 10; ch++)
{
if(*ch == GetSeparatorChar(scriptObj))
{
*ch = '\0';
b[btnIdx++] = ch + 1;
}
}
if(!btnIdx) // supply default OK button
b[0] = "Ok";
if(thisObj && !(thisObj->flags & TESForm::kFormFlags_DontSaveForm)) // if not temporary object and not quest script
*ShowMessageBox_pScriptRefID = thisObj->refID;
else
*ShowMessageBox_pScriptRefID = scriptObj->refID;
*ShowMessageBox_button = 0xFF; // overwrite any previously pressed button
ShowMessageBox(buffer,
0, 0, ShowMessageBox_Callback, 0, 0x17, 0, 0,
b[0], b[1], b[2], b[3], b[4], b[5], b[6], b[7], b[8], b[9], NULL);
return true;
}
示例7: strlen
void TextInputMessageBox::Init()
{
char* buttons[10] = { NULL };
UInt32 numButtons = 0;
UInt32 fmtStringLen = strlen(m_fmtString);
char* fmtString = new char[fmtStringLen + 1];
strcpy_s(fmtString, fmtStringLen + 1, m_fmtString);
//separate prompt text and button text
for (UInt32 strPos = 0; strPos < fmtStringLen && numButtons < 10; strPos++)
{
if (fmtString[strPos] == GetSeparatorChar(m_script) && (strPos + 1 < fmtStringLen))
{
fmtString[strPos] = '\0';
buttons[numButtons++] = fmtString + strPos + 1;
}
}
m_promptText = fmtString;
if (!buttons[0]) //supply default button if none specified
buttons[0] = "Finished";
//now display the messagebox
ShowMessageBox(fmtString, ShowMessageBox_Callback, 0, buttons[0], buttons[1], buttons[2], buttons[3], buttons[4],
buttons[5], buttons[6], buttons[7], buttons[8], buttons[9], 0);
//Register it with the game so scripts can pick up button pressed
*ShowMessageBox_pScriptRefID = m_scriptRefID;
*ShowMessageBox_button = -1;
//Disable menu shortcut keys so they don't interfere with typing
if (!m_bShortcutsDisabled)
{
m_bShortcutsDisabled = true;
ToggleMenuShortcutKeys(false, GetMenuByType(kMenuType_Message));
}
}
示例8: get_cursor_task
void
TaskListPanel::LoadTask()
{
const OrderedTask* orig = get_cursor_task();
if (orig == NULL)
return;
StaticString<1024> text;
text.Format(_T("%s\n(%s)"), _("Load the selected task?"),
get_cursor_name());
if (ShowMessageBox(text.c_str(), _("Task Browser"),
MB_YESNO | MB_ICONQUESTION) != IDYES)
return;
// create new task first to guarantee pointers are different
OrderedTask* temptask = orig->Clone(CommonInterface::GetComputerSettings().task);
delete *active_task;
*active_task = temptask;
RefreshView();
*task_modified = true;
dialog.SwitchToEditTab();
}
示例9: ShowMessageBox
void ParamSetWindow::OnPushbuttonOKClicked()
{
RobotHighLevelControl::ParamCXB temp;
bool flag = true;
temp.duty = ui->lineEditDuty->text().toDouble(&flag);
if (!flag || temp.duty > 1 || temp.duty < 0)
{
ShowMessageBox("Wrong duty setting!");
return;
}
temp.stepHeight = ui->lineEditStepHeight->text().toDouble(&flag);
if (!flag || temp.stepHeight < 0)
{
ShowMessageBox("Wrong stepHeight setting!");
return;
}
temp.desireVelocity = ui->lineEditStepLength->text().toDouble(&flag);
if (!flag || temp.desireVelocity < -0.4 || temp.desireVelocity > 0.4)
{
ShowMessageBox("Wrong speed setting!");
return;
}
temp.standHeight = ui->lineEditStandHeight->text().toDouble(&flag);
if (!flag || temp.standHeight < 450)
{
ShowMessageBox("Wrong standHeight setting!");
return;
}
temp.tdDeltaMidLeg = ui->lineEditStepDpMid->text().toDouble(&flag);
if (!flag)
{
ShowMessageBox("Wrong Step DP Mid setting!");
return;
}
temp.tdDeltaSideLeg = ui->lineEditStepDpSide->text().toDouble(&flag);
if (!flag)
{
ShowMessageBox("Wrong Step DP Side setting!");
return;
}
temp.totalPeriodCount = ui->lineEditPeriodCount->text().toUInt(&flag);
if (!flag)
{
ShowMessageBox("Wrong total period count setting!");
return;
}
temp.T = ui->lineEditPeriodTime->text().toDouble(&flag);
if (!flag || temp.T < 0)
{
ShowMessageBox("Wrong period time setting!");
return;
}
temp.Lside = ui->lineEditLside->text().toDouble(&flag);
if (!flag)
{
ShowMessageBox("Wrong Lside setting!");
return;
}
temp.rotationAngle = ui->lineRotationAngle->text().toDouble(&flag);
if (!flag)
{
ShowMessageBox("Wrong rotation angle setting!");
return;
}
m_param = temp;
this->close();
}
示例10: DeleteTempo
//.........这里部分代码省略.........
{
Nt3 = t2 + 240*m2 / b1;
Nb3 = (b3+b4)*(t4-t3) / (t4-Nt3) - b4;
}
}
else
{
if (s3 == SQUARE)
{
double f1 = (b1+b2)*(t2-t1) + 480*m2;
double f2 = b3*(t4-t3);
double a = b1;
double b = (a*(t1+t4) + f1+f2) / 2;
double c = a*(t1*t4) + f1*t4 + f2*t1;
Nt3 = c / (b + sqrt(pow(b,2) - a*c));
Nb3 = f2 / (t4 - Nt3);
}
else
{
double f1 = (b1+b2)*(t2-t1) + 480*m2;
double f2 = (b3+b4)*(t4-t3);
double a = b1-b4;
double b = (a*(t1+t4) + f1+f2) / 2;
double c = a*(t1*t4) + f1*t4 + f2*t1;
Nt3 = c / (b + sqrt(pow(b,2) - a*c));
Nb3 = f2 / (t4 - Nt3) - b4;
}
}
// Check new position is legal
if ((Nt3 - t1) < MIN_TEMPO_DIST || (t4 - Nt3) < MIN_TEMPO_DIST)
SKIP(skipped, 1);
}
// If P4 does not exist
else
{
if (s1 == SQUARE)
{
Nt3 = t2 + 240*m2 / b1;
Nb3 = b3;
}
else
{
Nt3 = t3;
Nb3 = (480*m2 + (b1+b2)*(t2-t1)) / (t3-t1) - b1;
}
// Check new position is legal
if ((Nt3 - t1) < MIN_TEMPO_DIST)
SKIP(skipped, 1);
}
// Check new value is legal
if (Nb3 > MAX_BPM || Nb3 < MIN_BPM)
SKIP(skipped, 1);
// Previous point stays the same
P1 = false;
}
}
else
{
// No surrounding points get edited
P1 = false;
P3 = false;
}
///// SET NEW BPM /////
///////////////////////
// Previous point
if (P1)
tempoMap.SetPoint(id-1, &Nt1, &Nb1, NULL, NULL);
// Next point
if (P3)
tempoMap.SetPoint(id+1, &Nt3, &Nb3, NULL, NULL);
// Delete point
tempoMap.DeletePoint(id);
--offset;
}
// Commit changes
if (tempoMap.Commit())
Undo_OnStateChangeEx2(NULL, SWS_CMD_SHORTNAME(ct), UNDO_STATE_ALL, -1);
// Warn user if some points weren't processed
static bool s_warnUser = true;
if (s_warnUser && skipped != 0)
{
char buffer[512];
_snprintfSafe(buffer, sizeof(buffer), __LOCALIZE_VERFMT("%d of the selected points didn't get processed because some points would end up with illegal BPM or position. Would you like to be warned if it happens again?", "sws_mbox"), skipped);
int userAnswer = ShowMessageBox(buffer, __LOCALIZE("SWS - Warning", "sws_mbox"), 4);
if (userAnswer == 7)
s_warnUser = false;
}
}
示例11: switch
//左键双击
void __cdecl CPlazaViewItem::OnTreeLeftDBClick(CListItem *pListItem,
HTREEITEM hTreeItem,
CTreeCtrl *pTreeCtrl)
{
//效验参数
if(pListItem==NULL)
{
return ;
}
//消息处理
switch (pListItem->GetItemGenre())
{
//游戏类型
case ItemGenre_Kind:
{
CListKind *pListKind = (CListKind *)pListItem;
tagGameKind *pGameKind = pListKind->GetItemInfo();
//Add by doctor 20071014
//大类型ID
int gameTypeInt = pGameKind->wTypeID ;
CString gameExeStr;
gameExeStr.Format("%s", pGameKind->szProcessName );
if ( IsTimeOut())
{}
else
{
//是否为单机,FLASH游戏
switch (gameTypeInt)
{
//单机游戏
case 5:
{
CString lpszFileName ;
CString gamePath;
CString applicationPath;
CFileFind fFind;
//获得应用程序路径
int nPos;
GetModuleFileName(NULL,applicationPath.GetBufferSetLength (MAX_PATH+1),MAX_PATH);
applicationPath.ReleaseBuffer();
nPos = applicationPath.ReverseFind('\\');
applicationPath = applicationPath.Left(nPos);
gamePath = applicationPath + "\\LocalGame";
lpszFileName = gamePath +"\\"+gameExeStr;//这里修改成你的调用应用程序的文件名称
//启动单机游戏
if(!fFind.FindFile(lpszFileName))
{
AfxMessageBox("没有找到调用的应用程序!"+ lpszFileName);
return ;
}
else
{
CString cmdLine;
cmdLine.Format("-%s", "FlyGame2007");
// ShellExecute(NULL,"open", gameExeStr, cmdLine ,NULL,SW_SHOW);
ShellExecute(NULL,"open", gameExeStr, cmdLine ,gamePath,SW_SHOW);
// ShellExecute(NULL,NULL,_T(gameExeStr),NULL, gamePath,NULL);
}
return;
}
break;
//flash游戏
case 6:
{
//启动FLASH游戏
//连接规则
TCHAR szRuleUrl[256]=TEXT("");
_snprintf(szRuleUrl,sizeof(szRuleUrl),TEXT("%sPlayGame.asp?KindID=%ld"), Glb().m_MainHomeUrl, pGameKind->wKindID);
WebBrowse(szRuleUrl,true);
return;
}
break;
default:
{}
}
//End add
}//End if
//安装判断
if (pListKind->m_bInstall==false)
{
TCHAR szBuffer[512]=TEXT("");
_snprintf(szBuffer,sizeof(szBuffer),TEXT("【%s】还没有安装,现在是否下载?"),pGameKind->szKindName);
int nResult = ShowMessageBox(szBuffer,
MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON1);
if(nResult == IDYES)
{
g_GlobalAttemper.DownLoadClient(pGameKind->szKindName,
pGameKind->wKindID,
//.........这里部分代码省略.........
示例12: ASSERT
//.........这里部分代码省略.........
break;
}
case DTP_USER_GROUP_NAME: //社团名字
{
ASSERT(pDataBuffer!=NULL);
ASSERT(DataDescribe.wDataSize>0);
ASSERT(DataDescribe.wDataSize<=sizeof(UserData.szGroupName));
if (DataDescribe.wDataSize<=sizeof(UserData.szGroupName))
{
CopyMemory(UserData.szGroupName,pDataBuffer,DataDescribe.wDataSize);
UserData.szGroupName[CountArray(UserData.szGroupName)-1]=0;
}
break;
}
case DTP_STATION_PAGE: //游戏主站
{
ASSERT(pDataBuffer!=NULL);
if (pDataBuffer!=NULL)
{
g_GlobalUnits.SetStationPage((LPCTSTR)pDataBuffer);
m_pHtmlBrower->Navigate(g_GlobalUnits.GetStationPage());
}
break;
}
default: { ASSERT(FALSE); }
}
}
//刷新界面
Invalidate(TRUE);
//设置提示
g_GlobalAttemper.ShowStatusMessage(TEXT("正在读取服务器列表信息..."),this);
return true;
}
//登陆失败
case SUB_GP_LOGON_ERROR:
{
//效验参数
CMD_GP_LogonError *pLogonError = (CMD_GP_LogonError *)pBuffer;
ASSERT(wDataSize>=(sizeof(CMD_GP_LogonError)-sizeof(pLogonError->szErrorDescribe)));
if (wDataSize<(sizeof(CMD_GP_LogonError)-sizeof(pLogonError->szErrorDescribe))) return false;
//关闭连接
g_GlobalAttemper.DestroyStatusWnd(this);
pIClientSocke->CloseSocket(false);
//显示消息
WORD wDescribeSize=wDataSize-(sizeof(CMD_GP_LogonError)-sizeof(pLogonError->szErrorDescribe));
if (wDescribeSize>0)
{
pLogonError->szErrorDescribe[wDescribeSize-1]=0;
ShowMessageBox(pLogonError->szErrorDescribe,MB_ICONINFORMATION);
}
//发送登陆
SendLogonMessage();
return true;
}
//登陆完成
case SUB_GP_LOGON_FINISH:
{
//关闭提示
g_GlobalAttemper.DestroyStatusWnd(this);
//展开类型
INT_PTR nIndex=0;
CListType * pListType=NULL;
do
{
pListType=g_GlobalUnits.m_ServerListManager.EnumTypeItem(nIndex++);
if (pListType==NULL) break;
g_GlobalUnits.m_ServerListManager.ExpandListItem(pListType);
} while (true);
//展开列表
nIndex=0;
CListInside * pListInside=NULL;
do
{
pListInside=g_GlobalUnits.m_ServerListManager.EnumInsideItem(nIndex++);
if (pListInside==NULL) break;
g_GlobalUnits.m_ServerListManager.ExpandListItem(pListInside);
} while (true);
//记录信息
m_bLogonPlaza=true;
m_DlgLogon.OnLogonSuccess();
m_pHtmlBrower->EnableBrowser(true);
return true;
}
}
return true;
}
示例13: InitialiseDirectX
bool InitialiseDirectX()
{
const D3DFORMAT backBufferFormat = D3DFMT_D16;
const D3DFORMAT textureFormat = D3DFMT_A8R8G8B8;
if(FAILED(d3d = Direct3DCreate9(D3D_SDK_VERSION)))
{
ShowMessageBox("Direct3D interface creation has failed");
return false;
}
// Build present params
D3DPRESENT_PARAMETERS d3dpp;
ZeroMemory(&d3dpp, sizeof(d3dpp));
D3DMULTISAMPLE_TYPE antiAliasingLvl;
bool antiAliasing = false;
if(SUCCEEDED(d3d->CheckDeviceMultiSampleType(D3DADAPTER_DEFAULT,
D3DDEVTYPE_HAL, textureFormat, true, D3DMULTISAMPLE_2_SAMPLES, nullptr)))
{
d3dpp.MultiSampleType = D3DMULTISAMPLE_2_SAMPLES;
antiAliasingLvl = D3DMULTISAMPLE_2_SAMPLES;
antiAliasing = true;
}
d3dpp.hDeviceWindow = hWnd;
d3dpp.Windowed = true;
d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
d3dpp.BackBufferFormat = textureFormat;
d3dpp.BackBufferWidth = WINDOW_WIDTH;
d3dpp.BackBufferHeight = WINDOW_HEIGHT;
d3dpp.EnableAutoDepthStencil = TRUE;
d3dpp.AutoDepthStencilFormat = backBufferFormat;
if(FAILED(d3d->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hWnd,
D3DCREATE_HARDWARE_VERTEXPROCESSING, &d3dpp, &d3ddev)))
{
ShowMessageBox("Direct3D interface creation has failed");
return false;
}
// Create Z-buffer
if(FAILED(d3ddev->CreateDepthStencilSurface(WINDOW_WIDTH, WINDOW_HEIGHT, backBufferFormat,
antiAliasing ? antiAliasingLvl : D3DMULTISAMPLE_NONE, NULL, TRUE, &backBuffer, NULL)))
{
ShowMessageBox("Z-buffer creation has failed");
return false;
}
d3ddev->SetRenderTarget(0,backBuffer);
// Set render states
d3ddev->SetRenderState(D3DRS_MULTISAMPLEANTIALIAS, antiAliasing);
// Check shader capabilities
D3DCAPS9 caps;
d3ddev->GetDeviceCaps(&caps);
// Check for vertex shader version 2.0 support.
if(caps.VertexShaderVersion < D3DVS_VERSION(2, 0))
{
ShowMessageBox("Shader model 2.0 or higher is required");
return false;
}
return true;
}
示例14: WinMain
int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow )
{
#ifndef _DEBUG
// Is there a debugger present?
if ( IsDebuggerPresent () )
{
// Exit
ExitProcess ( -1 );
}
#endif
// Create the gui instance
pGUI = new CGUI;
#ifndef _DEBUG
// Create the updater instance
/*pUpdater = new CUpdate;
// Check for updates
pUpdater->CheckForUpdates();*/
#endif
//
bool bFoundCustomDirectory = false;
char szInstallDirectory[ MAX_PATH ];
// Try get the custom directory
if( !SharedUtility::ReadRegistryString( HKEY_LOCAL_MACHINE, "Software\\Wow6432Node\\Mafia 2 Multiplayer", "GameDir", NULL, szInstallDirectory, sizeof(szInstallDirectory) ) )
{
// Ask them to find their own directory
if( ShowMessageBox( "Failed to find Mafia II install directory. Do you want to select it now?", (MB_ICONEXCLAMATION | MB_YESNO) ) == IDYES )
{
// Construct the browse info
BROWSEINFO browseInfo = {0};
browseInfo.lpszTitle = "Select your Mafia II directory";
ITEMIDLIST * pItemIdList = SHBrowseForFolder( &browseInfo );
// Did they finish looking for a folder?
if( pItemIdList != NULL )
{
// Get the name of the selected folder
if( SHGetPathFromIDList( pItemIdList, szInstallDirectory ) )
bFoundCustomDirectory = true;
// Was any memory used?
IMalloc * pIMalloc = NULL;
if( SUCCEEDED( SHGetMalloc( &pIMalloc ) ) )
{
// Free the memory
pIMalloc->Free( pItemIdList );
// Release the malloc
pIMalloc->Release();
}
}
// Did they not find the registry?
if( !bFoundCustomDirectory )
{
ShowMessageBox( "Failed to find Mafia II install directory. Can't launch "MOD_NAME"." );
return 1;
}
}
}
// Get the launch path string
String strLaunchPath( "%s\\pc", szInstallDirectory );
// Get the full path to Mafia2.exe
String strApplicationPath( "%s\\Mafia2.exe", strLaunchPath.Get() );
// Does Mafia2.exe not exist?
if( !SharedUtility::Exists( strApplicationPath.Get() ) )
{
ShowMessageBox( "Failed to find Mafia2.exe. Can't launch "MOD_NAME"." );
return 1;
}
// If we have a custom directory, save it!
if( bFoundCustomDirectory )
SharedUtility::WriteRegistryString( HKEY_LOCAL_MACHINE, "Software\\Wow6432Node\\Mafia 2 Multiplayer", "GameDir", szInstallDirectory, sizeof(szInstallDirectory) );
// Get the full path to m2mp.dll
String strModulePath( "%s\\%s", SharedUtility::GetAppPath(), CORE_MODULE );
// Does m2mp.dll not exist?
if( !SharedUtility::Exists( strModulePath.Get() ) )
{
ShowMessageBox( "Failed to find "CORE_MODULE". Can't launch "MOD_NAME"." );
return 1;
}
// Terminate Mafia II process if it's already running?
if( SharedUtility::IsProcessRunning( "Mafia2.exe" ) )
SharedUtility::_TerminateProcess( "Mafia2.exe" );
// Create the startup info struct
STARTUPINFO siStartupInfo;
PROCESS_INFORMATION piProcessInfo;
memset( &siStartupInfo, 0, sizeof(siStartupInfo) );
//.........这里部分代码省略.........
示例15: EditTempoGradual
//.........这里部分代码省略.........
position = ((b0+b1)*(t1-t0) + selPos.back() * (selBpm.back() + bpm)) / (selBpm.back() + bpm);
// Store new values
selPos.push_back(position);
selBpm.push_back(bpm);
++offset;
}
// Check for illegal position/no linear points encountered (in that case offset is -1 so skipped won't change)
if (!selPos.size())
SKIP(skipped, offset+1);
///// NEXT POINT /////
//////////////////////
// Get points after the last selected point
double t1, t2;
double b1, b2;
int s2;
bool P1 = tempoMap.GetPoint(id+offset+1, &t1, &b1, &s2, NULL);
bool P2 = tempoMap.GetPoint(id+offset+2, &t2, &b2, NULL, NULL);
// Calculate new value and position for the next point
if (P1)
{
// Get last selected tempo point (old and new)
double Nb0 = selBpm.back();
double Nt0 = selPos.back();
double t0, b0;
tempoMap.GetPoint(id+offset, &t0, &b0, NULL, NULL);
if (P2)
{
if (s2 == SQUARE)
{
double f1 = (b0+b1)*(t1-t0);
double f2 = b1*(t2-t1);
double a = Nb0;
double b = (a*(Nt0+t2) + f1+f2) / 2;
double c = a*(Nt0*t2) + f1*t2 + f2*Nt0;
Nt1 = c / (b + sqrt(pow(b,2) - a*c));
Nb1 = f2 / (t2-Nt1);
}
else
{
double f1 = (b0+b1)*(t1-t0);
double f2 = (b1+b2)*(t2-t1);
double a = Nb0 - b2;
double b = (a*(Nt0+t2) + f1+f2) / 2;
double c = a*(Nt0*t2) + f1*t2 + f2*Nt0;
Nt1 = c / (b + sqrt(pow(b,2) - a*c));
Nb1 = f2 / (t2-Nt1) - b2;
}
}
else
{
Nt1 = t1;
Nb1 = (b0+b1)*(t1-t0) / (t1-Nt0) - Nb0;
}
// If points after selected point don't exist, fake them
if (!P1)
Nt1 = Nt0 + 1;
if (!P2)
t2 = Nt1 + 1;
// Check new value is legal
if (Nb1 > MAX_BPM || Nb1 < MIN_BPM)
SKIP(skipped, offset+1);
if ((Nt1-Nt0) < MIN_TEMPO_DIST || (t2 - Nt1) < MIN_TEMPO_DIST)
SKIP(skipped, offset+1);
}
///// SET NEW BPM /////
///////////////////////
// Current point(s)
for (int i = 0; i < (int)selPos.size(); ++i)
tempoMap.SetPoint(id+i, &selPos[i], &selBpm[i], NULL, NULL);
// Next point
if (P1)
tempoMap.SetPoint(id+offset+1, &Nt1, &Nb1, NULL, NULL);
}
// Commit changes
if (tempoMap.Commit())
Undo_OnStateChangeEx2(NULL, SWS_CMD_SHORTNAME(ct), UNDO_STATE_ALL, -1);
// Warn user if some points weren't processed
static bool s_warnUser = true;
if (s_warnUser && skipped != 0 && tempoMap.CountSelected() > 1 )
{
char buffer[512];
_snprintfSafe(buffer, sizeof(buffer), __LOCALIZE_VERFMT("%d of the selected points didn't get processed because some points would end up with illegal BPM or position. Would you like to be warned if it happens again?", "sws_mbox"), skipped);
int userAnswer = ShowMessageBox(buffer, __LOCALIZE("SWS - Warning", "sws_mbox"), 4);
if (userAnswer == 7)
s_warnUser = false;
}
}