亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? tut21.html

?? WINDOWS程序員使用指南--匯編基礎(chǔ)
?? HTML
?? 第 1 頁 / 共 3 頁
字號:
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
   <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
   <meta name="GENERATOR" content="Mozilla/4.51 [en] (Win95; I) [Netscape]">
   <title>Iczelion's Win32 Assembly Tutorial 21: Pipe</title>
</head>
<body text="#C0C0C0" bgcolor="#000000" link="#FFFF68" vlink="#00008B" alink="#FF0000">

<center>
<h1>
<font face="Arial"><font color="#006600">Tutorial 21: Pipe</font></font></h1></center>
<font face="Arial"><font size=-1>In this tutorial, we will explore pipe,
what it is and what we can use it for. To make it more interesting, I throw
in the technique on how to change the background and text color of an edit
control.</font></font>
<br><font face="Arial"><font size=-1>Download the example <a href="files/tut21.zip" STYLE="text-decoration:none">here</a>.</font></font>
<h3>
<font face="Arial"><font size=+0>Theory:</font></font></h3>
<font face="Arial"><font size=-1>Pipe is a communication conduit or pathway
with two ends. You can use pipe to exchange the data between two different
processes, or within the same process. It's like a walkie-talkie. You give
the other party one set and he can use it to communicate with you.</font></font>
<br><font face="Arial"><font size=-1>There are two types of pipes: anonymous
and named pipes. Anonymous pipe is, well, anonymous: that is, you can use
it without knowing its name. A named pipe is the opposite: you have to
know its name before you can use it.</font></font>
<br><font face="Arial"><font size=-1>You can also categorize pipes according
to its property: one-way or two-way. In a one-way pipe, the data can flow
only in one direction: from one end to the other. While in a two-way pipe,
the data can be exchanged between both ends.</font></font>
<br><font face="Arial"><font size=-1>An anonymous pipe is always one-way
while a named pipe can be one-way or two-way. A named pipe is usually used
in a network environment where a server can connect to several clients.</font></font>
<br><font face="Arial"><font size=-1>In this tutorial, we will examine
anonymous pipe in some detail. Anonymous pipe's main purpose is to be used
as a communcation pathway between a parent and child processes or between
child processes.</font></font>
<br><font face="Arial"><font size=-1>Anonymous pipe is really useful when
you deal with a console application. A console application is a kind of
win32 program which uses a console for its input &amp; output. A console
is like a DOS box. However, a console application is a fully 32-bit program.
It can use any GUI function, the same as other GUI programs. It just happens
to have a console for its use.</font></font>
<br><font face="Arial"><font size=-1>A console application has three handles
it can use for its input &amp; output. They are called standard handles.
There are three of them: standard input, standard output and standard error.
Standard input handle is used to read/retrieve the information from the
console and standard output handle is used to output/print the information
to the console. Standard error handle is used to report error condition
since its output cannot be redirected.</font></font>
<br><font face="Arial"><font size=-1>A console application can retrieve
those three standard handles by calling GetStdHandle function, specifying
the handle it wants to obtain. A GUI application doesn't have a console.
If you call GetStdHandle, it will return error. If you really want to use
a console, you can call AllocConsole to allocate a new console. However,
don't forget to call FreeConsole when you're done with the console.</font></font>
<br><font face="Arial"><font size=-1>Anonymous pipe is most frequently
used to redirect input and/or output of a child console application. The
parent process may be a console or a GUI application but the child must
be a console app. for this to work. As you know, a console application
uses standard handles for its input and output. If we want to redirect
the input and/or output of a console application, we can replace the handle
with a handle to one end of a pipe. A console application will not know
that it's using a handle to one end of a pipe. It'll use it as a standard
handle. This is a kind of polymorphism, in OOP jargon. This approach is
powerful since we need not modify the child process in anyway.</font></font>
<br><font face="Arial"><font size=-1>Another thing you should know about
a console application is where it gets those standard handles from. When
a console application is created, the parent process has two choices: it
can create a new console for the child or it can let the child inherit
its own console. For the second approach to work, the parent process must
be a console application or if it's a GUI application, it must call AllocConsole
first to allocate a console.</font></font>
<br><font face="Arial"><font size=-1>Let's begin the work. In order to
create an anonymous pipe you need to call <font color="#FFFF00">CreatePipe</font>.
CreatePipe has the following prototype:</font></font>
<blockquote><b><font face="Arial"><font color="#C0C0C0"><font size=-1>CreatePipe
proto pReadHandle:DWORD, \</font></font></font></b>
<br><b><font face="Arial"><font color="#C0C0C0"><font size=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
pWriteHandle:DWORD,\</font></font></font></b>
<br><b><font face="Arial"><font color="#C0C0C0"><font size=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
pPipeAttributes:DWORD,\</font></font></font></b>
<br><b><font face="Arial"><font color="#C0C0C0"><font size=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
nBufferSize:DWORD</font></font></font></b></blockquote>

<ul>
<li>
<font face="Arial"><font size=-1><font color="#FFFF00">pReadHandle</font>
is a pointer to a dword variable that will receive the handle to the read
end of the pipe</font></font></li>

<li>
<font face="Arial"><font size=-1><font color="#FFFF00">pWriteHandle</font>
is a pointer to a dword variable that will receive the handle to the write
end of the pipe.</font></font></li>

<li>
<font face="Arial"><font size=-1><font color="#FFFF00">pPipeAttributes</font>
points to a SECURITY_ATTRIBUTES structure that determines whether the returned
read &amp; write handles are inheritable by child processes</font></font></li>

<li>
<font face="Arial"><font size=-1><font color="#FFFF00">nBufferSize </font>is
the suggested size of the buffer the pipe will reserve for use. This is
a suggested size only. You can use NULL to tell the function to use the
default size.</font></font></li>
</ul>
<font face="Arial"><font size=-1>If the call is successful, the return
value is nonzero. If it failed, the return value is zero.</font></font>
<br><font face="Arial"><font size=-1>After the call is successful, you
will get two handles, one to read end of the pipe and the other to the
write end. Now I will outline the steps needed for redirecting the standard
output of a child console program to your own process.Note that my method
differs from the one in Borland's win32 api reference. The method in win32
api reference assumes the parent process is a console application and thus
the child can inherit the standard handles from it. But most of the time,
we will need to redirect output from a console application to a GUI one.</font></font>
<ol>
<li>
<font face="Arial"><font size=-1>Create an anonymous pipe with CreatePipe.
Don't forget to set the bInheritable member of SECURITY_ATTRIBUTES to TRUE
so the handles are inheritable.</font></font></li>

<li>
<font face="Arial"><font size=-1>Now we must prepare the parameters we
will pass to CreateProcess since we will use it to load the child console
application. One important structure is the STARTUPINFO structure. This
structure determines the appearance of the main window of the child process
when it first appears. This structure is vital to our purpose. You can
hide the main window and pass the pipe handle to the child console process
with it. Below is the members you must fill:</font></font></li>

<ul>
<li>
<font face="Arial"><font size=-1>cb : the size of STARTUPINFO structure</font></font></li>

<li>
<font face="Arial"><font size=-1>dwFlags : the binary bit flags that determine
which members of the structure are valid also it governs the show/hide
state of the main window. For our purpose, you should use a combination
of STARTF_USESHOWWINDOW and STARTF_USESTDHANDLES</font></font></li>

<li>
<font face="Arial"><font size=-1>hStdOutput and hStdError : the handles
you want the child process to use as standard output/error handles. For
our purpose, we will pass write handle of the pipe as the standard output
and error of the child. So when the child outputs something to the standard
output/error, it actually passes the info via the pipe to the parent process.</font></font></li>

<li>
<font face="Arial"><font size=-1>wShowWindow governs the show/hide state
of the main window. For our purpose, we don't want the console window of
the child to show so we put SW_HIDE into this member.</font></font></li>
</ul>

<li>
<font face="Arial"><font size=-1>Call CreateProcess to load the child application.
After CreateProcess is successful, the child is still dormant. It is loaded
into memory but it doesn't run immediately</font></font></li>

<li>
<font face="Arial"><font size=-1>Close the write pipe handle. This is necessary.
Because the parent process has no use for the write pipe handle, and the
pipe won't work if there are more than one write end, we MUST close it
before reading the data from the pipe. However, don't close the write handle
before calling CreateProcess, your pipe will be broken. You should close
it just after CreateProcess returns and before you read data from the read
end of the pipe.</font></font></li>

<li>
<font face="Arial"><font size=-1>Now you can read data from the read end
of the pipe with ReadFile. With ReadFile, you kick the child process into
running mode. It will start execution and when it writes something to the
standard output handle (which is actually the handle to the write end of
the pipe), the data are sent through the pipe to the read end. You can
think of ReadFile as sucking data from the read end of the pipe. You must
call ReadFile repeatedly until it returns 0 which means there are no more
data to be read. You can do anything with the data you read from the pipe.
In our example, I put them into an edit control.</font></font></li>

<li>
<font face="Arial"><font size=-1>Close the read pipe handle.</font></font></li>
</ol>

<h3>
<font face="Arial"><font size=+0>Example:</font></font></h3>

<blockquote><b><font face="Arial"><font color="#999900"><font size=-1>.386</font></font></font></b>
<br><b><font face="Arial"><font color="#999900"><font size=-1>.model flat,stdcall</font></font></font></b>
<br><b><font face="Arial"><font color="#999900"><font size=-1>option casemap:none</font></font></font></b>
<br><b><font face="Arial"><font color="#999900"><font size=-1>include \masm32\include\windows.inc</font></font></font></b>
<br><b><font face="Arial"><font color="#999900"><font size=-1>include \masm32\include\user32.inc</font></font></font></b>
<br><b><font face="Arial"><font color="#999900"><font size=-1>include \masm32\include\kernel32.inc</font></font></font></b>

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91麻豆精品国产91久久久久久久久 | aa级大片欧美| 欧美日韩久久久一区| 国产目拍亚洲精品99久久精品| 一区二区国产视频| 丁香六月综合激情| 日韩免费观看高清完整版| 一区二区三区在线看| 国产福利91精品| 精品久久久久久无| 免费成人小视频| 91精品国产综合久久精品app| 国产精品麻豆视频| 国产一区二区三区免费观看| 欧美精品一级二级| 亚洲午夜一区二区三区| 91国内精品野花午夜精品| 国产精品拍天天在线| 国产精品一区二区男女羞羞无遮挡 | 欧美午夜精品久久久久久超碰| 国产亚洲午夜高清国产拍精品| 日韩精品国产精品| 欧美肥大bbwbbw高潮| 一区二区国产视频| 欧美最猛黑人xxxxx猛交| 亚洲色图制服诱惑 | 国产高清在线精品| 精品三级av在线| 激情综合网av| 91精品欧美福利在线观看| 午夜精品影院在线观看| 欧美美女直播网站| 日本视频一区二区三区| 91精品久久久久久久91蜜桃 | 国产成人av在线影院| 国产精品黄色在线观看| 丰满少妇久久久久久久| 久久久久久电影| 成人激情文学综合网| 国产精品久久久久久户外露出| 99久久精品费精品国产一区二区| 亚洲色图色小说| 色综合色狠狠综合色| 亚洲国产视频网站| 欧美一区二区国产| 国产一级精品在线| 亚洲色图在线视频| 欧美日产国产精品| 国产又粗又猛又爽又黄91精品| 久久综合成人精品亚洲另类欧美| 国产一区二区三区在线观看免费| 国产偷国产偷亚洲高清人白洁| gogo大胆日本视频一区| 午夜不卡av免费| 久久久蜜臀国产一区二区| 91在线云播放| 美女在线观看视频一区二区| 欧美极品少妇xxxxⅹ高跟鞋| 在线观看国产一区二区| 激情丁香综合五月| 亚洲天堂2016| 欧美一区二区久久久| 国产一区二区伦理片| 亚洲素人一区二区| 日韩一区二区在线播放| 成人国产精品视频| 天天综合色天天综合色h| 久久精品亚洲国产奇米99| 欧美在线免费播放| 国产麻豆午夜三级精品| 亚洲综合激情小说| 久久久久久久av麻豆果冻| 欧美日韩综合在线免费观看| 国产乱人伦偷精品视频免下载| 一区二区三区.www| 国产欧美一区二区三区网站 | 三级久久三级久久久| 91电影在线观看| 久久精品国产精品青草| 亚洲视频中文字幕| 久久嫩草精品久久久精品一| 欧美日韩一区二区三区在线| 福利视频网站一区二区三区| 日韩国产高清在线| 亚洲色图色小说| www激情久久| 欧美精品免费视频| 97se亚洲国产综合在线| 国产成a人亚洲| 美女一区二区三区在线观看| 亚洲激情第一区| 国产精品麻豆一区二区| 久久夜色精品国产噜噜av| 欧美另类一区二区三区| 色域天天综合网| 成人久久18免费网站麻豆| 国产麻豆精品视频| 久久精品噜噜噜成人av农村| 五月婷婷综合网| 亚洲午夜激情网页| 国产精品女同一区二区三区| 国产午夜精品一区二区三区视频| 日韩一级片在线播放| 欧美高清视频www夜色资源网| 欧美午夜理伦三级在线观看| 色999日韩国产欧美一区二区| 国产高清在线精品| 国产盗摄视频一区二区三区| 国产精品一区二区x88av| 国产精品一区二区在线播放| 国产一区二区三区电影在线观看| 久久99久久久久久久久久久| 久久精品国产色蜜蜜麻豆| 日本aⅴ精品一区二区三区| 丝袜美腿一区二区三区| 午夜精品久久久久| 日韩国产一二三区| 蜜臀av一区二区在线免费观看 | 国产黄色91视频| 国产精品一二三区| 国产99久久久国产精品潘金| 国产真实乱子伦精品视频| 国产精品一二三区| 色综合久久综合网97色综合| 色婷婷av一区| 欧美日本在线一区| 日韩一区二区三区在线观看 | 精品一区二区三区在线播放| 久草在线在线精品观看| 国产一区二区三区在线观看免费| 成人久久视频在线观看| 91国产免费观看| 欧美一区二区三区四区五区| 欧美成人伊人久久综合网| 中文字幕欧美国产| 一区二区三区免费| 美国三级日本三级久久99| 国产成人精品亚洲777人妖| 色欧美片视频在线观看| 4438x成人网最大色成网站| 久久久久久久久久久电影| 亚洲美女屁股眼交| 激情综合五月婷婷| 97精品久久久午夜一区二区三区| 欧美日韩二区三区| 日本一区二区久久| 午夜欧美在线一二页| 国产乱码精品一区二区三| 欧美最新大片在线看 | 暴力调教一区二区三区| 欧美在线视频你懂得| 久久先锋影音av| 洋洋成人永久网站入口| 国内成人精品2018免费看| 色素色在线综合| 精品第一国产综合精品aⅴ| 亚洲码国产岛国毛片在线| 国内精品免费在线观看| 欧美性猛交xxxxxxxx| 国产女同互慰高潮91漫画| 天堂午夜影视日韩欧美一区二区| 看片网站欧美日韩| 色88888久久久久久影院野外| 日韩一区二区三区四区五区六区| 国产精品激情偷乱一区二区∴| 久久机这里只有精品| 91福利精品视频| 欧美激情自拍偷拍| 男人操女人的视频在线观看欧美| 99国产欧美久久久精品| 久久夜色精品一区| 日韩中文字幕麻豆| 日本韩国视频一区二区| 欧美极品少妇xxxxⅹ高跟鞋 | 日韩精品一二三区| 色拍拍在线精品视频8848| 欧美极品aⅴ影院| 国产在线乱码一区二区三区| 3d成人h动漫网站入口| 一区二区三区四区不卡在线| 成人激情免费网站| 久久影院视频免费| 久久激情综合网| 欧美精品一区二区高清在线观看| 亚洲国产欧美一区二区三区丁香婷| 成人av小说网| 国产精品久久久久久久久免费樱桃 | 国内成人免费视频| 欧美sm极限捆绑bd| 日日嗨av一区二区三区四区| 欧美日韩亚洲综合一区| 亚洲成人一二三| 亚洲成a人在线观看| 亚洲精品在线观看网站| 欧美制服丝袜第一页| 一卡二卡三卡日韩欧美| 不卡av免费在线观看| 国产精品美女久久久久久久久久久| 国产成人综合在线| 欧美国产成人精品|