Hah, I actually made the same error when I was testing it a second ago... I set windowed to false thinking it was "fullscreen" - don't worry, the most frustrating and time consuming bugs are the ones where you make a stupid mistake. You gloss over the mistake because you can't
possibly make a mistake so simple

Look into
rubber duck debugging - whenever I'm searching for a bug and I just can't find it, I call in another dev and start explaining the code to them. They don't do anything or participate or even listen, but the act of explaining it that way forces you to consider those details you overlook because they are so obvious ( if (condition = true) ).
As for the HWND issue, make sure you are compiling and running the debug configuration, not release. If you try debugging a release build, you usually get incorrect data / variable unused / not found / etc. because the compiler doesn't insert debug information and mangles the code quite a bit for optimizations, and thus it can't find the variable.
And just a few more random thoughts:
consider wrapping all your raw directx pointers like so
typedef CComPtr<IDirect3D9> D3DPtr;
typedef CComPtr<IDirect3DDevice9> D3DDevicePtr;
That way, you don't have to call remember when you need to call Release, it will save you tons of time looking for memory leaks. You just use D3DPtr in place of LPDIRECT3D9
You might want to create only one D3DDevice for all (non-fullscreen) windows. Almost everything (textures, vertex buffers, shaders) is device-bound, so if you want to use one texture in two devices, you have to create it twice and keep track of which one belongs to which device. I use something similar to this (pseudocode):
Window::Create(devicemanager)
if (devicemanager.device == null)
m_device = devicemanager.CreateDevice()
else
m_device = devicemanager.device
If you want multiple fullscreen windows, however, you have to use multiple devices. But most of the time all you really need multiple windows for is a level editor or other tools, and don't need them to run in fullscreen.