using System.Runtime.InteropServices;using System.Diagnostics;[DllImport("user32.dll")]public static extern IntPtr GetClipboardOwner();[DllImport("user32.dll")]public static extern int GetWindowThreadProcessId(IntPtr handle, out int processId);[DllImport("kernel32.dll")]public static extern bool CloseHandle(IntPtr handle);private void button1_Click(object sender, EventArgs e)...{ IntPtr vOwner = GetClipboardOwner(); if (vOwner == IntPtr.Zero) return; int vProcessId; GetWindowThreadProcessId(vOwner, out vProcessId); Process vProcess = Process.GetProcessById(vProcessId); Text = vProcess.MainModule.FileName;} uses PsAPI;procedure TForm1.Button1Click(Sender: TObject);var vOwner: THandle; vProcessId: THandle; vProcess: THandle; vBuffer: array[0..255] of Char;begin vOwner := GetClipboardOwner(); if vOwner = 0 then Exit; GetWindowThreadProcessId(vOwner, vProcessId); vProcess := OpenProcess(PROCESS_QUERY_INFORMATION or PROCESS_VM_READ, False, vProcessId); GetModuleFileNameEx(vProcess, 0, vBuffer, SizeOf(vBuffer)); CloseHandle(vProcess); Caption := vBuffer;end;