Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Recent files with the API

ArcanaArcana Posts: 1Member
Does anybody know a way to create a popup menu that displays the most recently opened files? The names of the files are stored in an .INI file, if that makes a difference.

Thanks for any help in advance.

Comments

  • AsmGuru62AsmGuru62 Posts: 6,519Member
    : Does anybody know a way to create a popup menu that displays the most recently opened files? The names of the files are stored in an .INI file, if that makes a difference.
    :
    : Thanks for any help in advance.
    :
    :
    [blue]You can do it in two ways:

    1. If you want to keep your recent files inside the standard menu which is a part of your main window. Then you need to rebuild the sub-menu which contains files every time you receive WM_INITMENUPOPUP. You have to use GetSubMenu()/GetMenu() API to get a handle of current menu and then remove all items and rebuild them according to your INI file with names. Use 'AppendMenu()' for that.

    2. If you want to utilize it with a right click - then you need to use 'CreatePopupMenu()' to get a fresh popup, fill it with the same API as in #1 ('AppendMenu()') and then use 'TrackPopupMenu()' - and do not forget to 'DestroyMenu()' - or you will accumulate memory leaks.[/blue]
Sign In or Register to comment.