?? mapviewoffile.htm
字號(hào):
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 3.0">
<style><!--
body,table {font-family:"宋體"; font-size: 9pt; line-height:11pt;}
a {text-decoration:none} a:hover {color:red;text-decoration:underline}
--></style>
<title>MapViewOfFile</title>
</head>
<body link="#FF0000" vlink="#FF0000" alink="#FF0000" bgcolor="#FFC8C8">
<div align="center"><center>
<table border="0" width="100%" height="22" cellspacing="0" cellpadding="0">
<tr>
<td width="100%" height="16"><a name="MapViewOfFile, MapViewOfFileEx">MapViewOfFile,
MapViewOfFileEx</a></td>
</tr>
</table>
</center></div><div align="center"><center>
<table border="1" width="100%" bordercolorlight="#808080" cellspacing="0"
bordercolordark="#FFFFFF">
<tr>
<td width="101%" colspan="3">VB聲明</td>
</tr>
<tr>
<td width="101%" colspan="3">Declare Function MapViewOfFile& Lib "kernel32"
(ByVal hFileMappingObject As Long, ByVal dwDesiredAccess As Long, ByVal dwFileOffsetHigh
As Long, ByVal dwFileOffsetLow As Long, ByVal dwNumberOfBytesToMap As Long)<br>
Declare Function MapViewOfFileEx& Lib "kernel32" (ByVal hFileMappingObject
As Long, ByVal dwDesiredAccess As Long, ByVal dwFileOffsetHigh As Long, ByVal
dwFileOffsetLow As Long, ByVal dwNumberOfBytesToMap As Long, lpBaseAddress As Any)</td>
</tr>
<tr>
<td width="101%" colspan="3">說明</td>
</tr>
<tr>
<td width="101%" colspan="3">將一個(gè)文件映射對(duì)象映射到當(dāng)前應(yīng)用程序的地址空間。MapViewOfFileEx允許我們指定一個(gè)基本地址來進(jìn)行映射</td>
</tr>
<tr>
<td width="101%" colspan="3">返回值</td>
</tr>
<tr>
<td width="101%" colspan="3">Long,文件映射在內(nèi)存中的起始地址。零表示出錯(cuò)。會(huì)設(shè)置<a
href="GetLastError.htm">GetLastError</a></td>
</tr>
<tr>
<td width="101%" colspan="3">參數(shù)表</td>
</tr>
<tr>
<td width="25%">參數(shù)</td>
<td width="76%" colspan="2">類型及說明</td>
</tr>
<tr>
<td width="25%">hFileMappingObject</td>
<td width="76%" colspan="2">Long,文件映射對(duì)象的句柄</td>
</tr>
<tr>
<td width="25%" rowspan="5">dwDesiredAccess</td>
<td width="76%" colspan="2">Long,下述常數(shù)之一:</td>
</tr>
<tr>
<td width="37%">FILE_MAP_WRITE</td>
<td width="38%">映射可讀可寫。文件映射對(duì)象必須通過PAGE_READWRITE訪問創(chuàng)建</td>
</tr>
<tr>
<td width="37%">FILE_MAP_READ</td>
<td width="38%">映射只讀。文件映射對(duì)象必須通過PAGE_READ 或 PAGE_READWRITE訪問創(chuàng)建</td>
</tr>
<tr>
<td width="37%">FILE_MAP_ALL_ACCESS</td>
<td width="38%">與FILE_MAP_WRITE相同</td>
</tr>
<tr>
<td width="37%">FILE_MAP_COPY</td>
<td width="38%">映射時(shí)保留寫操作的副本。文件映射對(duì)象必須用PAGE_WRITECOPY訪問在win95下創(chuàng)建</td>
</tr>
<tr>
<td width="25%">dwFileOffsetHigh</td>
<td width="76%" colspan="2">Long,文件中映射起點(diǎn)的高32位地址</td>
</tr>
<tr>
<td width="25%">dwFileOffsetLow</td>
<td width="76%" colspan="2">Long,文件中映射起點(diǎn)的低32位地址</td>
</tr>
<tr>
<td width="25%">dwNumberOfBytesToMap</td>
<td width="76%" colspan="2">Long,文件中要映射的字節(jié)數(shù)。用零映射整個(gè)文件映射對(duì)象</td>
</tr>
<tr>
<td width="25%">lpBaseAddress</td>
<td width="76%" colspan="2">Long,指定映射文件映射對(duì)象的地址。如這個(gè)地址處沒有足夠的內(nèi)存空間,那么對(duì)MapViewOfFileEx的調(diào)用會(huì)失效。零表示允許windows尋找一個(gè)地址</td>
</tr>
<tr>
<td width="101%" colspan="3">注解</td>
</tr>
<tr>
<td width="101%" colspan="3"><p align="left">dwFileOffsetLow和dwFileOffsetHigh必須反映一個(gè)偏移距離,它由系統(tǒng)的內(nèi)存分配精度決定。例如,假設(shè)系統(tǒng)的內(nèi)存精度是64KB(即最小分配單位是64KB),則這些值必須是64KB的整數(shù)倍。大多數(shù)應(yīng)用程序都簡(jiǎn)單的用零從文件的起始處開始映射。lpBaseAddress也必須是內(nèi)存分配精度的整數(shù)倍</td>
</tr>
<tr>
<td width="101%" colspan="3">其他</td>
</tr>
<tr>
<td width="101%" colspan="3">聲明中的參數(shù)類型為Any,而參數(shù)表中都是Long,我也不明白。但關(guān)于這個(gè)函數(shù)的英文資料的確是這樣的。</td>
</tr>
</table>
</center></div><div align="center"><center>
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td width="100%"><p align="right"><a href="#MapViewOfFile, MapViewOfFileEx">Top</a></td>
</tr>
</table>
</center></div>
</body>
</html>
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -