到目前为止,我已经了解了如何使用Typelib在Euphoria之间传递Unicode字符串、bSTR。到目前为止,我不能理解的是如何创建和传回BSTR数组。
到目前为止,我拥有的代码(以及用于EuCOM本身的include和Win32lib的一部分):
global function REALARR()
sequence seq
atom psa
atom var
seq = { "cat","cow","wolverine" }
psa = create_safearray( seq, VT_BSTR )
make_v
在创建 (使用作为包装类)时,我必须使用一些。由于BSTR是一个长度前缀字符串,可能包含空字符,因此必须有可能使用本机字符串创建这样的字符串,而不依赖于给定本机字符串的空终止。
举一个例子:
wchar_t* pwNativeString = L"abc\0def\0\0ghi\0\0\0"; // + automatic "\0"
// Now I want to create a BSTR using _bstr_t by this string.
_bstr_t spBSTR = _bstr_t(pwNativeString);
问题在于构造函数依赖于p
在VisualStudio2019上编译以下C++ / STL代码时,会产生以下编译错误:
no instance of overloaded function matches the argument list argument types are: (Client::SetInstObj (std::string (*)(_bstr_t bsName), std::string (*)(_bstr_t bsInstance))) object type is: std::list<Client::SetInstObj, std::allocator<Client::SetIns
我正在使用IHTMLDocument2接口的一个实例来解析一些HTML,如本文所述:
代码相对简单:
DelphiInterface<IHTMLDocument2> diDoc2;
HRESULT hr = CoCreateInstance(CLSID_HTMLDocument, NULL, CLSCTX_INPROC_SERVER, IID_IHTMLDocument2, (LPVOID*)&diDoc2);
// Load and process HTML here and save into memory stream or to disk after the pr
对于C++ COM dll中的接口,我的out值为BSTR*。我要将此文件返回给C# .Net客户端。在我的C++函数中,我必须根据不同的条件分配不同的值。
例如:
If my function is fun(BSTR* outval)
{
// I have to assign a default value to it such as:
*outval = SysAllocSTring(L"N");
Then I will check for some DB conditions
{
// And I have to allocate