The MASM Forum Archive 2004 to 2012

General Forums => The Workshop => Topic started by: fushiyun on March 01, 2006, 03:01:43 PM

Title: MDI problem
Post by: fushiyun on March 01, 2006, 03:01:43 PM
i use MDI window as my project window.
when i add a new child window to MDI, this child name will append to main menu automatically.
code as follows:
invoke GetMenu,hWnd                    ;get main menu
mov hMainMenu,eax
invoke GetSubMenu,hMainMenu,1     ;get sub menu
mov ClientStruct.hWindowMenu,eax  ;the child window will append to this sub menu

but, i think to add this child name into a new popup menu which is inserted at a given sub menu.
code as follows:
menuname dd "Recent Files",0
local hChildMenu:dd
local hSubMenu:dd

invoke GetMenu,hWnd
invoke GetSubMenu,eax,0
mov hSubMenu,eax
invoke CreateMenu
mov hChildMenu,eax
invoke InsertMenu hSubMenu,5,MF_POPUP or MF_BYPOSITION, hChildMenu, addr menuname

but, in the top of RecentFiles menu, it has a Separator.
in RadAsm, it has no this Separator in the top of Recent Files menu.
Can anyone tell me how to do this.
thank.
Title: Re: MDI problem
Post by: Tedd on March 01, 2006, 05:22:49 PM
You could insert each of the menu items one at a time.
I don't think you're supposed to insert the contents of a popup menu directly into the middle of another popup menu; you insert the menu item that produces that popup menu.

So do you want...?

File
----
.
.
recent > file1
         file2
         file3


or

File
----
.
.
file1
file2
file3
Title: Re: MDI problem
Post by: fushiyun on March 02, 2006, 02:08:07 AM
it will display as
Recent Files -> --------
       file1
       file2
       file3


i want
Recent Files -> file1
      file2
      file3
Title: Re: MDI problem
Post by: Tedd on March 03, 2006, 12:35:53 PM
Tadaa!

[attachment deleted by admin]
Title: Re: MDI problem
Post by: fushiyun on March 06, 2006, 03:07:48 AM
thank Tedd offer a zip file.
but it is not that i want.


first of all, my English is poor.
so, my explain have a little problem.

i try to explain my problems.
in Multiple Document Interface (MDI), the system will automatically insert a menu item that indicates the new child name.
but, in the top of this menu item, the system will insert a separator.
i don't want this separator when a new child is created.
therefore, i create a new popup menu that is Recent Files.
i hope that the child name displays on this new popup menu.

but it will display as follows when a new MDI child is created.
Recent Files -> --------
       file1
       file2
       file3


i hope this style like RadASM's Recent Files.
Can anybody tell me how to do this.
thanks. :(
Title: Re: MDI problem
Post by: Tedd on March 06, 2006, 11:40:27 AM
I think this is just the way the mdi functions work - you can not change it.
If you want it to work in a different way, you will have to make it yourself.
When you create the new child, also add the menu item into the recent-files menu :wink
Title: Re: MDI problem
Post by: fushiyun on March 07, 2006, 06:14:13 AM
i know.
thank Tedd. :bg