Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 533585
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T09:31:25+00:00 2026-05-13T09:31:25+00:00

Suppose i have 5 window to be created in which one is parent and

  • 0

Suppose i have 5 window to be created in which one is parent and the four window are child window. So on the parent window if i have to create four window then how should i implement the structure concept so as to reduce the code segment.?

Is this a good habit or not to use the structure concept?

Please reply thanks a lot.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T09:31:25+00:00Added an answer on May 13, 2026 at 9:31 am

    Suppose u have a structure

    struct HANDLES
    {
        HINSTANCE hInstance;
            HWND parent;
            HWND childwindow1;
            HWND childwindow2;
            HWND childwindow3;
            HWND childwindow4;
        };
    
    Now declare object for this handle
    
        HANDLES handles;
    

    Now create parent window like this at bool WINAPI InitInstance(HINSTANCE hInstance, int nCmdShow)

    handles.parent = CreateWindowEx(0,
                    className,
                    windowName, 
                    WS_VISIBLE | WS_POPUP,
                    0, 0, 
                    coordinates.width, coordinates.height,
                    NULL, 
                    NULL, 
                    hInstance, 
                    NULL);
    

    where coordinates is an object and width & height are data member of COORDINATES.

    Now create the child window under WM_CREATE.

        HWND *buttons = &(handles.childwindow1);
            for(int i = MIN_BUTTON; i <= MAX_BUTTON; i++)  // MIN_BUTTON = 0 & MAX_BUTTON = 3
            {
    
                *buttons = CreateWindowEx(WS_EX_TOPMOST,
                                           TEXT("button"), 
                                           L"",
                                           WS_CHILD | WS_VISIBLE | BS_OWNERDRAW,
                                           btns[i].x, btns[i].y,
                                           btns[i].width,btns[i].height,
                                           handles.parent,     
                                           (HMENU) ((short)(INITIAL_BUTTON + i)), //(INITIAL_BUTTON + i) is id for your child window
                                           handles.hInstance, NULL) ;
                 buttons++;
            }
    

    where “btns[4]” is an object of struct “AXIS”

    AXIS btns[4];
    
    struct AXIS
    {
        short int x;
        short int y;
        short int width;
        short int height;
        short int widthSrc;
        short int heightSrc;
    };
    

    and for each child window there is a different value which is specified from btns[0] to btns[3].

    So in this way u can create your window using structure.

    Yes its a good habit to use structure which reduces code segment and easy to implement.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose I have a process which spawns exactly one child process. Now when the
Suppose I have a Window with TextBoxes I want to use the values. Right
Suppose I have a javascript object like this: window.config config.UI = { opacity: {
Suppose I have thread 1, the main window UI thread and thread 2, a
Basically, I have a settings window, and when you click OK, it's suppose to
suppose, we have a Mozilla Prism like XULRunner app. There is a XUL window
suppose you have the following structure: #include <windows.h> // BOOL is here. #include <stdio.h>
Suppose we have the following table data: ID parent stage submitted 1 1 1
I have a datetime object, for which I want to create a date string
In Windows, suppose you have multiple windows (HWNDs) of the same window class open.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.