It maybe that using the functions below to identify your "chrome" variable will bring better luck.

BOOL WINAPI GetGUIThreadInfo( _In_ DWORD idThread, _Inout_ LPGUITHREADINFO lpgui);
HWND WINAPI GetCapture(void);