Use PathCombine for working directory generation

Fix right click issue in player list
This commit is contained in:
oldmud0 2016-02-14 18:25:59 -06:00
parent 56a7a18137
commit 674ea949e9
6 changed files with 36 additions and 15 deletions

View file

@ -26,7 +26,8 @@ int main(array<System::String ^> ^args)
GetModuleFileName(NULL, MTOPTION.PATH, _MAX_PATH);
_tsplitpath_s(MTOPTION.PATH, drive, _MAX_DRIVE, dir, _MAX_DIR, NULL, 0, NULL, 0);
_stprintf_s(MTOPTION.PATH, _T("%s%s"), drive, dir);
//_stprintf_s(MTOPTION.PATH, _T("%s%s"), drive, dir);
PathCombine(MTOPTION.PATH, drive, dir);
// コマンドライン引数
if(args->Length > 0){

View file

@ -63,7 +63,7 @@
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
<AdditionalDependencies />
<AdditionalDependencies>Shlwapi.lib</AdditionalDependencies>
<EnableUAC>false</EnableUAC>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AssemblyDebug>true</AssemblyDebug>
@ -81,7 +81,7 @@
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
<AdditionalDependencies />
<AdditionalDependencies>Shlwapi.lib</AdditionalDependencies>
<EnableUAC>false</EnableUAC>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>

View file

@ -2252,7 +2252,8 @@ void MainForm::RunGame(Object^ obj)
// 作業ディレクトリ
_tsplitpath_s(MTOPTION.GAME_EXE, drive, _MAX_DRIVE, buf, _MAX_DIR, NULL, 0, NULL, 0);
_stprintf_s(wdir, _T("%s%s"), drive, buf);
//_stprintf_s(wdir, _countof(drive)+_countof(buf), _T("%s%s"), drive, buf);
PathCombine(wdir, drive, buf);
if(CreateProcess(MTOPTION.GAME_EXE, NULL, NULL, NULL, false, DEBUG_PROCESS, NULL, wdir, &si, &pi)){
if(run_type == RT_PLAYBACK){
@ -2822,7 +2823,8 @@ void MainForm::RunGame(Object^ obj)
if(MTOPTION.CHANGE_WINDOW_SIZE){
TCHAR val[32];
_stprintf_s(buf, _T("%sgame.ini"), wdir);
//_stprintf_s(buf, _T("%sgame.ini"), wdir);
PathCombine(buf, wdir, L"game.ini");
if(File::Exists(gcnew String(buf))){
_itot_s(640, val, 10);

View file

@ -720,7 +720,7 @@ private: System::Windows::Forms::ContextMenu^ contextMenuStrip2;
// listBoxMember
//
this->listBoxMember->BorderStyle = System::Windows::Forms::BorderStyle::None;
this->listBoxMember->ContextMenu = this->contextMenuStripMember;
//this->listBoxMember->ContextMenu = this->contextMenuStripMember;
this->listBoxMember->Dock = System::Windows::Forms::DockStyle::Fill;
this->listBoxMember->DrawMode = System::Windows::Forms::DrawMode::OwnerDrawFixed;
this->listBoxMember->FormattingEnabled = true;
@ -729,7 +729,8 @@ private: System::Windows::Forms::ContextMenu^ contextMenuStrip2;
this->listBoxMember->Name = L"listBoxMember";
this->listBoxMember->Size = System::Drawing::Size(94, 373);
this->listBoxMember->TabIndex = 2;
this->listBoxMember->MouseClick += gcnew System::Windows::Forms::MouseEventHandler(this, &MainForm::listBoxMember_MouseClick);
this->listBoxMember->MouseDown += gcnew System::Windows::Forms::MouseEventHandler(this, &MainForm::listBoxMember_MouseDown);
this->listBoxMember->MouseUp += gcnew System::Windows::Forms::MouseEventHandler(this, &MainForm::listBoxMember_MouseUp);
this->listBoxMember->DrawItem += gcnew System::Windows::Forms::DrawItemEventHandler(this, &MainForm::listBoxMember_DrawItem);
this->listBoxMember->MouseDoubleClick += gcnew System::Windows::Forms::MouseEventHandler(this, &MainForm::listBoxMember_MouseDoubleClick);
//
@ -2558,9 +2559,9 @@ private: System::Windows::Forms::ContextMenu^ contextMenuStrip2;
}
}
System::Void listBoxMember_MouseClick(System::Object^ sender, System::Windows::Forms::MouseEventArgs^ e) {
System::Void listBoxMember_MouseDown(System::Object^ sender, System::Windows::Forms::MouseEventArgs^ e) {
int index = listBoxMember->IndexFromPoint(e->X, e->Y);
if(index == -1 || MTOPTION.CONNECTION_TYPE == CT_FREE || ListView == LV_BLIND){
toolTipMember->Active = false;
return;
@ -2582,6 +2583,16 @@ private: System::Windows::Forms::ContextMenu^ contextMenuStrip2;
}
toolTipMember->SetToolTip(listBoxMember, cap);
}
System::Void listBoxMember_MouseUp(System::Object^ sender, System::Windows::Forms::MouseEventArgs^ e) {
int index = listBoxMember->IndexFromPoint(e->X, e->Y);
if (index != -1 && e->Button == ::MouseButtons::Right) {
listBoxMember->SelectedIndex = index;
this->contextMenuStripMember->Show(listBoxMember, e->Location);
}
}
System::Void toolStripMenuItemSetting_Click(System::Object^ sender, System::EventArgs^ e) {
if(Option == nullptr || Option->IsDisposed){
toolStripDropDownButtonProfile->Enabled = false;
@ -3122,11 +3133,13 @@ private: System::Windows::Forms::ContextMenu^ contextMenuStrip2;
if(IsCompatibleFM2KExecutable(info->FileDescription)){
b2nd = true;
_stprintf_s(ini, _T("%s%sgame.ini"), drive, dir);
//_stprintf_s(ini, _T("%s%sgame.ini"), drive, dir);
PathCombine(ini, PathCombine(ini, drive, dir), L"game.ini");
}
else{
b2nd = false;
_stprintf_s(ini, _T("%s%s格闘ツクール.ini"), drive, dir);
//_stprintf_s(ini, _T("%s%s格闘ツクール.ini"), drive, dir);
PathCombine(ini, PathCombine(ini, drive, dir), L"2D格闘ツクール95.ini");
}
if(File::Exists(gcnew String(ini))){

View file

@ -62,7 +62,8 @@ void LoadMTOption()
tmpType[MAX_TITLE], tmpPort[MAX_TITLE], bufSection[MAX_ARRAY];
TCHAR* iniSection = _T("LilithPort");
UINT iniVersion;
_stprintf_s(ini, _T("%sLilithPort.ini"), MTOPTION.PATH);
//_stprintf_s(ini, _T("%sLilithPort.ini"), MTOPTION.PATH);
PathCombine(ini, MTOPTION.PATH, L"LilithPort.ini");
// stdafx.hに記述
TCHAR iniSystem[MAX_NAME], iniState[MAX_NAME], iniColor[MAX_NAME];
@ -287,7 +288,8 @@ void SaveMTOption()
_tcscpy_s(iniColor, static_cast<PTCHAR>(mp.ToPointer()));
Runtime::InteropServices::Marshal::FreeHGlobal(mp);
_stprintf_s(ini, _T("%sLilithPort.ini"), MTOPTION.PATH);
//_stprintf_s(ini, _T("%sLilithPort.ini"), MTOPTION.PATH);
PathCombine(ini, MTOPTION.PATH, L"LilithPort.ini");
// グローバルセクション書き込み
_itot_s(LP_VERSION, buf, 10);
@ -475,13 +477,15 @@ void SaveMTOption()
// プロファイルセクション削除
void DeleteSection(TCHAR* obj){
TCHAR ini[_MAX_PATH];
_stprintf_s(ini, _T("%sLilithPort.ini"), MTOPTION.PATH);
//_stprintf_s(ini, _T("%sLilithPort.ini"), MTOPTION.PATH);
PathCombine(ini, MTOPTION.PATH, L"LilithPort.ini");
WritePrivateProfileStruct(obj, NULL, NULL, 0, ini);
}
// プロファイル関連のみ書き出し
void SaveProfileOption(){
TCHAR ini[_MAX_PATH];
_stprintf_s(ini, _T("%sLilithPort.ini"), MTOPTION.PATH);
//_stprintf_s(ini, _T("%sLilithPort.ini"), MTOPTION.PATH);
PathCombine(ini, MTOPTION.PATH, L"LilithPort.ini");
IntPtr mp;
TCHAR iniSystem[MAX_NAME];

View file

@ -6,6 +6,7 @@
// TODO: プログラムに必要な追加ヘッダーをここで参照してください。
#include <windows.h>
#include <Shlwapi.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>