标题:startupinfo结构的一个问题
只看楼主
emoly
Rank: 1
等 级:新手上路
帖 子:12
专家分:0
注 册:2013-6-10
结帖率:50%
已结贴  问题点数:20 回复次数:1 
startupinfo结构的一个问题
我想知道对startupinfo结构的hStdInput hStdOutput hStdError 赋值为socket的句柄,创建的匿名管道为cmd。那三个结构参数是怎么知道传递进来的句柄是套接字并且还能把数据传输到另一端?
搜索更多相关主题的帖子: 管道 
2013-07-06 00:08
yuccn
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
来 自:何方
等 级:版主
威 望:167
帖 子:6809
专家分:42393
注 册:2010-12-16
得分:20 
底层对于管道或者socket 的操作是一样的把,可以参考msdn
http://msdn.(v=vs.85).aspx

hStdInput
If dwFlags specifies STARTF_USESTDHANDLES, this member is the standard input handle for the process. If STARTF_USESTDHANDLES is not specified, the default for standard input is the keyboard buffer.
 
If dwFlags specifies STARTF_USEHOTKEY, this member specifies a hotkey value that is sent as the wParam parameter of a WM_SETHOTKEY message to the first eligible top-level window created by the application that owns the process. If the window is created with the WS_POPUP window style, it is not eligible unless the WS_EX_APPWINDOW extended window style is also set. For more information, see CreateWindowEx.

Otherwise, this member is ignored.
 hStdOutput
If dwFlags specifies STARTF_USESTDHANDLES, this member is the standard output handle for the process. Otherwise, this member is ignored and the default for standard output is the console window's buffer.
 
If a process is launched from the taskbar or jump list, the system sets hStdOutput to a handle to the monitor that contains the taskbar or jump list used to launch the process. For more information, see Remarks.

Windows 7, Windows Server 2008 R2, Windows Vista, Windows Server 2008, Windows XP, and Windows Server 2003:  This behavior was introduced in Windows 8 and Windows Server 2012.
 hStdError
If dwFlags specifies STARTF_USESTDHANDLES, this member is the standard error handle for the process. Otherwise, this member is ignored and the default for standard error is the console window's buffer.

我行我乐
我的博客:
http://blog.yuccn. net
2013-07-06 10:36



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-416765-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.094087 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved