F
net schrieb:
probier mal: (BSTR*)&bstrValue
Danke erstmal, das hilft zumindest, dass der Kompiler das akzeptiert.
ABER die Funktion stürzt praktisch nach dem Aufruf der DLL-Funktion ab, bzw. gibt sie nichts mehr aus:
Die Zeile Log ("CoCreateInstance succeeded."); wird nicht mehr ausgegeben!
Noch eine kleine Korrektur des Funktionsaufrufs, denn das hab ich im ersten Posten falsch dargestellt. An die DLL sollen die entsprechenden Funktions-Parameter übergeben werden: - fmx::DataVect& dataVect
Rückgabe der Funktion an: - fmx::Data& result
*FMX_PROC(fmx::errcode) DialogBrowseFor (short funcId, const fmx::ExprEnv& environment, const fmx::DataVect& dataVect, fmx::Data& result)
{
// Declare an HRESULT and a pointer to the clsVBClass interface
HRESULT hr;
_clsWordDonnector *IVBClass = NULL;
// Now we will intilize COM
hr = CoInitialize(0);
// Use the SUCCEEDED macro and see if we can get a pointer to the interface
if(SUCCEEDED(hr))
{
hr = CoCreateInstance( CLSID_clsWordDonnector,
NULL,
CLSCTX_INPROC_SERVER,
IID__clsWordDonnector,
(void**) &IVBClass);
// If we succeeded then call the CountStringLength method,
// if it failed then display an appropriate message to the user.
if(SUCCEEDED(hr))
{
hr = IVBClass->DialogBrowseFor((BSTR*)&dataVect.AtAsText(0) , (BSTR*)&result);
Log ("CoCreateInstance succeeded.");
hr = IVBClass->Release();
}
else
{ // Something went wrong
cout << "CoCreateInstance Failed." << endl;
}
}
// Uninitialize COM
CoUninitialize();
return 0;*