wsprintf(data, TEXT("$bvar(%s,%u,%u)"), name, index, MAX_BVAR_BYTES);
if (!(res = mirc_query(hwnd))) break;
...
BOOL mirc_query(HWND hwnd)
{
// tell mIRC to evaluate the command in the buffer
return SendMessage(hwnd, WM_MEVALUATE, UNICODE_FLAG, num);
}