What I'm trying to do is steal a window from the screen and make it a child of my own created window. When my program closes, the stolen windows goes away too, probably along with its process.

So here are my questions:

1. The created window is frozen, it won't let me operate its controls. Does the console prevent it from being operated? If so, how can I fix this?
2. (code below) only steals the window on its second run, it doesn't do it in the first run and the window is still left in the taskbar.
3. I tried doing the same except I've stolen a Chrome window into a notepad window. Same problems and when it did stole the window, everything looked completely torn apart, rendering the browser virtually inoperable.

Here's the code I used (Win32 Console Application):

```
#include <conio.h> 
#include <stdio.h>
#include <Windows.h>
#include <winuser.h>

LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
LPCWSTR sClassName = L"MyClass";

HWND CreateTheWindow(LPCWSTR WindowTitle) {

    // Create & register the class
    WNDCLASSEX WndClass;
    WndClass.cbSize = sizeof(WNDCLASSEX); WndClass.style = NULL; WndClass.lpfnWndProc = WndProc; 
    WndClass.cbClsExtra = 0; WndClass.cbWndExtra = 0; WndClass.lpszClassName = sClassName;
    WndClass.hInstance = NULL; WndClass.hIcon = LoadIcon(NULL, IDI_APPLICATION); 
    WndClass.hCursor = LoadCursor(NULL, IDC_ARROW); WndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
    WndClass.lpszMenuName  = NULL;  WndClass.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
    RegisterClassEx(&WndClass);

    // Create & show the window
    HWND hwnd = CreateWindowEx(WS_EX_STATICEDGE, sClassName, WindowTitle, WS_OVERLAPPEDWINDOW, 
        CW_USEDEFAULT, CW_USEDEFAULT, 320, 240, NULL, NULL, NULL, NULL);

    ShowWindow(hwnd, SW_SHOW); UpdateWindow(hwnd);
    return hwnd;
}

// No idea what's this for, back in JS we simply had to do window.open 
LRESULT CALLBACK WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam) {
    switch(Message) {
        case WM_CLOSE: DestroyWindow(hwnd); break;
        case WM_DESTROY: PostQuitMessage(0); break;
        default: return DefWindowProc(hwnd, Message, wParam, lParam);
    }
    return 0;
}

// start
void main()
{
    HWND chrome = FindWindow(L"Chrome_WidgetWin_1", NULL);
    HWND mywin = CreateTheWindow(L"HELLO BOSS");

    if(chrome!=0) printf("Got Chrome\r\n"); else printf("Chrome not found\r\n");
    if(mywin!=0) printf("Got yours\r\n"); else printf("Your window not found\r\n");

    SetParent(chrome, mywin);
    SetWindowLong(chrome, GWL_STYLE, WS_CHILDWINDOW | WS_VISIBLE  ); 
    UpdateWindow(chrome); 
    UpdateWindow(mywin);

    _getch();
}

```

Oh BTW, please don't ask me what I'm trying to achieve. :D It's a surprise.