AFX2 bug in menu MF_SEPARATOR

Started by docroger, July 09, 2025, 03:43:50 PM

Previous topic - Next topic

docroger

Hello,

On Tiko 1.1.1, i use DDT for transfert Powerbasic app.

The exemple below is from exddtmenu01 template, simplified.

There is a bug with menu :

FUNCTION BuildMenu (BYVAL hDlg AS HWND) AS HMENU
   DIM lResult AS LONG

   ' ** First create a top-level menu:
   DIM hMenu AS HMENU = MenuNewBar

   ' ** Add a top-level menu item with a popup menu:
   DIM hPopup1 AS HMENU = MenuNewPopup
   MenuAddPopup hMenu, "&File", hPopup1, MF_ENABLED
   MenuAddString hPopup1, "&Open", ID_OPEN, MF_ENABLED
   MenuAddString hPopup1, "-", 0, 0
   MenuAddString hPopup1, "&Exit", ID_EXIT, MF_ENABLED
   

   ' ** Now we can add another item to the menu that will bring up a sub-menu.
   ' First we obtain a new popup menu handle to distinguish it from the first
   ' popup menu:
   
   
   ' Attach the menu to the dialog
   MenuAttach hMenu, hDlg

   ' // Bold the Exit menu item
   MenuBoldItem(hMenu, ID_EXIT)
   ' // Right justify the Help menu
'   MenuRightJustifyItem(hMenu, 1)

   RETURN hMenu
END FUNCTION



The menu separator appear on last position after exit and not before.

Any help appreciated.
Thankx.

José Roca

In AfxMenuProcs2.inc change this line of MenuAddString:

IF wszText = "-" THEN RETURN AppendMenuW(hMenu, MF_SEPARATOR, 0, "")

change to:

IF wszText = "-" THEN RETURN AppendMenuW(hMenu, MF_SEPARATOR, 1, "")

José Roca

> On Tiko 1.1.1, i use DDT for transfert Powerbasic app.

Be warned that this is not ready for production code. It is a work in progress.

Probably it will be added later to AfxNova, another framework in progress.

docroger

Hello,

Thanx for quick response. Nice.

With latest version of afx2, my app no more compile... i see i must add #define _win32_winnt &h0602...

The filecopy.avi in template dir is corrupted... i take the one with powerbasic sample and all work again.

I continue my transfert of powerbasic app... more simple to translate to Purebasic (i am an old user of Purebasic).

Have a nice day and continue good job.

José Roca

#4
Thanks for pointing it. I have added

*.avi binary

to the .gitattributes file.

> see i must add #define _win32_winnt &h0602..

Yes. The FreeBasic headers are outdated. I think that they have made small changes to it.

I have added #define _WIN32_WINNT &h0602 to the templates.