获得剪贴板来源进程名
来源:互联网 发布:大数据的4v特征是多选 编辑:程序博客网 时间:2024/06/08 18:00
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;
}
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;
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;
- 获得剪贴板来源进程名
- 获得当前进程名
- zwCreateProcess获得目标进程名
- 如何从进程名获得进程ID
- 获得当前运行进程的进程名
- 函数-从进程名获得进程ID、从进程ID获得进程路径
- 获得指定进程名的进程ID列表
- Linux下通过进程名获得进程号
- Linux下通过进程名获得进程号
- 在linux中通过进程名获得进程id
- [C/C++]获得进程号PID、进程名
- 根据进程名获得进程ID(不区分进程名大小写)
- 美国州名来源
- 进程通信之剪贴板
- VS2013进程通讯-剪贴板
- 进程通信_剪贴板
- 驱动层怎样获得当前进程全路径名(1)
- WINDOWS下获得端口对应的进程名1
- 儿子居然会打魔兽了
- 为IP v6划分子网
- 对ldd3 中jiq程序的一点笔记
- 测试随笔
- 我的博客生活从此开始。
- 获得剪贴板来源进程名
- 通过LFS学习LINUX
- Windows操作系统快捷方式大全
- [转]Personality Traits of the Best Software Developers
- DOS命令大全
- 通用权限管理设计篇(一)
- sql语言修改表的结构
- Linux那些事儿之我是UHCI(9)有一种资源,叫中断
- 多处理器系统在指定cpu上运行进程