public static IntPtr ShellGetPath2(IntPtr hwnd) { IntPtr zero = IntPtr.Zero; try { uint num; PInvoke.GetWindowThreadProcessId(hwnd, out num); IntPtr hData = PInvoke.SendMessage(hwnd, 0x40c, (IntPtr)num, IntPtr.Zero); if (!(hData != IntPtr.Zero)) { return(zero); } IntPtr pidl = PInvoke.SHLockShared(hData, num); if (pidl != IntPtr.Zero) { zero = PInvoke.ILClone(pidl); PInvoke.SHUnlockShared(pidl); } PInvoke.SHFreeShared(hData, num); } catch { } return(zero); }