Provides a method for a macros script to call out to native
code. Typically, used for bringing up a custom graphical user interface
developed in a technology other than Flash.
When the script calls callExternalFunction, the specified DLL
filename is loaded from the folder containing the currently executing
script file. The DLL extension is added automatically to the specified
filename. The DLL filename cannot include path elements and must
include a filename without an extension such as myMacroExtension.
GetProcAddress is used to find the function identified by the
sFunctionName parameter.
Sample call:
designer.callExternalFunction("DesignerExtension", "ShowMyDialog", "user data here");
This call loads a DLL called DesignerExtension.dll from the same
directory in which the macro is installed, looks up a function called
ShowMyDialog, and passes the "user data here" string as a wide character
string (const wchar_t *).
The function can return a string, which is returned from the
designer.callExternalFunction call. The string is returned as an
HGLOBAL containing a wide character string.
The following example of a function in a DLL, shows the passed-in
string in a dialog, and returns "yes" or "no" based on which option
the user clicks. The C function must have the function prototype
like this example.
extern "C" __declspec(dllexport) HGLOBAL _cdecl ShowMyDialog(HWND hwndParent, const wchar_t *pszArgument)
{
int nResult = ::MessageBox(hwndParent, pszArgument, L"DLL Function Sample", MB_YESNO);
// Allocate some memory for the result string
HGLOBAL hMem = GlobalAlloc(0, 64);
if (!hMem)
return 0;
wchar_t *pMem = (wchar_t *)GlobalLock(hMem);
wcscpy_s(pMem, 30, nResult == IDYES ? L"yes" : L"no");
::GlobalUnlock(hMem);
return hMem;
}
Syntax
designer.callExternalFunction ( STRING param1, STRING param2, STRING param3)
Parameters
param1
|
A string representing the DLL name. Specify
the root filename of the DLL without the filename extension.
|
param2
|
A string representing the function name.
|
param3
|
The string parameter that is passed to the
function.
|