公告:

毕业五年,一切如走马观灯、过眼烟云,如梦境般似真亦幻,当年的豪言壮语已随风飘逝,本我、自我、超我不断碰撞,最后只剩下一具缺乏灵魂的僧侣,一生被定格在那个片段,固定的作息、固定的生活、固定的朋友,不知千年的轮回,是否只为这一生孤寂的宿命。

分类: 编程预览模式: 普通 | 列表

调用示例:

Private Sub Form_Load()
    Dim F As FTP
    Set F = New FTP

    Call F.连接服务器("127.0.0.1", 21, "admin", "admin888")

    Call F.下载文件("/wwwroot/index.php", "c:\test.php")
End Sub

查看更多...

分类:编程 | 固定链接 | 评论: 0 | 引用: 0 | 查看次数: 30218

模拟桌面刷新代码

Private Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long


Private Declare Function FindWindowEx Lib "user32" _
    Alias "FindWindowExA" (ByVal hWnd1 As Long, _
    ByVal hWnd2 As Long, ByVal lpsz1 As String, _
    ByVal lpsz2 As String) As Long
    Const WM_KEYDOWN = &H100

Public Sub RefreshDesktop()
    Dim DeskWin As Long
    DeskWin = FindWindowEx(0&, 0&, "Progman", vbNullString)
    DeskWin = FindWindowEx(DeskWin, 0&, "SHELLDLL_DefView", vbNullString)
    DeskWin = FindWindowEx(DeskWin, 0&, "SysListView32", vbNullString)
    PostMessage DeskWin, WM_KEYDOWN, &H74, &H3F0001
End Sub

Tags: 桌面 刷新

分类:编程 | 固定链接 | 评论: 27 | 引用: 0 | 查看次数: 15498

VB6实现隐藏进程的模块

'该模块用于在任务管理器中隐藏进程
Private Const STATUS_INFO_LENGTH_MISMATCH = &HC0000004
Private Const STATUS_ACCESS_DENIED = &HC0000022
Private Const STATUS_INVALID_HANDLE = &HC0000008
Private Const ERROR_SUCCESS = 0&
Private Const SECTION_MAP_WRITE = &H2
Private Const SECTION_MAP_READ = &H4
Private Const READ_CONTROL = &H20000
Private Const WRITE_DAC = &H40000
Private Const NO_INHERITANCE = 0
Private Const DACL_SECURITY_INFORMATION = &H4

Private Type IO_STATUS_BLOCK
Status As Long
Information As Long
End Type

Private Type UNICODE_STRING
Length As Integer
MaximumLength As Integer
Buffer As Long
End Type

Private Const OBJ_INHERIT = &H2
Private Const OBJ_PERMANENT = &H10
Private Const OBJ_EXCLUSIVE = &H20
Private Const OBJ_CASE_INSENSITIVE = &H40
Private Const OBJ_OPENIF = &H80
Private Const OBJ_OPENLINK = &H100
Private Const OBJ_KERNEL_HANDLE = &H200
Private Const OBJ_VALID_ATTRIBUTES = &H3F2

Private Type OBJECT_ATTRIBUTES
Length As Long
RootDirectory As Long
ObjectName As Long
Attributes As Long
SecurityDeor As Long
SecurityQualityOfService As Long
End Type

Private Type ACL
AclRevision As Byte
Sbz1 As Byte
AclSize As Integer
AceCount As Integer
Sbz2 As Integer
End Type

查看更多...

Tags: 隐藏 进程

分类:编程 | 固定链接 | 评论: 7 | 引用: 0 | 查看次数: 5902

打开摄像头程序并保存jpg文件

Private Declare Function SendMessage Lib "USER32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Declare Function capCreateCaptureWindow Lib "avicap32.dll" Alias "capCreateCaptureWindowA" (ByVal lpszWindowName As String, ByVal dwStyle As Long, ByVal X As Long, ByVal Y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hwndParent As Long, ByVal nID As Long) As Long
Private Const GET_FRAME As Long = 1084
Private Const COPY As Long = 1054
Private Const CONNECT As Long = 1034
Private Const DISCONNECT As Long = 1035
Private CapHwnd As Long

Private Sub Command1_Click()
   '打开摄像头
   Dim xMax As Integer, xMon As Integer
   CapHwnd = capCreateCaptureWindow("WebcamCapture", 0, 0, 0, 640, 480, Me.hwnd, 0)
   DoEvents
   SendMessage CapHwnd, CONNECT, 0, 0
   Timer1.Enabled = True
End Sub

Private Sub Command2_Click()
   '停止摄像头
   DoEvents
   SendMessage CapHwnd, DISCONNECT, 0, 0
   Timer1.Enabled = False
End Sub

查看更多...

Tags: 摄像头

分类:编程 | 固定链接 | 评论: 197 | 引用: 0 | 查看次数: 26858

vb 通过进程pid获取进程路径

Option Explicit
Private Declare Function OpenProcess Lib "kernel32.dll" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessID As Long) As Long
Private Declare Function GetModuleFileNameExA Lib "psapi.dll" (ByVal hProcess As Long, ByVal hModule As Long, ByVal ModuleName As String, ByVal nSize As Long) As Long
Private Declare Function CloseHandle Lib "kernel32.dll" (ByVal hObject As Long) As Long
Private Declare Function EnumProcessModules Lib "psapi.dll" (ByVal hProcess As Long, ByRef lphModule As Long, ByVal cb As Long, ByRef cbNeeded As Long) As Long

Private Function GetProcessNameByProcessId(ByVal Pid As Long) As String
     Dim szBuf(1 To 250) As Long
     Dim Ret As Long
     Dim szPathName As String
     Dim nSize As Long
     Dim hProcess As Long
     hProcess = OpenProcess(&H400 or &H10, 0, Pid)
     If hProcess <> 0 Then
        Ret = EnumProcessModules(hProcess, szBuf(1), 250, Pid)
        If Ret <> 0 Then
            szPathName = Space(260)
            nSize = 500
            Ret = GetModuleFileNameExA(hProcess, szBuf(1), szPathName, nSize)
            GetProcessNameByProcessId = szPathName
        End If
     End If
     Ret = CloseHandle(hProcess)
End Function
调用GetProcessNameByProcessId (进程pid即可)
修改下可以取得进程名
Private Sub Command1_Click()
Dim SplitStr() As String
SplitStr = Split(GetProcessNameByProcessId(pid), "\")
MsgBox SplitStr(UBound(SplitStr))
End Sub

Tags: pid 进程

分类:编程 | 固定链接 | 评论: 3 | 引用: 0 | 查看次数: 6403

删除任意文件的指定行

用法:
DeleteLineFromFile App.Path & "/test.txt", 3

函数:
Public Sub DeleteLineFromFile(RFile As String, RLine As Integer)
Dim FileNum As Integer
Dim TextLine As String
Dim NewText As String
Dim CurentLine As Integer
FileNum = FreeFile
Open RFile For Input As #FileNum
Do Until EOF(FileNum)
Line Input #FileNum, TextLine
currentline = currentline + 1
If Not currentline = RLine Then
If currentline = 1 Then
NewText = TextLine
Else
NewText = NewText & vbNewLine & TextLine
End If
End If
Loop
Close #FileNum
Open RFile For Output As #FileNum
Print #FileNum, NewText
Close #FileNum
End Sub

Tags: 删除

分类:编程 | 固定链接 | 评论: 0 | 引用: 0 | 查看次数: 3608

简单实现繁体简体互转的办法

Private Declare Function LCMapString Lib “kernel32″ Alias “LCMapStringA” (ByVal Locale As Long, ByVal dwMapFlags As Long, ByVal lpSrcStr As String, ByVal cchSrc As Long, ByVal lpDestStr As String, ByVal cchDest As Long) As Long
Private Declare Function lstrlen Lib “kernel32″ Alias “lstrlenA” (ByVal lpString As String) As Long

 ‘简转繁
Public Function JToF(ByVal Str As String) As String
Dim STlen As Long
Dim STf As String
STlen = lstrlen(Str)
STf = Space(STlen)
LCMapString &H804, &H4000000, Str, STlen, STf, STlen
JToF = STf
End Function

‘繁转简
Public Function FToJ(ByVal Str As String) As String
Dim STlen As Long
Dim STj As String
STlen = lstrlen(Str)
STj = Space(STlen)
LCMapString &H804, &H2000000, Str, STlen, STj, STlen
FToJ = STj
End Function

Tags: 文字转换

分类:编程代码 | 固定链接 | 评论: 0 | 引用: 0 | 查看次数: 2920

窗口处理技巧大全

Vb提供了API函数SetWindowLong和GetWindowLong,可以让我们很容易取得对窗口的操作;通过对窗口属性的操作,可以更改窗口的显示风格。有些看来是正常情况下无法实现的窗口,现在你可以很容易的实现。只要你想到,更多希奇古怪的你也能做到。快试试下面的例子吧。 ‘一下例子中可能用到的API声明和常量、变量声明
Private Declare Function GetWindowLong Lib “user32″ Alias “GetWindowLongA” (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib “user32″ Alias “SetWindowLongA” (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
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
Private Const SWP_NOSIZE = &H1
Private Const SWP_NOZORDER = &H4
Private Const SWP_NOMOVE = &H2
Private Const SWP_DRAWFRAME = &H20
Private Const GWL_STYLE = (-16)
Private Const WS_THICKFRAME = &H40000
Private Const WS_DLGFRAME = &H400000
Private Const WS_POPUP = &H80000000
Private Const WS_CAPTION = &HC00000
Private Const WS_SYSMENU = &H80000
Private Const WS_MINIMIZEBOX = &H20000
Private Const WS_MAXIMIZEBOX = &H10000
Private Const WS_MINIMIZE = &H20000000
Private Const WS_MAXIMIZE = &H1000000

查看更多...

Tags: 控件 界面

分类:编程 | 固定链接 | 评论: 1 | 引用: 0 | 查看次数: 2698