iczelion tut32[4]

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

本文简介:选择自 jimgreen 的 blog

          .endif

normally, you would just ignore the messages from unhandled cases. but in the mdi case, if you ignore them, when the user clicks on the name of an mdi child window in the window list, that window won't become active. you need to pass them to defframeproc so they can be handled properly.

a caution on the value of idfirstchild: you should not use 0. your window list will not behave properly, ie. the check mark will not appear in front of the name of the first mdi child even though it's active. choose a safe value such as 100 or above.

having filled in the clientcreatestruct structure, you can create the client window by calling createwindowex with the predefined class name,"mdiclient", and passing the address of the clientcreatestruct structure in lparam. you must also specify the handle to the frame window in the hwndparent parameter so windows knows the parent-child relationship between the frame window and the client window. the window styles you should use are: ws_child ,ws_visible and ws_clipchildren. if you forget ws_visible, you won't see the mdi child windows even if they were created successfully.

the steps in creating the client window are as follows:

  1. obtain the handle to the submenu that you want to append the window list to.
  2. put the value of the menu handle along with the value you want to use as the id of the first mdi child window in a clientcreatestruct structure
  3. call createwindowex with the class name "mdiclient", passing the address of the clientcreatestruct structure you just filled in in lparam.

creating the mdi child window

now you have both the frame window and the client window. the stage is now ready for the creation of the mdi child window. there are two ways to do that.

  • you can send wm_mdicreate message to the client window, passing the address of a structure of type mdicreatestruct in wparam. this is the easiest and the usual method of mdi child window creation.
    .data?
        mdicreate mdicreatestruct <>
        ....
    .code
        .....
        [fill the members of mdicreate]
        ......     invoke sendmessage, hwndclient, wm_mdicreate,addr mdicreate,0

    sendmessage will return the handle of the newly created mdi child window if successful. you don't need to save the handle though. you can obtain it by other means if you want to. mdicreatestruct has the following definition.

    mdicreatestruct struct
    szclass   dword ?
    sztitle     dword ?
    howner    dword ?
    x               dword ?
    y               dword ?
    lx              dword ?
    ly              dword ?
    style         dword ?
    lparam     dword ?
    mdicreatestruct ends
szclass the address of the window class you want to use as the template for the mdi child window.
sztitle the address of the text you want to appear in the title bar of the child window
howner the instance handle of the application
x,y,lx,ly the upper left coordinate and the width and height of the child window
style child window style. if you create the client window with mdis_allchildstyles, you can use any window style.
lparam an application-defined 32-bit value. this is a way of sharing values among mdi windows. if you don't need to use it, set it to null

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

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

go top