Printing all existing windows on a windows container

I wrote a simple cpp console app that prints all the open windows titles:

for (HWND hwnd = GetTopWindow(NULL); hwnd != NULL; hwnd = GetNextWindow(hwnd, GW_HWNDNEXT)) { 
    if (!IsWindowVisible(hwnd)) continue; 
    int length = GetWindowTextLength(hwnd);
    char* title = new char[length+1];     
    GetWindowText(hwnd, title, length+1); 
    printf(" Title: %s", title);

The main reason of that app is to monitor the windows another exe is opening.
However, it only prints hello and no titles at all.
While it does works on the host windows os and prints all the existing windows on it.
What is the difference on docker and how can I make it work similarly?

Go to Source
Author: flowerProgrammer