1) is easy. Just put the line
hWndTarget = hwnd1;
right before the message loop in the codes I've shown you. Then the engine will render in the second window we create in that code. Note that it won't adjust the resolution though. So you have to set the resolution to the window size or vice versa.