1. Сделаем всё тоже самое, что мы делали тут https://programming.mybb.ru/viewtopic.php?id=263
2. Напишим код main.cpp:

Код:
#include <conio.h>
#include <graphics.h>
#include <cstring.h>
#include <stdlib.h>
#include <bios.h>

#define CREATE    	0x00
#define RESIZE    	0x01
#define PAINT    	0x02

/// WINDOW
typedef struct {
  string title;
  int x;
  int y;
  int width;
  int height;
  int bkcolor;
} WINDOW;

void clear_window(WINDOW w) {
  for(int y=w.y-2; y<w.y+w.height+3; y++) {
	 for(int x=w.x-2; x<w.x+w.width+3; x++) {
    putpixel(x, y, getbkcolor());
	 }
  }
}

void paint_window(WINDOW w) {
  setcolor(LIGHTGRAY);
  rectangle(w.x-2, w.y-2, w.x+w.width+2, w.y+w.height+2);
  rectangle(w.x, w.y, w.x+w.width, w.y+w.height);
  rectangle(w.x, w.y, w.x+w.width, w.y+20);
  setfillstyle(SOLID_FILL, BLUE);
  floodfill(w.x+2, w.y+2, LIGHTGRAY);
  setcolor(WHITE);
  outtextxy(w.x+10, w.y+5, w.title.c_str());
  floodfill(w.x+2, w.y+2, LIGHTGRAY);
  setfillstyle(SOLID_FILL, w.bkcolor);
  floodfill(w.x+2, w.y+25, LIGHTGRAY);
}

WINDOW create_window(string title, int x, int y, int width, int height) {
  WINDOW w;
  w.x = x;
  w.y = y;
  w.width = width;
  w.height = height;
  w.title = title;
  w.bkcolor = WHITE;
  return w;
}

void draw_pixel(WINDOW w, int x, int y, int color) {
  putpixel(w.x+x+2, w.y+y+17, color);
}

WINDOW move_window(WINDOW w, int x, int y) {
  w.x = x;
  w.y = y;
  return w;
}

WINDOW resize_window(WINDOW w, int width, int height) {
  w.width = width;
  w.height = height;
  return w;
}

WINDOW set_window_title(WINDOW w, string title) {
  w.title = title;
  return w;
}

/// MAIN
int main(void) {
  int GraphDriver = DETECT;
  int GraphMode;
  int ErrorCode;
  char *buf;
  WINDOW w;
  int none=0;
  unsigned int msg = CREATE;

  initgraph(&GraphDriver, &GraphMode, "");
  ErrorCode = graphresult();
  if(ErrorCode != grOk){
	 exit(1);
  }

  setbkcolor(CYAN);
  while(!kbhit()) {
  switch(msg) {
	 case CREATE:
    w = create_window("Test Window", 10, 10, 120, 140);
    paint_window(w);
    getch();
    msg = RESIZE;
	 break;

	 case RESIZE:
     clear_window(w);
     w = move_window(w, 15, 25);
     w = resize_window(w, 600, 400);
     w = set_window_title(w, "New Title");
     paint_window(w);
     getch();
     msg = PAINT;
	 break;
	 case PAINT:
    for(int i=0; i<40; i++)
      draw_pixel(w, i, i, RED);
	 break;
  }
  }

  getch();
  closegraph();
  return 0;
}

Результат:
https://i.ibb.co/kXf4GJJ/bcpp45-01-22-45-08-10-2021-min.jpg
https://i.ibb.co/3kqX6Kh/bcpp45-02-22-49-08-10-2021-min.jpg