If you see a problem with this please let me know, I tested it repeatedly by changing the date on my PC, and walah!! On day 10 it worked..
Code:
Tested with this line: If IsPastExpireDate("Jun 01,2000 08:00AM",10) Then MsgBox "Test worked!" '------------------------------------------------------------------------------------------ 'EvalDays is how many days they are allowed To evaluate the software 'InstallDate will be In this format: ' "MMM dd',' yyyy" "hh:mm tt" Function IsPastExpireDate(InstallDate As String,EvalDays As Long)Export As Long Dim qTimeNow As Local Quad Dim ctdate As Double Dim indate As Double Local st As SYSTEMTIME Local ct As SYSTEMTIME 'Convert InstallDate to double indate = StrToVbDate(InstallDate) 'Get Current Time GetlocalTime ct 'Convert CurrentDate to double SystemTimeToVariantTime ct, ctdate 'Current Time in variant format 'Compare the two dates and see 'If it's greater than the allowed evaluation time If (ctdate - indate) > EvalDays Then Function = %TRUE End Function '------------------------------------------------------------------------------------------ Function uString(ByVal x As String)Export As String Local y As String Local n As Integer If Len(x) Then For n = 1 To Len(x) y = y + Mki$(Asc(x, n)) Next n End If Function = y End Function '------------------------------------------------------------------------------ Function StrToVbDate(ByVal dt As String) Export As Double Local x As Long Local y As String Local vbdate As Double dt = uString(dt) If IsFalse(VarDateFromStr(ByVal StrPtr(dt), 0, 0, vbdate)) Then Function = vbdate End If End Function
Scott
mailto:[email protected][email protected]</A>
MCSE, MCP+Internet
[This message has been edited by Scott Turchin (edited June 13, 2000).]
Leave a comment: