iczelion tut32[3]

[入库:2005年8月19日] [更新:2007年3月24日]

本文简介:选择自 jimgreen 的 blog

  1. fill in the wndclassex structure as usual
  2. register the frame window class by calling registerclassex
  3. create the frame window by calling createwindowex
  4. within the message loop, call translatemdisysaccel.
  5. within the window procedure, pass the unprocessed messages to defframeproc instead of defwindowproc.

creating the client window

now that we have the frame window, we can create the client window. the client window class is pre-registered by windows. the class name is "mdiclient". you also need to pass the address of a clientcreatestruct structure to createwindowex. this structure has the following definition:

clientcreatestruct struct
        hwindowmenu    dd ?
        idfirstchild    dd ?
clientcreatestruct ends

hwindowmenu is the handle to the submenu that windows will append the list of mdi child window names. this feature requires a little explanation. if you ever use an mdi application like microsoft word before, you'll notice that there is a submenu named "window" which, on activation, displays various menuitems related to window management and at the bottom, the list of the mdi child window currently opened. that list is internally maintained by windows itself: you don't have to do anything special for it. just pass the handle of the submenu you want the list to appear in hwindowmenu and windows will handle the rest. note that the submenu can be any submenu:it doesn't have to be the one that is named "window". the bottom line is that, you should pass the handle to the submenu you want the window list to appear. if you don't want the list, just put null in hwindowmenu. you get the handle to the submenu by calling getsubmenu.

idfirstchild is the id of the first mdi child window. windows increments the id for each new mdi child window the application created. for example, if you pass 100 to this field, the first mdi child window will have the id of 100, the second one will have the id of 101 and so on. this id is sent to the frame window via wm_command when the mdi child window is selected from the window list. normally you'll pass this "unhandled" wm_command messages to defframeproc. i use the word "unhandled" because the menuitems in the window list are not created by your application thus your application doesn't know their ids and doesn't have the handler for them. this is another special case for the mdi frame window: if you have the window list, you must modify your wm_command handler a bit like this:

.elseif umsg==wm_command
.if lparam==0 ; this message is generated from a menu           mov eax,wparam
          .if ax==idm_cascade
                 .....
          .elseif ax==idm_tilevert
                .....           .else
                invoke defframeproc, hwndframe, hwndclient, umsg,wparam, lparam
                ret

本文关键:iczelion asm
  相关方案
Google
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top