Thread: Melp multi mdiclient

  1. #1
    Registered User kryptkat's Avatar
    Join Date
    Dec 2002
    Posts
    638

    Melp multi mdiclient

    Is there a better way to do this?

    Code:
    while(GetMessage(&Msg, NULL, 0, 0) > 0)
    	{
    		if (!TranslateMDISysAccel(g_hMDIClient || mg_hMDIClient  , &Msg))
    		{
    			TranslateMessage(&Msg);
    			DispatchMessage(&Msg);
    		}
    	}
    	return Msg.wParam;
    }
    What I was trying to do. Open multiple types of mdiclient child windows with different attributes. It is just two right now but may be as many as 14 later. Started with winforge2 app4 source code as base. Then duplicated the mdichild stuff. Part of the problem is in the message loop. I can replace mg with g and vice a versa and open the window on the first program like this I did. This is the second program working out some bugs that started with the winforge2 source code. A restart from scratch using the base code from the tut. It will not take the || or and since I am just using two different types of mdichild types now I see a problem adding more types. If I put a switch case in the middle of the if I am not sure that will work. Suggestions for a better way? Or know of other code that already does this? Meow. Stuck. Was considering using a different Msg and a second loop that would require more changes to the code. Both mdichild types are the same now but when I can call both of them and have both or more of different types on screen then I will change the attributes.

  2. #2
    Registered User kryptkat's Avatar
    Join Date
    Dec 2002
    Posts
    638
    So no one had tried to do this before? I could use dialog boxes but that is not what I wanted to do. I could also write a separate program for each of the different types of MDIchild windows program that I want. But that is not what I want to do eighter.

    Some questions.

    Do I need a different windows class or just a separate MDIchild class?

    Code:
    const char g_szClassName[] = "myWindowClass";
    const char g_szChildClassName[] = "myMDIChildWindowClass";
    
    
    const char mg_szClassName[] = "mmyWindowClass";
    const char mg_szChildClassName[] = "mmyMDIChildWindowClass";
    how about

    Code:
    HWND CreateNewMDIChild(HWND hMDIClient)
    {
    	MDICREATESTRUCT mcs;
    	HWND hChild;
    
    	mcs.szTitle = "[Untitled]";
    
    and....
    
    HWND CreateMNewMDIChild(HWND MhMDIClient)
    {
    	MDICREATESTRUCT mmcs;
    	HWND mhChild;
    
    	mmcs.szTitle = "[Muntitled]";
    same hChild can be used or not?

    And
    Code:
    			// Find window menu where children will be listed
    			ccs.hWindowMenu  = GetSubMenu(GetMenu(hwnd), 2);
    			ccs.idFirstChild = ID_MDI_FIRSTCHILD;
    
    and ....
    
    			// Find window menu where children will be listed
    			mccs.hWindowMenu  = GetSubMenu(GetMenu(hwnd), 2);
    			mccs.idFirstChild = ID_MDI_FIRSTCHILD;
    can the same be used or a different mccs needed? meow.

  3. #3
    Registered User
    Join Date
    Mar 2005
    Location
    Mountaintop, Pa
    Posts
    1,058
    Open multiple types of mdiclient child windows with different attributes
    You could possibly use memory reserved for passing data to your child windows by defining the cbWndExtra field in WNDCLASS structure with a nonzero value to indicate the size of the data being passed to the child window. This passed data would be used in your child proc for sizing each child window differently, customizing text fg/bg colors of each child window etc. In other words, pass a data structure to each of your child windows to provide the customization needed

  4. #4
    Registered User kryptkat's Avatar
    Join Date
    Dec 2002
    Posts
    638
    ok will try that.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Multi dimensional array
    By $l4xklynx in forum C Programming
    Replies: 7
    Last Post: 01-03-2009, 03:56 AM
  2. Help printing a multi array
    By cjohnman in forum C Programming
    Replies: 4
    Last Post: 05-05-2008, 01:35 PM
  3. starting to learn multi threading
    By hanhao in forum C++ Programming
    Replies: 2
    Last Post: 06-09-2004, 01:44 PM
  4. Replies: 6
    Last Post: 04-26-2004, 10:02 PM
  5. why multi desktops in KDE..
    By compiler in forum Tech Board
    Replies: 12
    Last Post: 07-01-2003, 11:04 PM