我需要知道如何在参数中使用变量 PROCESS 被初始化为
string PROCESS
在类参数中。
Process::GetProcessesByName("")
当我用变量替换字符串时,这给了我一个错误
Process::GetProcessesByName(PROCESS)
我得到的错误是:没有重载函数的实例“System::Diagnostics::Process::GetProcessByName”匹配参数列表参数类型是(std::string)
I think GetProcessesByName
may take a parameter as LPSTR
or char const *
, but not a std::string
,
try use
Process::GetProcessesByName(PROCESS.c_str());
or if your PROCESS is defined as std::string PROCESS;
,
String^ process_name = gcnew String(PROCESS.c_str());
Process::GetProcessesByName(process_name);