RobotStudio event

System clock

Hi.

Does anyone knows how to use the systemclock in the controller in a RAB 5.10 application?

I would like to create a simple licensing function for my applications.
I want the user/company to fill in a licensecode after 30 days to be able to continue using the application.
Therefore I need the time from the systemclock to compere installationday with actual day.

Maybe there are someone that have done this before and can give some advise or the complete code?

Best regards

          Magnus Johnson

Comments

  • John Wiberg
    John Wiberg ✭✭✭

    I've not tested it myself but this is from the FPSDK manual:

    This example retrieves the controller name and the current date and time and displays the information in a GTPUMessageBox . private void DisplayNameNnTime(Controller myControllerRef)
    {
           // Get the name of the controller
           string name = myControllerRef.Name;

           // Get current date and time
        DateTime now = myControllerRef.DateTime;

        // Compose text
        string text = string.Format("Name of controller is: {0}
    Current date is: {1}
    and the time is: {2}:{3}",name,
            now.Date.ToString(), now.Hour, now.Minute);

        // Display message box
        GTPUMessageBox.Show(this,
            new MessageBoxEventHandler(MyMessageBoxEventHandler),
            text,
            "System Information",
            System.Windows.Forms.MessageBoxIcon.Asterisk,
            System.Windows.Forms.MessageBoxButtons.OK);
    }

    But be aware that if you base your check only on the system time, then it would be simple for me to change the controller time and thus circumvent your license check. That is why some programs instead say that you can run them X times before you need to license them.