Log inUsernamePassword
Log me on automatically each visit    
Register
Register
Log in to check your private messages
Log in to check your private messages
Visual Basic Forum for Visual Basic Programmers VB Forum Index » Knowledge Base

Post new topic   Reply to topic
Prevent your files from copying by unauthorised person
View previous topic :: View next topic  
Author Message
Avis
Junior Poster


Joined: 07 Oct 2003
Posts: 510
Location: India

PostPosted: Aug 2nd, 2004 07:07 AM    Post subject: Prevent your files from copying by unauthorised person Reply with quote

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!
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger ICQ Number
Display posts from previous:   
Post new topic   Reply to topic    Visual Basic Forum for Visual Basic Programmers VB Forum Index » Knowledge Base All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Visual Basic Forum runs phpBB | Forum Template © iOptional
VB Resources | SSL | Visual Basic