24小时热门版块排行榜    

查看: 822  |  回复: 9
当前只显示满足指定条件的回帖,点击这里查看本话题的所有回帖

bianguojun

新虫 (小有名气)

[交流] 【求助】连接两个软件 已有5人参与

用MFC编了个小软件 想和另外一个软件(MFC编)链接起来  比如点下按钮就链接到另一个软件 不知道能不能实现 怎么实现
回复此楼
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

magic7004

金虫 (职业作家)

★ ★ ★
小木虫(金币+0.5):给个红包,谢谢回帖交流
ajian04(金币+2):谢谢交流~ 2010-11-05 17:43:15
引用回帖:
Originally posted by holmescn at 2010-11-05 11:37:22:
强烈建议使用CreateProcess或者OpenProcess这样的函数,因为你可以对打开的程序有更多的控制权

不需要那么多控制权的时候,就可以用ShellExecute啊。

只是WinExec这个函数不要用了,因为MSDN里有注解:
Note  This function is provided only for compatibility with 16-bit Windows. Applications should use the CreateProcess function.

另外WinExec这个函数不安全:
Security Remarks

The executable name is treated as the first white space-delimited string in lpCmdLine. If the executable or path name has a space in it, there is a risk that a different executable could be run because of the way the function parses spaces. The following example is dangerous because the function will attempt to run "Program.exe", if it exists, instead of "MyApp.exe".

WinExec("C:\\Program Files\\MyApp", ...)

If a malicious user were to create an application called "Program.exe" on a system, any program that incorrectly calls WinExec using the Program Files directory will run this application instead of the intended application.

To avoid this problem, use CreateProcess rather than WinExec. However, if you must use WinExec for legacy reasons, make sure the application name is enclosed in quotation marks as shown in the example below.

WinExec("\"C:\\Program Files\\MyApp.exe\" -L -S", ...)
流氓不可怕,可怕的是流氓有文化,有文化又BH的流氓无敌~~!
10楼2010-11-05 14:31:12
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
查看全部 10 个回答

magic7004

金虫 (职业作家)

★ ★
小木虫(金币+0.5):给个红包,谢谢回帖交流
ajian04(金币+1):谢谢参与交流~ 2010-11-04 21:55:31
不懂楼主说的“链接”是什么意思
流氓不可怕,可怕的是流氓有文化,有文化又BH的流氓无敌~~!
2楼2010-11-04 16:39:36
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

bianguojun

新虫 (小有名气)

引用回帖:
Originally posted by magic7004 at 2010-11-04 16:39:36:
不懂楼主说的“链接”是什么意思

就在其中一个软件中点下按钮 能打开另外一个软件
3楼2010-11-04 16:51:33
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

holmescn

金虫 (正式写手)

★ ★
小木虫(金币+0.5):给个红包,谢谢回帖交流
ajian04(金币+1):谢谢参与交流~ 2010-11-04 21:55:38
可以用OpenProcess函数. 详查MSDN
4楼2010-11-04 18:24:20
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
普通表情 高级回复 (可上传附件)
信息提示
请填处理意见