如何用C#实现一个程序注入另一个程序

如何用C#实现一个程序注入另一个程序,第1张

我这里有个例子

System.Diagnostics.ProcessStartInfo Info = new System.Diagnostics.ProcessStartInfo()

//设置外部程序

Info.FileName = "eclipse.exe"

//设置外部程序工作目录为 C:\

Info.WorkingDirectory = @"厅好迹D:\常用软件\eclipse"袜余

//最小化扮并方式启动

Info.WindowStyle = System.Diagnostics.ProcessWindowStyle.Minimized

//声明一个程序类

System.Diagnostics.Process Proc

try

{

Proc = System.Diagnostics.Process.Start(Info)

System.Threading.Thread.Sleep(500)

}

catch (System.ComponentModel.Win32Exception)

{

return

}

Keil中序变成一个子函数加进另一个程凯袭序里面运行方法如下:

把这个程序的main函数换个名字,

然后返塌在另一个程序中通过新的盯世兄名字调用这个函数即可。

#include 就可以了。redis的弯困源代码下有一个ae.c,需埋没念要根据windows或者linux等情况包含不察桐同的文件

/* Include the best multiplexing layer supported by this system.

* The following should be ordered by performances, descending. */

#ifdef _WIN32

#include "ae_wsiocp.c"

#else

#ifdef HAVE_EVPORT

#include "ae_evport.c"

#else

#ifdef HAVE_EPOLL

#include "ae_epoll.c"

#else

#ifdef HAVE_KQUEUE

#include "ae_kqueue.c"

#else

#include "ae_select.c"

#endif

#endif

#endif

#endif


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/yw/8232302.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-14
下一篇 2023-04-14

发表评论

登录后才能评论

评论列表(0条)

保存