如何监视一个文件的打开操作

来源:百度知道 编辑:UC知道 时间:2024/06/27 05:47:18
例如我先对一个1.txt文件加密,在用记事本打开的时候,由程序截获消息,解密后再替换原加密过的文件,由记事本打开。本人才疏学浅,希望有大人帮助
用C#怎么编写

这种东西应该用文件驱动来做, C#做不了。
你搜索 透明文件加密 就会找到资料了

建议学习win API 钩子~~~,可以解决你的问题

c#文件监视器源代码:

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.IO;

namespace WindowsApplication8
{
///
/// Form1 的摘要说明。
///
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.ListBox listBox1;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.TextBox textBox2;
///
/// 必需的设计器变量。
///
private System.ComponentModel.Container components = null;

public Form1()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();

//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码 <