Search Tools Links Login

Prevent your application from unauthorised person


Visual Basic 6, or VB Classic

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.

Original Author: Milind Patil

Code

' * ************************************************************
' * Programmer Name : Milind M. Patil
' * E-Mail      :       milind_7001@rediffmail.com
' * Date       :       08/29/2001
' **********************************************************************
' * Comments     : 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.
' *
' **********************************************************************
' Frist Remove The Archive Attribute Of The File And Follow The Simple Code.
Private Sub command1_Click()
Dim result
result = GetAttr("c:myprojectsproject1.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 files 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:myprojectsproject1.vbp") ' read file attributes
If (attribs And FILE_ATTRIBUTES_ARCHIVE) <> 0 Then msgbox "Sorry Unauthorised Person" ........
.
.
.
End Sub

About this post

Posted: 2002-06-01
By: ArchiveBot
Viewed: 107 times

Categories

Visual Basic 6

Attachments

No attachments for this post


Loading Comments ...

Comments

No comments have been added for this post.

You must be logged in to make a comment.