I have this code
CreateMdiMenu PROC hWnd:DWORD
invoke CreateMenu
mov hMenu,eax
invoke SetMenu,hWnd,eax
push eax
invoke GetWindowLong,hWnd,GWL_USERDATA
mov edi,eax
pop eax
mov [edi.MdiStruct.hMenu],eax
invoke CreatePopupMenu
mov hMenuMdiFile,eax
invoke CreatePopupMenu
mov hMenuMdiEdit,eax
invoke CreatePopupMenu
mov hMenuMdiTools,eax
lea esi,MiiMdiChild
push hMenuMdiFile
pop [esi.MENUITEMINFO.hSubMenu]
invoke InsertMenuItem,hMenu,-1,TRUE,esi
add esi,sizeof MENUITEMINFO
push hMenuMdiEdit
pop [esi.MENUITEMINFO.hSubMenu]
invoke InsertMenuItem,hMenu,-1,TRUE,esi
add esi,sizeof MENUITEMINFO
push hMenuMdiTools
pop [esi.MENUITEMINFO.hSubMenu]
invoke InsertMenuItem,hMenu,-1,TRUE,esi
lea esi,MiiMdiEdit
mov edi,119
mov ecx,3
loop_1:
push ecx
invoke LoadBitmap,hInstance,edi
mov [esi.MENUITEMINFO.hbmpChecked],eax
invoke InsertMenuItem,hMenuMdiFile,-1,TRUE,esi
add esi,sizeof MENUITEMINFO
inc edi
pop ecx
loop loop_1
invoke DrawMenuBar,hWnd
ret
CreateMdiMenu endp
No menu appears. why would that be?
i've been experiencing with WM_MDISETMENU but nothing happens.
I'm still fighting against these mdi children. Why dont they accept menus?
If you post complete code, maybe somebody can help
here the code:
.elseif uMsg==WM_CREATE
invoke MdiCreateWindows,hWnd
MdiCreateWindows PROC hWnd:DWORD
mov ebx,noMdiChild
mov eax,sizeof MdiStruct
xor edx,edx
mul ebx
lea edi,MdiStructs
add edi,eax
invoke SetWindowLong,hWnd,GWL_USERDATA,edi
push edi
invoke CreateMdiMenu,hWnd
invoke CreateToolbar,hWnd
pop edi
invoke GetClientRect,hWnd,addr rect
sub rect.bottom,38+22+22
invoke CreateWindowEx,0,addr WC_RICHEDIT50W,0,WS_VISIBLE+WS_CHILD+ES_SAVESEL+\
ES_MULTILINE+ES_LEFT+ES_AUTOHSCROLL+ES_AUTOVSCROLL+WS_HSCROLL+WS_VSCROLL,\
0,38+22,rect.right,rect.bottom,hWnd,RichEditId,hInstance,0
mov [edi.MdiStruct.hEdit],eax
inc noMdiChild
inc RichEditId
invoke GetClientRect,hWnd,addr rect
sub rect.bottom,22
invoke CreateWindowEx,WS_EX_STATICEDGE,addr WC_STATIC,0,WS_VISIBLE+WS_CHILD\
+SS_SIMPLE,rect.left,rect.bottom,rect.right,20,hWnd,\
0,hInstance,0
mov [edi.MdiStruct.hStatic],eax
ret
MdiCreateWindows endp
CreateMdiMenu PROC hWnd:DWORD
local hMdiMenu:DWORD
local hActive:DWORD
invoke CreateMenu
mov hMdiMenu,eax
push eax
invoke SetMenu,hWnd,eax
invoke GetWindowLong,hWnd,GWL_USERDATA
mov edi,eax
pop eax
mov [edi.MdiStruct.hMenu],eax
invoke CreatePopupMenu
mov hMenuMdiFile,eax
invoke CreatePopupMenu
mov hMenuMdiEdit,eax
invoke CreatePopupMenu
mov hMenuMdiTools,eax
lea esi,MiiMdiChild
push hMenuMdiFile
pop [esi.MENUITEMINFO.hSubMenu]
invoke InsertMenuItem,hMdiMenu,-1,TRUE,esi
add esi,sizeof MENUITEMINFO
push hMenuMdiEdit
pop [esi.MENUITEMINFO.hSubMenu]
invoke InsertMenuItem,hMdiMenu,-1,TRUE,esi
add esi,sizeof MENUITEMINFO
push hMenuMdiTools
pop [esi.MENUITEMINFO.hSubMenu]
invoke InsertMenuItem,hMdiMenu,-1,TRUE,esi
lea esi,MiiMdiFile
mov edi,119
mov ecx,3
loop_1:
push ecx
invoke LoadImage,hInstance,edi,IMAGE_BITMAP,16,16,LR_SHARED
mov [esi.MENUITEMINFO.hbmpChecked],eax
mov [esi.MENUITEMINFO.hbmpUnchecked],eax
invoke InsertMenuItem,hMenuMdiFile,-1,TRUE,esi
add esi,sizeof MENUITEMINFO
inc edi
pop ecx
loop loop_1
invoke SendMessage,hMdi,WM_MDISETMENU,hMenu,hMdiMenu
invoke DrawMenuBar,hWnd
ret
Thanks in advance. Let me know if you need all the code....cause i'll post.
Quote from: xandaz on November 26, 2020, 02:34:49 AM
Thanks in advance. Let me know if you need all the code....cause i'll post.
Of course we need the complete code! Do you think anybody has the time and energy to add all the headers and WndMain and WndProc to your snippet, in order to make it debuggable???
....ok. sorry.
what we're after is in the mdichild.asm.
It gives INVALID_WINDOW_HANDLE on SetMenu,hWnd,hMdiMenu although i'm not sure this call is necessary and gives the same error on WM_MDISETMENU and DrawMenuBar.
Sorry the error for SetMenu is ERROR_CHILD_WINDOW_MENU.
I'm pretty sure it's a lost issue. One must use WM_MDISETMENU to change menus but the menu bar always appears in the Frame Window.
It took me half an hour to fix things like [edi.CREATESTRUCT.hWndParent] instead of your [edi.CREATESTRUCT.hwndParent] ("Symbol not defined : CREATESTRUCTW.hwndParent"), the align_2 issue etc, only to discover that the WM_MDISETMENU message that you complain about is not present in your code. You are wasting my precious time.
I would laugh a little but it seems you're pretty serious. Sorry for anything.
I wonder how you made this code assemble, it throws errors :cool:
i was going through my own experiencies. WM_MDISETMENU was prolly commented. But did you get it to work? and [edi.CREATESTRUCT.hwndParent is not the way that's in the header. i din't know about the align_2 issue. Seems to work fine. Soryr if i wasted your time. Don't need to be rude. Thanks anyway
But did you get the menu to work? ty ty
It doesn't throw error. Assembles just fine. the supposed CREATESTRUCT.hwndParent issue doesn't even deserve to be mentioned. ît's a header problem. And the align_2 issue. I really don't see the point cause it's working just fine. I'm sorry and disgusted for myself for not being able to live up to your God-level or coding.
The code you posted at http://masm32.com/board/index.php?topic=8967.msg98143#msg98143 does not assemble, due to several little problems (I tried with MASM and UASM), and it does not contain the WM_MDISETMENU message that you say is not working.
It's not fully able but i think that this is the way WM_MDISETMENU message works. Haven't been able to make it restore the original frame window Menu but it seems that it's all. No child window menus allowed. ty
It appears that this is all that can be done. An exchange of menus using WM_NCMOUSEMOVE works perfectlly. No menus for child windows. ty. If you're interested to check it out it's under MdiChildProc and WndProc, tahnks JJ
Error A2063: Symbol not defined : CREATESTRUCTW.hwndParent
Did you "adjust" your Windows.inc?
no i did not because that's not very important. but i'll get there
So explain to me how you can assemble the code you posted, in spite of the undefined CREATESTRUCT.hwndParent issue. Or do you post code that assembles with errors?
Is it possible to assemble with errors? it has some issues i know but it assembles. How could there be an executable if it didn't?
Quote from: xandaz on November 28, 2020, 01:38:43 AMHow could there be an executable if it didn't?
That is a valid argument, but then how is it possible that you don't get an error message for CREATESTRUCT.hwndParent? Can you post your Windows.inc? This is mysterious, I'd like to understand what's going on.
from windows.inc
.CREATESTRUCTA STRUCT
lpCreateParams DWORD ?
hInstance DWORD ?
hMenu DWORD ?
hwndParent DWORD ?
ly DWORD ?
lx DWORD ?
y DWORD ?
x DWORD ?
style DWORD ?
lpszName DWORD ?
lpszClass DWORD ?
ExStyle DWORD ?
CREATESTRUCTA ENDS
CREATESTRUCTW STRUCT
lpCreateParams DWORD ?
hInstance DWORD ?
hMenu DWORD ?
hwndParent DWORD ?
ly DWORD ?
lx DWORD ?
y DWORD ?
x DWORD ?
style DWORD ?
lpszName DWORD ?
lpszClass DWORD ?
ExStyle DWORD ?
CREATESTRUCTW ENDS
My version says hWndParent, from Windows.inc, 977412 bytes, 10.1.2012 00:21
So you have an obsolete or "adjusted" Windows.inc :cool:
CREATESTRUCTA STRUCT
lpCreateParams DWORD ?
hInstance DWORD ?
hMenu DWORD ?
hWndParent DWORD ?
ly DWORD ?
lx DWORD ?
y DWORD ?
x DWORD ?
style DWORD ?
lpszName DWORD ?
lpszClass DWORD ?
ExStyle DWORD ?
CREATESTRUCTA ENDS
you're repeating yourself. I alreadu know that. Assembles with error. it's a special argument ml ?.asm /TAS (take all shit)
You have an obsolete or "adjusted" Windows.inc
Which means whatever source code you post may not run on the machines of other members.
There is a reason why I asked you above to post your Windows.inc
deleted
It's easy to verify the authenticity of those files, simple MD5 check :
9ac0409fdc21f94e07b627ccd575b43d *\masm32\include\\windows.inc
0b6c5c13a57db2e34ee7c2232c0665d8 *\masm32\include\winextra.inc
Jochen, could you send your MD5 values?
it's the way it's in the manual. i don't remember adjusting but probabily happened. take it easy JJ. ...and thanks
Quote from: nidud on November 28, 2020, 03:29:36 AM
https://docs.microsoft.com/en-us/windows/win32/api/winuser/ns-winuser-createstructw
typedef struct tagCREATESTRUCTW {
LPVOID lpCreateParams;
HINSTANCE hInstance;
HMENU hMenu;
HWND hwndParent;
Yes I know - the Masm32 SDK version is "wrong", but it works perfectly. You can name it HandleOfMyParent, and it will still work. The point is that we are a community of coders who want to exchange ideas and help each other. That can work only if we use exactly the same include files. As soon as somebody fumbles his *.inc files, it is a big waste of time for those who are trying to be helpful.
Quote from: Vortex on November 28, 2020, 03:32:23 AM
It's easy to verify the authenticity of those files, simple MD5 check :
9ac0409fdc21f94e07b627ccd575b43d *\masm32\include\\windows.inc
0b6c5c13a57db2e34ee7c2232c0665d8 *\masm32\include\winextra.inc
Jochen, could you send your MD5 values?
Sure:
include \masm32\MasmBasic\MasmBasic.inc ; download (http://masm32.com/board/index.php?topic=94.0)
Init
GetHashRev=1
If_ GetHash(FileRead$(<CL$()>), LastFileSize, md5) Then PrintLine "The MD5 of ", CL$(), " is ", Hex$(xmm0)
EndOfCodeThe MD5 of \Masm32\include\Windows.inc is 9AC0409F DC21F94E 07B627CC D575B43D
Source & exe attached, so that xandaz can post his values, too.
The code became too complex and i'm having a hard time finding a certain glitch. When i close a project and the reopen only one of the source files is loaded. JJ said something about the align_2 issue. i wonder if thta's what you ment...can soomeone help out.
Error A2063: Symbol not defined : CREATESTRUCTW.hwndParent
I will not adjust my Windows.inc for you
here is goes corrected.
Thanks. I've been able to assemble it, and it runs fine. The WM_MDISETMENU message succeeds without error, but there is no menu in the mdi child. However, if you move the mouse between the main and mdi captions, you will notice that the main menu changes between Edit and Build.
Have you studied Iczelion's tutorial on mdi menus?
http://www.interq.or.jp/chubu/r6/masm32/tute/tute032.html
Thanks JJ. What was :skrewy: align_2 issue that you were talking about? The application only loads the full project at runtime. after closing the project it only loads one window. it's strange but i'm not sure that it has something to do with ManageOpenMode. it's spmething far simpler.
Quote from: xandaz on November 29, 2020, 08:40:00 PMWhat was :skrewy: align_2 issue that you were talking about?
A name conflict. I tested your code with MasmBasic, which includes essential stuff from the
Masm32 SDK; for example: \Masm32\include\dialogs.inc
include \masm32\include\masm32rt.inc ; pure Masm32
.code
start:
mov ecx, 3
align_2:
dec ecx
loopnz align_2
MsgBox 0, "ok?", "Test:", MB_OK
exit
end start
Yeah...well. Problem solved. It was the Final_File flag. it had to be reset. I moved things around a little like in Iczelion's tute but the result is exactlly the same. Thanks JJ