新网创想网站建设,新征程启航
为企业提供网站建设、域名注册、服务器等服务
Microsoft.VisualBasic.FileSystem.Rename(原文件夹完整路径名称,新的文件夹名称)
创新互联公司公司2013年成立,先为息县等服务建站,息县等地企业,进行企业商务咨询服务。为息县企业网站制作PC+手机+微官网三网同步一站式服务解决您的所有建站问题。
Microsoft.VisualBasic.FileSystem.Rename("D:\1", "D:\2\1")‘当路径不对时会把原文件夹剪切到“D:\2\”下面文件夹名称不变
Microsoft.VisualBasic.FileSystem.Rename("D:\1", "D:\2\2")")‘当路径不对时会把原文件夹剪切到“D:\2\”下面文件夹名称 更改为 2
Microsoft.VisualBasic.FileSystem.Rename("D:\1", "D:\2")’当路径相同时只改文件夹名称 不移动文件
复杂的不会,来点儿简单的,借用在listbox里按下鼠标时再移动,会高亮显示选择行,并且会随鼠标移动而变化的这一特点改进的,不足之处是在listbox里,此时处于鼠标左键在按下状态。
Declare Sub mouse_event Lib "user32" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)
Public Const MOUSEEVENTF_LEFTDOWN = H2 '模拟鼠标左键按下
Private Sub ListBox1_MouseMove(sender As Object, e As MouseEventArgs) Handles ListBox1.MouseMove
mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0)
End Sub
调用api
在Visual Baisc点虐 中的声明:
Declare Sub mouse_event Lib "user32" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)
Public Const MOUSEEVENTF_LEFTDOWN = H2 '模拟鼠标左键按下
Public Const MOUSEEVENTF_LEFTUP = H4 ’模拟鼠标左键释放
Public Const MOUSEEVENTF_MIDDLEDOWN = H20 '模拟鼠标中间键按下
Public Const MOUSEEVENTF_MIDDLEUP = H40 '模拟鼠标中间键释放
Public Const MOUSEEVENTF_RIGHTDOWN = H8 '模拟鼠标右键按下
Public Const MOUSEEVENTF_RIGHTUP = H10 '模拟鼠标右键释放
Public Const MOUSEEVENTF_MOVE = H1 '模拟鼠标指针移动
例:
mouse_event MOUSEEVENTF_LEFTDOWN,10,10,0,0
'在(10,10)模拟鼠标左键按下