| How can I use VTI to pick bytes from menu structures like you describe?

Previous | Event-driven Programming, Menus, and Throwing Errors |

Q: | The documentation about MenuPopup says that it is possible to make popup menus by picking up bytes with the VTI debugger to save the memory, but I don't know how to do this. Could you tell me how to do this, please?
A: | Not so easy to explain if you are not an experienced user. Basically, after you define a menu using PopupNew, PopupAddText etc., you need to display its address instead of executing it. E.g. instead of doing
    PopupDo (handle, ...)
you need to do something like:
    printf_xy (0, 50, "Address=%lp", HeapDeref (handle));
    ngetchx();
Then, while waiting for a keypress, open the VTI debugger and go to the displayed address. Take a pencil and write a sequence of bytes starting from this address. Tenth and eleventh byte in this sequence will tell to you how many bytes you need to pick. After this, put these bytes in the array, and pass such array as an argument to the MenuPopup function. As an exercise, try this on an example given in the documentation.