layout: post
title: Electron C# dll hook获取活动窗口的进程和路径
date: 2019-09-15 15:57:52 +0800
categories: EElectron
tags: [“Electron”, “Nodejs”, “C#”, “dll”]
notebook: Electron
disqus: false
gitalk: true
description: Electron 抓取底层的系统信息。获取活动窗口的进程名,进程id和路径位置。主要使用Electron,electron-edge-js,C#生成库文件。
在实现这个要求前,需要有node-gyp,node-gyp需要有python2.7,visual studio2015的什么动态链接库。为了简便方法的安装,我安装的的方法是直接安装windows-build-tools的包。
Windows的环境
1. 安装gyp
npm i -g node-gyp
2. 安装扩展包
npm install --global --production windows-build-tools
3. 配置python路径
路径的位置是在系统用户的文件夹下的.windows-build-tools里面。c:/user/用户/.windows-build-tools
node-gyp python --python /path/to/python27
安装Electron
npm i -g electron@latest
1. 建立工程
mkdir electron-demo
npm init
npm i electron
npm i electron-edge-js
2. 初始化index.html
和index.js
index.html
<!DOCTYPE html>
<html><head></head>
<body>
测试<input type=