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

VB¸´ÖÆÎļþ¼ÐµÄ·½·¨(·ÇFSO)

http://www.webuc.net/ddf3/archive/2005/08/25/6142.aspx
²»ÓÃFSOµÄ¸´ÖÆÎļþ¼ÐµÃ·½·¨£¿
ÓÃAPIº¯Êý SHFileOperation
ÒÔÏÂÊÇʹÓÃSHFileOperationɾ³ý¸´ÖÆÒƶ¯ÎļþµÄÀý×Ó£¬¿ÉÒÔ¸´ÖÆÎļþ¼Ð
Private Type SHFILEOPSTRUCT
¡¡¡¡hwnd As Long
¡¡¡¡wFunc As Long
¡¡¡¡pfrom As String
¡¡¡¡pTo As String
¡¡¡¡fFlags As Integer
¡¡¡¡fAnyOperationsAborted As Long
¡¡¡¡hNameMappings As Long
¡¡¡¡lpszProgressTitle As String 'Ö»ÓÐÔÚ FOF_SIMPLEPROGRESS ʱÓÃ
End Type
Private Declare Function SHFileOperation Lib _
"shell32.dll" Alias "SHFileOperationA" (lpFileOp _
As SHFILEOPSTRUCT) As Long
'wFunc ³£Êý
'FO_COPY¡¡ °Ñ pfrom Îļþ¿½±´µ½ pTo¡£
Const FO_COPY = &H2
'FO_DELETE ɾ³ý pfrom ÖеÄÎļþ£¨pTo ºöÂÔ£©¡£
Const FO_DELETE = &H3
'FO_MOVE¡¡ °Ñ pfrom ÎļþÒƶ¯µ½ pTo¡£
Const FO_MOVE = &H1
'fFlag ³£Êý
'FOF_ALLOWUNDO ÔÊÐí Undo ¡£
Const FOF_ALLOWUNDO = &H40
'FOF_NOCONFIRMATION ²»ÏÔʾϵͳȷÈ϶Ի°¿ò¡£
Const FOF_NOCONFIRMATION = &H10
'FOF_NOCONFIRMMKDIR ²»ÌáʾÊÇ·ñн¨Ä¿Â¼¡£
Const FOF_NOCONFIRMMKDIR = &H200
'FOF_SILENT ²»ÏÔʾ½ø¶È¶Ô»°¿ò
Const FOF_SILENT = &H4
'Àý×Ó£º
Dim SHFileOp As SHFILEOPSTRUCT
' ɾ³ý
SHFileOp.wFunc = FO_DELETE
SHFileOp.pfrom = "c:\config.old" + Chr(0)
SHFileOp.fFlags = FOF_ALLOWUNDO + FOF_NOCONFIRMATION
Call SHFileOperation(SHFileOp)
' ɾ³ý¶à¸öÎļþ
SHFileOp.wFunc = FO_DELETE
SHFileOp.pfrom = "c:\config.old" +Chr(0) + "c:\autoexec.old"+Chr(0)
SHFileOp.fFlags = FOF_ALLOWUNDO
Call SHFileOperation(SHFileOp)
' ¿½±´
SHFileOp.wFunc = FO_COPY
SHFileOp.pfrom = "c:\t"
SHFileOp.pTo = "d:\"
SHFileOp.fFlags = FOF_ALLOWUNDO + FOF_NOCONFIRMMKDIR
Call SHFileOperation(SHFileOp)
' Òƶ¯
SHFileOp.wFunc = FO_MOVE
SHFileOp.pfrom = "c:\config.old" + Chr(0)
SHFileOp.pTo = "d:\t"
SHFileOp.fFlags = FOF_ALLOWUNDO + FOF_NOCONFIRMATION
Call SHFileOperation(SHFileOp)
»òÕß
shell "cmd.exe /c xcopy "+chr(34)+"C:\н¨Îļþ¼Ð c:\aa /q /e" +chr(34)


Ïà¹ØÎĵµ£º

VB»ñÈ¡Íø¿¨MACµØÖ·´úÂë

Option Explicit
Private Const NCBASTAT = &H33
Private Const NCBNAMSZ = 16
Private Const HEAP_ZERO_MEMORY = &H8
Private Const HEAP_GENERATE_EXCEPTIONS = &H4
Private Const NCBRESET = &H32
Private Type NCB
ncb_command As Byte
ncb_retcode As Byte
ncb_lsn As Byte
ncb_num As Byte ......

vb ´®¿ÚͨѶ

MSComm¿Ø¼þÌṩÁËÁ½ÖÖ´¦ÀíͨÐŵķ½Ê½£ºÒ»ÖÖΪʼþÇý¶¯·½Ê½£¬¸Ã·½Ê½Ï൱ÓÚÒ»°ã³ÌÐòÉè¼ÆÖеÄÖжϷ½Ê½¡£µ±´®¿Ú·¢Éúʼþ»ò´íÎóʱ£¬MSComm¿Ø¼þ»á²úÉúOnCommʼþ£¬Óû§³ÌÐò¿ÉÒÔ²¶»ñ¸Ãʼþ½øÐÐÏàÓ¦´¦Àí¡£±¾ÎĵÄÁ½¸öÀý×Ó¾ù²ÉÓø÷½Ê½¡£ÁíÒ»ÖÖΪ²éѯ·½Ê½£¬ÔÚÓû§³ÌÐòÖÐÉè¼Æ¶¨Ê±»ò²»¶¨Ê±²éѯ MSComm¿Ø¼þµÄijЩÊôÐÔÊÇ·ñ·¢Éú±ä»¯£¬´Ó¶øÈ ......

ÈçºÎÈÃÒ»¸öVB´°¿Ú×ÜÊÇ´¦ÓÚ¸÷´°¿ÚµÄ×îÉϲã

´úÂëÈçÏÂ:
Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As
Long, ByVal hWndInsertAfter As Long,& _ 
       ¡¡ ByVal X As Long, ByVal Y As
Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long & _
 &n ......

vb³ÌÐòÖÐwebbrowser ½ÓÊÜSendMessage µÄÏûÏ¢

webbrowser ²»ÄÜÊÕµ½SendMessageµÄÏûÏ¢
Ö÷ÒªÊÇÒòΪ1webbrowser µÄ¾ä±úÕÒ²»µ½¡£¾­¹ýŬÁ¦ËÑË÷£¬ÖÕÓÚ½â¾öÁË¡£×ö¸ö¼Ç¼.
Private Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Private Declare Function ......

VB ʵÏÖ¹ú¼Ê»¯

1. ÀûÓÃ×ÊÔ´Îļþ±£´æ¹ú¼Ê»¯Áбí
2.“Íâ½Ó³ÌÐò”--“Íâ½Ó³ÌÐò¹ÜÀíÆ÷”--“VB6 ×ÊÔ´±à¼­Æ÷”¾Í¿ÉÒԱ༭×ÊÔ´Îļþ
3.²¿·Ö´úÂë
  '´°Ìå¼ÓÔØ
Private Sub Form_Load()
Dim LocaleID As Long
  LocaleID = GetSystemDefaultLCID
  Select Case LocaleID
   'Ó¢ÎÄ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ