主题:一个较全面的检测软件(附代码)
孙瑞
[专家分:590] 发布于 2007-07-11 17:32:00
这是我写的一个较为自动的软件,用了文件与程序互动的动态响应技术!
她可以实现对一个文件夹特定文件类型的监控
(Ps:我不知道如何通过编程直接像WinRAR一样调用文件夹选择程序,我只能使用CommanDiolog控件!)
发布完整的工程文件,并且开源是希望大家能够积极完善她!
期待大家加入的功能:
*多文件夹同时监控
*(代码优化)
*添加监测数据的保存
*添加利用程序向注册表注入启动项的功能
回复列表 (共15个回复)
11 楼
guoyong_cy [专家分:3050] 发布于 2010-05-02 23:15:00
看了你发的帖子,好像你最比较喜欢操作文件哈!
12 楼
天天学习 [专家分:4570] 发布于 2010-05-04 11:26:00
呃,我以为是用FindFirstChangeNotification、FindNextChangeNotification等API来监视文件夹变化的呢。有创意。
13 楼
天天学习 [专家分:4570] 发布于 2010-05-04 11:30:00
[quote]Ps:我不知道如何通过编程直接像WinRAR一样调用文件夹选择程序,我只能使用CommanDiolog控件![/quote]
给你一个现成的模块,可以调用打开和保存的对话框。
[code=c]
Option Explicit
Private Declare Function GetOpenFileName Lib "comdlg32.dll" Alias "GetOpenFileNameA" (pOpenfilename As OPENFILENAME) As Long
Private Declare Function GetSaveFileName Lib "comdlg32.dll" Alias "GetSaveFileNameA" (pOpenfilename As OPENFILENAME) As Long
Private Const OFN_PATHMUSTEXIST = &H800 '路径必须存在
Private Const OFN_FILEMUSTEXIST = &H1000 '文件必须存在
Private Const OFN_OVERWRITEPROMPT = &H2 '同名文件时提示
'' OPENFILENAME 结构的元素顺序必须按vb6自带的api浏览器里的格式声明。按foxApi V1.5里的声明时出错
Private Type OPENFILENAME
lStructSize As Long
hwndOwner As Long
hInstance As Long
lpstrFilter As String
lpstrCustomFilter As String
nMaxCustFilter As Long
nFilterIndex As Long
lpstrFile As String
nMaxFile As Long
lpstrFileTitle As String
nMaxFileTitle As Long
lpstrInitialDir As String
lpstrTitle As String
flags As Long
nFileOffset As Integer
nFileExtension As Integer
lpstrDefExt As String
lCustData As Long
lpfnHook As Long
lpTemplateName As String
End Type
Public Function ShowOpen(ByVal hwndOwner As Long, Optional ByVal strTitle As String = "打开...", Optional ByVal lpstrFilter As String = "All Files(*.*)" & vbNullChar & "*.*" & vbNullChar, Optional ByVal initDir As String = "c:\", Optional ByVal defExt As String = "*.JTF") As String
On Error Resume Next
Dim OFName As OPENFILENAME
OFName.lStructSize = Len(OFName)
OFName.hwndOwner = hwndOwner
OFName.lpstrFilter = lpstrFilter
OFName.lpstrFile = Space$(254)
OFName.nMaxFile = 255
OFName.lpstrFileTitle = Space$(254)
OFName.nMaxFileTitle = 255
OFName.lpstrInitialDir = initDir
OFName.lpstrTitle = strTitle
OFName.lpstrDefExt = defExt
OFName.flags = OFN_FILEMUSTEXIST Or OFN_PATHMUSTEXIST
'Debug.Print OFName.nFileExtension
If GetOpenFileName(OFName) Then
ShowOpen = Trim$(OFName.lpstrFile)
Else
ShowOpen = ""
End If
End Function
Public Function ShowSave(ByVal hwndOwner As Long, Optional ByVal strTitle As String = "保存为...", Optional ByVal lpstrFilter As String = "All Files(*.*)" & vbNullChar & "*.*" & vbNullChar, Optional ByVal initDir As String = "c:\", Optional ByVal defExt As String = "*.XMC") As String
On Error Resume Next
Dim OFName As OPENFILENAME
OFName.lStructSize = Len(OFName)
OFName.hwndOwner = hwndOwner
OFName.hInstance = App.hInstance
OFName.lpstrFilter = lpstrFilter
OFName.lpstrFile = Space$(254)
OFName.nMaxFile = 255
OFName.lpstrFileTitle = Space$(254)
OFName.nMaxFileTitle = 255
OFName.lpstrInitialDir = initDir
OFName.lpstrTitle = strTitle
OFName.flags = OFN_OVERWRITEPROMPT
OFName.lpstrDefExt = defExt
If GetSaveFileName(OFName) Then
ShowSave = Trim$(OFName.lpstrFile)
Else
ShowSave = ""
End If
End Function
[/code]
14 楼
孙瑞 [专家分:590] 发布于 2010-05-05 12:56:00
谢谢各位!谢谢!六月中旬全面恢复程序研究,现在进入高考最后阶段…
15 楼
gfan [专家分:60] 发布于 2010-05-05 15:09:00
多年项目开发经验,专业做毕业设计等中小型项目开发,熟悉各种数据库操作(sql server ,access ,mysql等),熟练应用VC, Delphi, VB, ASP, C#等开发语言.若有需要请联系QQ: 383147818 加我请注明: pfan项目
我来回复