I haven't tried this with your library, but just reading your code you don't seem to check the HWND for being zero so I presume you have this bug / feature also.
I've tried this in the C++ and GetApplicationViewForHwnd(0) crashes the explorer.exe, Twinui.dll more specifically.