Using Win32 CreatePopupMenu to display a custom context menu


Can anyone who knows a bit more than me about the ins and outs of Win32, and what is/isn't supported within the confines of MT5, please give me any clue as to why the following code isn't working?

Call to AppendMenuW returns success, but call to TrackPopupMenu returns false, nothing is shown on the screen, and GetLastError() returns 0

#include <WinAPI\winuser.mqh>

#property indicator_chart_window
#property indicator_plots 0

int OnInit() {

int OnCalculate(const int rates_total, const int prev_calculated, const datetime &time[], const double &open[], const double &high[], const double &low[], const double &close[], const long &tick_volume[], const long &volume[], const int &spread[]) {

void OnChartEvent(const int id, const long &lparam, const double &dparam, const string &sparam) {
   if (id == CHARTEVENT_KEYDOWN) {
      if (lparam == 66) { // B - random keyboard key for testing
         HANDLE hMenu = CreatePopupMenu();
         bool appended = AppendMenuW(hMenu, 0, 50000, "Test Item");
         Print(appended); // true, indicating success
         long hChart = ChartGetInteger(0, CHART_WINDOW_HANDLE);
         RECT r;
         bool tracked = TrackPopupMenu(hMenu, 0, 100, 100, 0, hChart, r); // last param should be NULL, but cannot pass NULL when expecting a struct by reference
         Print(tracked); // false, indicating failure - GetLastError() returns 0, so no clue there
Could you find anything about this?