Results 1 to 3 of 3

Thread: How to prevent file save

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2001
    Location
    Alabama Gulf Coast
    Posts
    3

    Question

    Hi all,

    Thanks for any help anyone can offer. I have already searched PSC and found nothing. Also posted to the "ask an expert" forum with no replies (yet).

    I want to know if it is possible, with VB or Registry hack to prevent a user from saving a file of a given type. For example, my client wants to keep kids from d/l ing porno and would like to prevent jpegs from being saved.

    Thank you

    Ross Jaburg

  2. #2
    Guest
    Hrmmm..just a suggestion: Netnanny?
    It'll prevent the kids from even accessing any of those web sites. Unless...the husband is doing it for himself to prevent himself from going to those web sites. You know, the WIFE can get pretty jealous of those web sites.


    Or you can use this code to monitor directories.


    Code:
    'Author: Aaron Young (with a few add things from Jop)
    'Origin: Vb-World.net forums
    'Purpose: Monitor a Directory
    'Version: VB5+ 
    
    
    You can use the FindFirstChangeNotification() and
    FindNextChangeNotification() API's to monitor a directory 
    for file changes including creation of new files, i.e. 
    
    
    Private Declare Function WaitForSingleObject _
    Lib "kernel32" (ByVal hHandle As Long, ByVal _
    dwMilliseconds As Long) As Long
    
    Private Declare Function FindFirstChangeNotification _
    Lib "kernel32" Alias "FindFirstChangeNotificationA" _
    (ByVal lpPathName As String, ByVal bWatchSubtree As _
    Long, ByVal dwNotifyFilter As Long) As Long
    
    Private Declare Function FindNextChangeNotification _
    Lib "kernel32" (ByVal hChangeHandle As Long) As Long
    
    Private Const FILE_NOTIFY_CHANGE_FILE_NAME = &H1
    Private Const FILE_NOTIFY_CHANGE_LAST_WRITE As Long = &H10
    Private Const FILE_NOTIFY_CHANGE_CREATION As Long = &H40
    
    Private Sub WaitForFileActivity(ByVal sDirectory As String)
        Dim lHandle As Long
        Dim lReturn As Long
        
        lHandle = FindFirstChangeNotification(sDirectory, 0&, FILE_NOTIFY_CHANGE_LAST_WRITE) 'if something's written to a file
        'or FindFirstChangeNotification(sDirectory, 0&, FILE_NOTIFY_CHANGE_CREATION ) 'if a file is being created
        'or FindFirstChangeNotification(sDirectory, 0&, FILE_NOTIFY_CHANGE_FILE_NAME)
        Do
            lReturn = WaitForSingleObject(lHandle, 1)
            Call FindNextChangeNotification(lHandle)
            DoEvents
        Loop While lReturn <> 0
    End Sub
    
    
    Private Sub Command1_Click()
        WaitForFileActivity "C:\"
        MsgBox "Change", vbSystemModal
    End Sub

  3. #3

    Thread Starter
    New Member
    Join Date
    Feb 2001
    Location
    Alabama Gulf Coast
    Posts
    3
    Actually, no. This isn't really about kids and jpgs. We don't want to snoop/spy (legal issues). If they can't even save the file, it will stop the problem quietly.

    What I want is the computer to say "sorry, that file type is invalid" or something to that effect.

    Thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width