Advertisement
ASP_Volume3 Files/ File Controls/ Input/ Output #45461

CopyFileAny

This code allows you to copy any file, including your application to another destination at runtime. Note: This code has only been tested on Windows 98 using Visual Basic 6.0

AI

สรุปโดย AI: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

ซอร์สโค้ด
original-source
Public Function CopyFileAny(currentFilename As String, newFilename As String)
Dim a%, buffer%, temp$, fRead&, fSize&, b%
On Error GoTo ErrHan:
a = FreeFile
buffer = 4048
 Open currentFilename For Binary Access Read As a
 b = FreeFile
 Open newFilename For Binary Access Write As b
 fSize = FileLen(currentFilename)
 
 While fRead < fSize
 DoEvents
 If buffer > (fSize - fRead) Then buffer = (fSize - fRead)
 temp = Space(buffer)
 Get a, , temp
 Put b, , temp
 fRead = fRead + buffer
 Wend
 Close b
 Close a
CopyFileAny=1
Exit Function
ErrHan:
CopyFileAny=0
End Function
<HTML>
<SCRIPT>
<!--
// Hide tags with id="noprint" 
//when printing
function printSetup()
{
var a = document.all.item("noprint");
if (a!=null) {
 if (a.length!=null) {
 //multiple tags found
 for (i=0; i< a.length; i++) {
 a(i).style.display = window.event.type == "beforeprint" ? "none" :"inline";
 }
 } else 
 //only one tag
 a.style.display = window.event.type == "beforeprint" ? "none" :"inline";
}
} 
//-->
</SCRIPT>
<body onbeforeprint="printSetup()" onafterprint="printSetup()">
<p>You can see me and print me <br>
 <!-- set the tag id to "noprint" for elements you want displayed, but not printed -->
 <h2 id="noprint">You can see me, but not print</h2>
 <SPAN id="noprint">
 <br><hr>Works with SPAN and other tags
 </SPAN>
</BODY>
ความคิดเห็นดั้งเดิม (3)
กู้คืนจาก Wayback Machine