比方说,运行程序后,监视内存或硬盘运行了什么程序或打开了什么数据文件。

解决方案 »

  1.   

    Option ExplicitPrivate Declare Function GetDesktopWindow Lib "user32" () As LongPrivate Declare Function GetWindow Lib "user32" (ByVal hwnd As Long, ByVal wCmd As Long) As LongPrivate Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, _
        ByVal lpString As String, ByVal cch 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 LongPrivate Const SWP_NOMOVE = &H2
    Private Const SWP_NOSIZE = &H1
    Private Const HWND_TOPMOST = -1
    Private Const GW_CHILD = 5
    Private Const GW_HWNDNEXT = 2Private Sub Form_Load()
      SetWindowPos Me.hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE
      
      Dim lngDeskTopHandle As Long
      Dim lngHand As Long
      Dim strName As String * 255
      Dim lngWindowCount As Long  lngDeskTopHandle = GetDesktopWindow()
      lngHand = GetWindow(lngDeskTopHandle, GW_CHILD)
      lngWindowCount = 1
      Do While lngHand <> 0
         GetWindowText lngHand, strName, Len(strName)
         lngHand = GetWindow(lngHand, GW_HWNDNEXT)
         If Left$(strName, 1) <> vbNullChar Then
            Me.list1.AddItem Left$(strName, InStr(1, strName, vbNullChar))
            lngWindowCount = lngWindowCount + 1
         End If
      Loop
    End Sub
      

  2.   

    以上是系统正在运行的程序,显示在listbox中
      

  3.   

    从explorer来看应该有办法,不过不会很敏感
      

  4.   

    //我想要另外一种,比方我的程序在监视,一但有其他程序启动,访问了硬盘某个盘下面的数据文件,我的程序马上跳出来阻止。有这样功能的代码吗?建议看看这个http://network.ccidnet.com/pub/article/c241_a81772_p1.html
    用VB6没什么希望
      

  5.   

    有没有什么用C写的DLL可以调用的,
    或者我的程序运行后要监视按键操作,我又不想用timer(),因为会影响效率,还有其他的更底层的东西吗?比方说:在WINDOWS里哪个地方注册一下,WINDOWS在传送按键码时,也自动给我的程序通知。或有人在读硬盘时,WINDOWS自动告诉我的程序啊?