在已经运行的进程中打开文件 [英] Open a file in a process already running

查看:93
本文介绍了在已经运行的进程中打开文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个程序,该程序通过c ++的system()调用打开文件.第一次打开时,它将运行约5分钟的测试,然后才能启动.

我用于打开这些文件的命令行参数是"program.exe -lfile.mpt".

我遇到的问题是该程序不允许一次打开两个实例,但是如果我关闭并重新打开它,则必须再次运行所有启动测试.

因此,我要寻找的是命令行参数,我可以使用它在已经运行的进程中在此程序中打开文件.我假设它会像(PID)-lfile.mpt"一样.

预先感谢,
帕特


到目前为止,我尝试过的是"net share mpt = c:\ MPT"(共享programs.exe所在的目录).我不确定我应该从哪里去,有人有什么想法吗?

I have a program that I am opening files in via system() calls from c++. When it opens for the first time, it runs about 5 minutes of tests before it can start.

The command line argument I''m using to open these files is "program.exe -lfile.mpt".

The problem I''m having is that this program does not allow two instances open at once, but if I close it and reopen it, all the start up tests would have to be ran again.

So what I''m looking for is a command line argument I can use to open a file in this program on a process that is already running. I''m assuming it will be something along the lines of "(PID) -lfile.mpt".

Thanks in advance,
Pat


What I have tried so far is "net share mpt=c:\MPT" (sharing the directory where programs.exe is). I''m not sure where I should go from here, anyone have any ideas?

推荐答案

您必须以共享模式打开文件,或者在一个实例中将其关闭.
you must open the file in shared mode, or close it in one instance.


这篇关于在已经运行的进程中打开文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆