mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Updated some stale code in the ActiveX wrapper.
This commit is contained in:
parent
b1e4823066
commit
a6c09d5de4
1 changed files with 38 additions and 36 deletions
|
|
@ -69,17 +69,26 @@ public:
|
|||
|
||||
String getStringFromDISPID (const DISPID hash) const
|
||||
{
|
||||
for (int i = identifierPool.size(); --i >= 0;)
|
||||
if (getHashFromString (identifierPool[i]) == hash)
|
||||
return identifierPool[i];
|
||||
return identifierNames [identifierIDs.indexOf (hash)];
|
||||
}
|
||||
|
||||
return String::empty;
|
||||
DISPID getDISPIDForName (const String& name)
|
||||
{
|
||||
const int i = identifierNames.indexOf (String (name));
|
||||
|
||||
if (i >= 0)
|
||||
return identifierIDs[i];
|
||||
|
||||
const DISPID newID = (DISPID) name.hashCode64();
|
||||
identifierNames.add (name);
|
||||
identifierIDs.add (newID);
|
||||
return newID;
|
||||
}
|
||||
|
||||
HRESULT doGetIDsOfNames (LPOLESTR* rgszNames, UINT cNames, DISPID* rgDispId)
|
||||
{
|
||||
for (unsigned int i = 0; i < cNames; ++i)
|
||||
rgDispId[i] = getHashFromString (identifierPool.getPooledString (String (rgszNames[i])));
|
||||
rgDispId[i] = getDISPIDForName (rgszNames[i]);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
|
@ -97,36 +106,33 @@ public:
|
|||
|
||||
if ((wFlags & DISPATCH_METHOD) != 0)
|
||||
{
|
||||
if (! object->hasMethod (memberId))
|
||||
return DISP_E_MEMBERNOTFOUND;
|
||||
|
||||
const int numArgs = pDispParams == nullptr ? 0 : pDispParams->cArgs;
|
||||
var result;
|
||||
|
||||
if (numArgs == 0)
|
||||
if (object->hasMethod (memberId))
|
||||
{
|
||||
result = v.call (memberId);
|
||||
const int numArgs = pDispParams == nullptr ? 0 : pDispParams->cArgs;
|
||||
var result;
|
||||
|
||||
if (numArgs == 0)
|
||||
{
|
||||
result = v.call (memberId);
|
||||
}
|
||||
else
|
||||
{
|
||||
Array<var> args;
|
||||
for (int j = numArgs; --j >= 0;)
|
||||
args.add (variantTojuceVar (pDispParams->rgvarg[j]));
|
||||
|
||||
result = v.invoke (memberId, numArgs == 0 ? nullptr : args.getRawDataPointer(), numArgs);
|
||||
}
|
||||
|
||||
if (pVarResult != nullptr)
|
||||
juceVarToVariant (result, *pVarResult);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
else
|
||||
{
|
||||
Array<var> args;
|
||||
for (int j = numArgs; --j >= 0;)
|
||||
args.add (variantTojuceVar (pDispParams->rgvarg[j]));
|
||||
|
||||
result = v.invoke (memberId, numArgs == 0 ? 0 : args.getRawDataPointer(), numArgs);
|
||||
}
|
||||
|
||||
if (pVarResult != nullptr)
|
||||
juceVarToVariant (result, *pVarResult);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
else if ((wFlags & DISPATCH_PROPERTYGET) != 0)
|
||||
{
|
||||
if (! object->hasProperty (memberId))
|
||||
return DISP_E_MEMBERNOTFOUND;
|
||||
|
||||
if (pVarResult != nullptr)
|
||||
if (object->hasProperty (memberId) && pVarResult != nullptr)
|
||||
{
|
||||
juceVarToVariant (object->getProperty (memberId), *pVarResult);
|
||||
return S_OK;
|
||||
|
|
@ -145,12 +151,8 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
StringPool identifierPool;
|
||||
|
||||
static DISPID getHashFromString (const String::CharPointerType s) noexcept
|
||||
{
|
||||
return (DISPID) (pointer_sized_int) s.getAddress();
|
||||
}
|
||||
Array<DISPID> identifierIDs;
|
||||
StringArray identifierNames;
|
||||
|
||||
JUCE_DECLARE_NON_COPYABLE (IDispatchHelper)
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue