Pass BSTR from C++ DLL function to VB6 application
问题 I have this code in my VB6 app: Private Declare Function FileGetParentFolder Lib "Z-FileIO.dll" _ (ByVal path As String) As String Output.AddItem FileGetParentFolder(FileText.Text) Output is a list, FileText is a text field containing a file path. My C++ DLL contains this function: extern "C" BSTR ZFILEIO_API FileGetParentFolder(Path p) { try { return SysAllocString(boost::filesystem::path(p).parent_path().c_str()); } catch (...) { return SysAllocString(L""); } } where Path is typedef'd as