Can someone please help me on how to write this in Nim from c?
struct **MC_HMCALLSCRIPTFUNCW** :
Type | Name | Description
---|---|---
UINT | cbSize | Set to sizeof(MC_HMCALLSCRIPTFUNCW)
LPWSTR | pszRet | Set to address of a buffer to store string result of the
function call, or to NULL if the expected return value is of integer type or
there is no return value.
int| iRet | If pszRet is not NULL, set to size of the buffer. If pszRet is NULL
and the function returns integer, it is stored here.
UINT | cArgs Set| to number of arguments passed to the function. (Four at
most.)
LPCWSTR| pszArg1| Specify 1st argument (if it is of string type).
int| iArg1 | Specify 1st argument (if it is of integer type). Ignored if
pszArg1 is not NULL.
LPCWSTR| pszArg2| Specify 2nd argument (if it is of string type).
int| iArg2 | Specify 2nd argument (if it is of integer type). Ignored if
pszArg2 is not NULL.
LPCWSTR| pszArg3| Specify 3rd argument (if it is of string type).
int| iArg3 | Specify 3rd argument (if it is of integer type). Ignored if
pszArg3 is not NULL.
LPCWSTR| pszArg4| Specify 4th argument (if it is of string type).
int| iArg4 | Specify 4th argument (if it is of integer type). Ignored if
pszArg4 is not NULL.
/* Example how to call a JavaScript function in the embedded HTML page. The
JS
* function is very simple: It just concatenates the three strings we
provide,
* shows a window with them and returns concatenation of the strings. */
static void
CallJavaScriptFunc(void)
{
MC_HMCALLSCRIPTFUNC csfArgs;
TCHAR pszRetVal[64];
TCHAR pszBuffer[512];
csfArgs.cbSize = sizeof(MC_HMCALLSCRIPTFUNC);
csfArgs.pszRet = pszRetVal;
csfArgs.iRet = sizeof(pszRetVal) / sizeof(pszRetVal[0]);
csfArgs.cArgs = 3;
csfArgs.pszArg1 = _T("Hello");
csfArgs.pszArg2 = _T(" ");
csfArgs.pszArg3 = _T("from application.");
SendMessage(hwndHtml, MC_HM_CALLSCRIPTFUNCW,
(WPARAM)_T("concat_three"), (LPARAM)&csfArgs);
_sntprintf(pszBuffer, sizeof(pszBuffer) / sizeof(pszBuffer[0]),
_T("We are back in C code. This message box shows the ")
_T("return value of the called JS function below:\n\n")
_T("\t'%s'"), pszRetVal);
MessageBox(hwndHtml, pszBuffer, _T("The return value"), MB_OK);
}
Run