私はアプリケーション登録フォームのために働いていますが、ユーザーが登録フォームを開いたときに知りたいのですが、現在の日付が真であるかどうかをチェックする必要があり、ユーザーがシステム日付を変更しようとすると、だから私は1秒ごとにフォームをリフレッシュして、彼が日付を変更したかどうかを確認したいと思います。 どうすればいいですか?vb.netを使用して勝利フォームをリフレッシュするには?
btnRegister.Enabled = False
Dim oReg As Microsoft.Win32.RegistryKey
oReg = Microsoft.Win32.Registry.CurrentUser.OpenSubKey("Software", True)
oReg = oReg.CreateSubKey(kstrRegSubKeyName)
oReg = Microsoft.Win32.Registry.CurrentUser.OpenSubKey("Software\\" & kstrRegSubKeyName)
Dim strOldDay As String = oReg.GetValue("UserSettings", "").ToString
Dim strOldMonth As String = oReg.GetValue("operatingsystem", "").ToString
Dim strOldYear As String = oReg.GetValue("GUID", "").ToString
Dim strRegName As String = oReg.GetValue("USERID", "").ToString
Dim strRegCode As String = oReg.GetValue("LOCALPATH", "").ToString
Dim strCompID As String = oReg.GetValue("CompID", "").ToString
Dim strTrialDone As String = oReg.GetValue("Enable", "").ToString
oReg.Close()
'If the keys should automatically be created, then create them.
If strOldDay = "" Then
CreateRegKeys(txtPassPhrase.Text)
End If
'If the keys are encrypted, decrypt them.
'If EncryptKeys = True Then
strOldDay = Decrypt(txtPassPhrase.Text, strOldDay)
strOldMonth = Decrypt(txtPassPhrase.Text, strOldMonth)
strOldYear = Decrypt(txtPassPhrase.Text, strOldYear)
'End If
'Define global variables.
mintUsedTrialDays = DiffDate(strOldDay, strOldMonth, strOldYear)
'Fill the progress bar
lblApplicationStatus.Text = DisplayApplicationStatus(DiffDate(strOldDay, strOldMonth, strOldYear), mintTrialPeriod)
'Disable the continue button if the trial is over
If DiffDate(strOldDay, strOldMonth, strOldYear) > mintTrialPeriod Then
'unregbutton.Enabled = False
mblnInTrial = False
btnRemind.Enabled = False
oReg = Microsoft.Win32.Registry.CurrentUser.OpenSubKey("Software", True)
oReg = oReg.CreateSubKey(kstrRegSubKeyName)
oReg.SetValue("Enable", "1")
oReg.Close()
End If
If strOldMonth = "" Then
Else
Dim dtmOldDate As Date = New Date(Convert.ToInt32(strOldYear), Convert.ToInt32(strOldMonth), Convert.ToInt32(strOldDay))
If Date.Compare(DateTime.Now, dtmOldDate) < 0 Then
'lblApplicationStatus.Text = DisplayApplicationStatus(mintTrialPeriod, mintTrialPeriod)
lblApplicationStatus.Text = "The system clock has been manually changed, and the application has been locked out to prevent unauthorized access!"
End If
End If
'If the trial is done then disable the button
If strTrialDone = "1" Then
mblnInTrial = False
btnRemind.Enabled = False
lblApplicationStatus.Text = "The system clock has been manually changed, and the application has been locked out to prevent unauthorized access!"
End If
'See if the user is already registered, if so re-process the info and check if the computer is all okay.,
If strRegName = "" Then
Else
Dim strRN As String = Decrypt(txtPassPhrase.Text, strRegName)
Dim strRC As String = Decrypt(txtPassPhrase.Text, strRegCode)
Dim UserName As String = strRegName
UserName = UserName.Remove(16, (UserName.Length - 16))
If UserName = Decrypt(txtPassPhrase.Text, strRegCode) Then
If Encrypt(txtPassPhrase.Text, cHardware.GetMotherBoardID.Trim.ToString) = strCompID Then
mblnInTrial = False
mblnFullVersion = True
strRC = strRC.Insert(4, "-")
strRC = strRC.Insert(8, "-")
strRC = strRC.Insert(12, "-") 'Add dashes to make it look cool
lblApplicationStatus.Text = "Licensed version to " + strRN + " with the key " + strRC
txtVKClientName.Enabled = False
txtKeyToValidate.Enabled = False
txtVKClientName.Text = strRN
txtKeyToValidate.Text = strRC
btnRemind.Text = "Registered"
frmMain.Text = "Aquamark v1.2(Registered)"
btnRegister.Hide()
Me.Close()
frmMain.Show()
oReg = Microsoft.Win32.Registry.CurrentUser.OpenSubKey("Software", True)
oReg = oReg.CreateSubKey(kstrRegSubKeyName)
oReg.SetValue("Enable", "")
oReg.Close()
End If
End If
End If
ありがとうございましたjalalあなたは私にとって非常にシンプルにしましたが、たとえそれがC#でもVB変換器で管理することはできます。 –
@volety:あなたも大歓迎です;) –