程序片段----彈出文件夾

#include <Windows.h>
...
	std::string output_path("../Project_test/numberData");
	ShellExecute(nullptr,(LPCWSTR)L"open", nullptr, nullptr, \
		stringToLPCWSTR(output_path), SW_SHOWNORMAL);
...


stringToLPCWSTR的定義:

http://blog.csdn.net/jfkidear/article/details/26363711

{
	size_t origsize = orig.length() + 1;
	const size_t newsize = 100;
	size_t convertedChars = 0;
	wchar_t *wcstring = (wchar_t *)malloc(sizeof(wchar_t)*(orig.length() - 1));
	mbstowcs_s(&convertedChars, wcstring, origsize, orig.c_str(), _TRUNCATE);
	return wcstring;
}


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章