将向量字符串的值传递给C++中的win32函数SetWindowText

And*_*doc 0 c++ winapi

我怎样才能将矢量字符串的值传递给C++中的win32函数SetWindowText.

到目前为止,这是我的代码:

vector <string> filelist;
string path;
path = Text;
filelist = GetPath(path);
SetWindowText(EditShow,filelist);
Run Code Online (Sandbox Code Playgroud)

Bjö*_*lex 5

您可以将它们连接成一个字符串并将其作为c-string传递:

#include <sstream>   // for std::stringstream
#include <algorithm> // for std::copy
#include <iterator>  // for std::ostream_iterator

std::stringstream buffer;
std::copy(filelist.begin(), filelist.end(), 
          std::ostream_iterator<std::string>(buffer, "\n");
SetWindowText(EditShow,buffer.str().c_str());
Run Code Online (Sandbox Code Playgroud)