static extern uint GetKeyboardLayoutList(int nBuff, [Out] IntPtr [] lpList);
uint nElements = GetKeyboardLayoutList(0, null);
GetKeyboardLayoutList(ids.Length, ids);