mormonman
2010-12-07 02:00:10
Test this please.
{*******************************************************************************
function GetMenuText: TStringArray;
By: BenLand100
Description: Dumps the data from the MenuNodeList into a TStringArray
*******************************************************************************}
function GetMenuText: TStringArray;
var
count, nodeList, head, next, last, javaString: Integer;
item: string;
begin
try
nodeList:= SmartGetFieldObject(0, hook_static_MenuNodeList);
head:= SmartGetFieldObject(nodeList, hook_nodelist_Head);
//for some reason, the head has null strings, so skip it
next:= SmartGetFieldObject(head, hook_node_Next);
count:= GetMenuCount;
SetLength(result,count);
repeat
javaString:= SmartGetFieldObject(next, hook_menu_Action);
item:= GetJavaString(javaString,256);
SmartFreeObject(javaString);
javaString:= SmartGetFieldObject(next, hook_menu_Option);
item:= item + ' ' + GetJavaString(javaString,256);
SmartFreeObject(javaString);
result[count-1]:= TrimHTML(item);
last:= next;
next:= SmartGetFieldObject(last, hook_node_Next);
SmartFreeObject(last);
count:= count - 1;
until (count = 0);
finally
SmartFreeObject(next);
SmartFreeObject(head);
SmartFreeObject(nodeList);
end;
end;