Avis Junior Poster

Joined: 07 Oct 2003 Posts: 510 Location: India
|
Posted: Aug 2nd, 2004 07:07 AM Post subject: Prevent your files from copying by unauthorised person |
|
|
Prevent your files from copying by unauthorised person. By default any file's Attribute is Archive. You have to just remove this Attribute from it's property. When any one copy this file,at this time the file is again became Archive we can use this to identifying Unauthorised user.
[vb:1:c9afb4b989]' ********************************
' * Comments : Prevent your files from c
' opying by unauthorised person.
' *
' * By default any file's Attribute is A
' rchive.
' * You have to just remove this Attribu
' te from it's property.
' * When any one copy this file,at this
' time the file is again
' * became Archive we can use this to id
' entifying Unauthorised user.
' *
' **************************************
' ********************************
' Frist Remove The Archive Attribute Of
' The File And Follow The Simple Code.
Private Sub command1_Click()
Dim result
result = GetAttr("c:\myprojects\project1.exe") And vbArchive
If result = 0 Then
MsgBox "ok"
Else
MsgBox "sorry unautohrised user"
unload me
End If
End Sub
OR
'''''''You can also use API to check fil
' es attributes''''''
''''place the code in module1
Declare Function GetFileAttributes Lib "kernel32.dll" Alias "GetFileAttributesA" (ByVal lpFileName As String) As Long
''''place the code on form's command1
Private Sub command1_Click()
Dim val As Long
val = GetFileAttributes("c:\myprojects\project1.vbp") ' read file attributes
If (attribs And FILE_ATTRIBUTES_ARCHIVE) <> 0 Then MsgBox "Sorry Unauthorised Person" ........
.
.
.
End Sub[/vb:1:c9afb4b989] _________________ Code Snippets, Tutorials, Utilities, Controls
Low cost Web Hosting
Hosting starts at as low as $4 per year!
Always follow posting guidelines
Put your VB code in [vb ] your code [ /vb] tags! |
|