Avatar of isnoend2001
isnoend2001Flag for United States of America

asked on 

write date to a file and then open and compare to 30 days

I have a vb estimating program on a flash drive that can be used on laptops. To prevent the flash drive from being stolen i want the flash drive to have to be plugged iinto the main registered version every 30 days or it will not load. The usb flash drive on load will check for this file and will not load if more than 30 days or if the file does not exist.
How can i write this?
Visual Basic Classic

Avatar of undefined
Last Comment
isnoend2001
Avatar of peetm
peetm
Flag of United Kingdom of Great Britain and Northern Ireland image

Something like this [VB6]?

Public Function OkToRun(ByVal filename As String) As Boolean
   
    Dim fso As New Scripting.FileSystemObject
   
    If fso.FileExists(filename) Then
   
        If DateDiff("d", fso.GetFile(filename).DateCreated, Now) <= 30 Then
       
            Call fso.DeleteFile(filename)
           
            Call fso.CreateTextFile(filename, True).WriteLine(Now)
           
            OkToRun = True
       
        End If

    End If

End Function
ASKER CERTIFIED SOLUTION
Avatar of peetm
peetm
Flag of United Kingdom of Great Britain and Northern Ireland image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of isnoend2001
isnoend2001
Flag of United States of America image

ASKER

The datelastaccessed or modified can be reset just by opening it and saving
it. with Binary files its hard to modify the file contents
Visual Basic Classic
Visual Basic Classic

Visual Basic is Microsoft’s event-driven programming language and integrated development environment (IDE) for its Component Object Model (COM) programming model. It is relatively easy to learn and use because of its graphical development features and BASIC heritage. It has been replaced with VB.NET, and is very similar to VBA (Visual Basic for Applications), the programming language for the Microsoft Office product line.

165K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo