[求助]:ConnectNamedPipe在Win98下面可以用嗎?

LiangWu25 2005-01-11 01:46:52
Server:===============================================
const
pipename:string='\\.\pipe\testpipe';
var
SPipeHandle:THandle;
Se:TSecurityAttributes;
WriteBuffer:DWORD;
Buffer:pchar;
begin
Se.nLength:=Sizeof(TSecurityAttributes);
Se.lpSecurityDescriptor:=nil;
Se.bInheritHandle:=True;

SPipeHandle:=CreateNamedPipe(pchar(pipename),PIPE_ACCESS_DUPLE OR FILE_FLAG_OVERLAPPED,
PIPE_TYPE_BYTE or PIPE_WAIT,2,512,512,1000,@Se);
if SPipeHandle=-1 then
raise Exception.Create('Create pipe Failed');
try
if not ConnectNamedPipe(SPipeHandle,nil) then begin
CloseHandle(SPipeHandle);
Raise Exception.Create(IntToStr(GetLastError)+'fail con');end;
Buffer:=StrAlloc(512);
Buffer:=Pchar(Memo1.Text);
WriteFile(SPipeHandle,Buffer[0],512,WriteBuffer,nil);
finally
DisConnectNamedPipe(SPipeHandle);
CloseHandle(SPipeHandle);
end;
=================================
當在Win98下執行到ConnectNamedPipe時,立即返回為False(完全沒有時間上的等待),并且
GetLastError=6(Msg:無效代碼)。在2000下無此問題。這是什么原因,是否ConnectNamedPipe在
Win98下有什么限制?
...全文
88 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
songyanbin 2005-01-11
  • 打赏
  • 举报
回复
汗 粘错页了。。。。。
songyanbin 2005-01-11
  • 打赏
  • 举报
回复
HANDLE CreateNamedPipe(
LPCTSTR lpName, // pointer to pipe name
DWORD dwOpenMode, // pipe open mode
DWORD dwPipeMode, // pipe-specific modes
DWORD nMaxInstances, // maximum number of instances
DWORD nOutBufferSize, // output buffer size, in bytes
DWORD nInBufferSize, // input buffer size, in bytes
DWORD nDefaultTimeOut, // time-out time, in milliseconds
LPSECURITY_ATTRIBUTES lpSecurityAttributes // pointer to security attributes
);




QuickInfo
Windows NT: Requires version 3.1 or later.
Windows: Unsupported.
Windows CE: Unsupported.
Header: Declared in winbase.h.
Import Library: Use kernel32.lib.
Unicode: Implemented as Unicode and ANSI versions on Windows NT.

LiangWu25 2005-01-11
  • 打赏
  • 举报
回复
up
LiangWu25 2005-01-11
  • 打赏
  • 举报
回复
能否給出兩個進程通過匿名管道通信的例子?我這里測試不能成功啊。
LiangWu25 2005-01-11
  • 打赏
  • 举报
回复
謝謝weidegong(weidegong),我先看一看你的鏈接見面。
weidegong 2005-01-11
  • 打赏
  • 举报
回复
匿名管道只能单向传送数据,而命名管道可以双向传送。管道可以以比特流形式传送任意数量的数据。命名管道还可以将数据集合到称为消息的数据块中。命名管道甚至具有通过网络连接多进程的能力。但遗憾的是Windows9X不支持创建命名管道,它只能在WindowsNT系列(如Windows NT,Windows 2000,Windows XP)的操作系统上创建。



http://dev.csdn.net/Develop/article/12/12773.shtm
LiangWu25 2005-01-11
  • 打赏
  • 举报
回复
在網上找了好久資料,都沒說ConnectNamedPipe不能夠在Win98下使用。能否給出一些鏈接?Thanks!
LiangWu25 2005-01-11
  • 打赏
  • 举报
回复
那為何CreateNamedPipe可以執行成功?
weidegong 2005-01-11
  • 打赏
  • 举报
回复
Win98根本就没有这个东西呀
LiangWu25 2005-01-11
  • 打赏
  • 举报
回复
up,在線等待!!

1,183

社区成员

发帖
与我相关
我的任务
社区描述
Delphi Windows SDK/API
社区管理员
  • Windows SDK/API社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧