Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

(VB)FTPÒì²½ÏÂÔØ

 ¸Ã·½·¨²»ÐèҪʹÓÃAPI¼°µÚÈý·½¿Ø¼þ
ÕâÀïʹÓõÄÊÇVBµÄUserControl¿Ø¼þµÄAsyncRead·½·¨
²½ÖèÈçÏÂ:
1¡¢Ìí¼ÓÒ»¸öÓû§¿Ø¼þ£¬ÉèÖÃInvisibleAtRuntimeÊôÐÔΪtrue£¬Ä¿µÄÊÇÔËÐÐʱ¸Ã¿Ø¼þ²»ÏÔʾÓû§½çÃæ£¬¾ÍÏóTimer¿Ø¼þÒ»Ñù¡£
2¡¢µ½×Ô¶¨Òå¿Ø¼þµÄ´úÂë´°¿Ú£¬Ìí¼ÓÈçÏ´úÂë
Option Explicit
'ÏÂÔØ½á¹ûö¾Ù
Public Enum DownloadResults
eSUCCESS = 0 'ÏÂÔØ³É¹¦
eCONNECTERROR = 1 'Á¬½Ó´íÎó
eTRANSFERERROR = 2 'Êý¾Ý´«Êä´íÎó
eWRITEERROR = 3 '±£´æ±¾µØ´íÎó
eUserStop = 4 'ÖÐÖ¹
End Enum
'ÏÂÔØ½ø¶Èʼþ Identifier-ÏÂÔØ±êʶ,RecvdBytes-ÒÑÏÂÔØ×Ö½ÚÊý,MaxBytes-×Ü×Ö½ÚÊý,PassTimer-ÒÑÓÃÏÂÔØÊ±¼ä(Ãë)
Public Event DownloadProgress(Identifier As String, RecvdBytes As Long, MaxBytes As Long, PassTimer As Long)
'ÏÂÔØÍê³Éʼþ Identifier-ÏÂÔØ±êʶ,ccDownloadResults-ÏÂÔØ½á¹û,PassTimer-ÒÑÓÃÏÂÔØÊ±¼ä(Ãë)
Public Event DownloadComplete(Identifier As String, Result As DownloadResults, PassTimer As Long)
Dim FstrURL As String 'FTP ÏÂÔØ×Ö·û´®,º¬IP,¶Ë¿ÚºÅ,Óû§Ãû,ÃÜÂë,ÏÂÔØµÄÎļþ¼°Æä·¾¶
Dim FstrSaveFile As String 'ÏÂÔØµÄÎļþ±£´æÔÚ±¾µØµÄÎļþÃû¼°Æä·¾¶
Dim FstrIdentifier As String 'ÏÂÔØ±êʶ
Dim FlngStart As Long '¿ªÊ¼ÏÂÔØÊ±¼ä
'ÏÂÔØÎļþ
'strURL FTP ÏÂÔØ×Ö·û´®,º¬IP,¶Ë¿ÚºÅ,Óû§Ãû,ÃÜÂë,ÏÂÔØµÄÎļþ¼°Æä·¾¶
' ÐÎÈç ftp://Óû§Ãû:ÃÜÂë@FTPµØÖ·/Ŀ¼/Îļþ
'strSaveFile ±£´æÊ±µÄ±¾µØÎļþÃû
'strIdentifier ÏÂÔØ±êʶ,¿ÉÒÔͬʱÏÂÔØ¶à¸öÎļþ,ÒÀ¾Ý´Ë×Ö·û´®Çø±ðËùÏÂÔØµÄÎļþ
Public Sub DownLoad(ByVal strURL As String, ByVal strSaveFile As String, ByVal strIdentifier As String)
On Error GoTo ERRHAND
FstrURL = strURL
FstrSaveFile = strSaveFile
FstrIdentifier = strIdentifier

FlngStart = Timer

UserControl.AsyncRead strURL, vbAsyncTypeByteArray, strIdentifier, vbAsyncReadForceUpdate

Exit Sub
ERRHAND:
RaiseEvent DownloadComplete(strIdentifier, eCONNECTERROR, Timer - FlngStart)
End Sub
Private Sub UserControl_AsyncReadComplete(AsyncProp As AsyncProperty)
On Error GoTo Errs


Ïà¹ØÎĵµ£º

ASP.NetÖÐʹÓÃVB.Netµ÷Óô洢¹ý³Ì²¢µÃµ½·µ»ØÖµ


ASP.NetÖÐʹÓÃVB.Netµ÷Óô洢¹ý³Ì²¢µÃµ½·µ»ØÖµ
À´Ô´£ºqqreadÂÛ̳ ×÷Õߣº ³ö´¦£ºÇÉÇɶÁÊé 2006-08-03 ½øÈëÌÖÂÛ×é
//´æ´¢¹ý³Ì´úÂë
¡¡CREATE PROCEDURE [AddNewInvoiceInfo] (@sUserID int,@sClaimMethod varchar(50),@sInvoiceNum ¡¡varchar(50),@sInvoiceDate datetime,@sBuyCity varchar(50))AS
¡¡Insert Into SMB_In ......

VB.NETѹËõACCESSÊý¾Ý¿â

'´´½¨Êý¾Ý¿â
  Private Sub Create(ByVal mdbPath As String)
        If File.Exists(mdbPath) Then
            Throw New Exception("Ä¿±êÊý¾Ý¿âÒѾ­´æÔÚ£¬ÎÞ·¨´´½¨")
        ......

vbʹÓÃopen·½·¨¶ÁдÎļþ

 
vbʹÓÃopen·½·¨¶ÁдÎļþ
£¨Ò»£©´ò¿ªºÍ¹Ø±ÕÎļþ
¡¡¡¡1¡¢Ë³ÐòÎļþ
¡¡¡¡´ò¿ªË³ÐòÎļþ£¬ÎÒÃÇ¿ÉÒÔʹÓÃOpenÓï¾ä¡£ËüµÄ¸ñʽÈçÏ£º

Open pathname For [Input |Output |Append] As [#]filenumber [Len = buffersize]
¡¡¡¡ËµÃ÷£º
¡¡¡¡£¨1£©²ÎÊýpathname ±íʾҪ´ò¿ªµÄÎļþÃû£¬ÎļþÃû¿ÉÒÔ°üº¬ÓÐÇý¶¯Æ÷ºÍÄ¿ ......

VB È¡µØÖ·º¯Êý´óÈ«

Public Declare Function VarPtrArray Lib "msvbvm60.dll" Alias "VarPtr" (Var() As Any) As Long
Public Declare Function VarPtrStringArray Lib "msvbvm60.dll" Alias "VarPtr" (Var() As Any) As Long
È¡¶ÔÏóµØÖ·: ObjPtr
È¡OLE¶ÔÏóµÄµØÖ·: OLE_NAME.LpOleObject
È¡º¯ÊýµØÖ·: AddressOf
È¡×Ö·û´®µØÖ·: StrPtr
È¡ ......

VBÈ¡µÃÏ߳̾ä±ú

 Private Declare Function OpenThread Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwThreadId As Long) As Long
Private Const THREAD_ALL_ACCESS = &H1F03FF
 OpenThread(THREAD_ALL_ACCESS, 1, Ïß³ÌID)    'ÓÉÏß³ÌIDÈ¡µÃÏ߳̾ä±ú,·µ»ØÏß³Ì¾ä± ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ