Sharing values across projects (session variables)

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • Shide
    Indigo Rose Customer
    • Jul 2006
    • 21

    Sharing values across projects (session variables)

    Hi,

    I have a menu application and a data application, the menu application launches the data application. In this way if I need to do a true-update then I only need replace the smaller data application.

    Having said that, I don't want users to be able to launch the data application manually without the menu application launching it.
    To achieve this I thought I could;

    on button click in menu app

    Application.SaveValue("AP_LICENSE_STATUS", "MONTH_END", "YES");
    in the menu application and

    onstartup in data app

    licensed = Application.LoadValue("AP_LICENSE_STATUS", "MONTH_END");
    if licensed=="NO" or licensed==null then
    result = Dialog.Message("vifox.com Notice", "You are not licensed for this module.\r\nPlease click \"Purchase\" to buy now online.\r\nThank you for using FoxDocs.", MB_OK, MB_ICONSTOP, MB_DEFBUTTON1);
    Application.Exit(0);
    else
    end

    on shutdown in data app

    Application.SaveValue("AP_LICENSE_STATUS", "MONTH_END", "NO");

    But of course the reason I'm here is that it doesn't work.
    So I assume that Values stored during the session are only valid for the defining executable?
    If so, is there another method that I could use to ensure that the sub-application cannot be launched other than from the menu app?
    Remember, users are tricky, if I maintain an ini file or registry setting that is un-encrypted then within 10 minutes it will probably be a ***** on the internet somewhere.

    Thanks in advance
    Andy
  • RizlaUK
    Indigo Rose Customer
    • May 2006
    • 5552

    #2
    try useing a encrypted registry key instead

    eg:
    result = Crypto.BlowfishEncryptString("no_568_licence_423_f or_457_this_378_app", "mega_254_super_894_duper_4256_password", 0);
    Registry.SetValue(HKEY_LOCAL_MACHINE, "Software\\My Application", "My Value", result, REG_SZ);
    Embrace change in your life, you never know, it could all work out for the best

    Comment

    • RizlaUK
      Indigo Rose Customer
      • May 2006
      • 5552

      #3
      ok, iv been looking at this and iv found where the key is:

      HKEY_CURRENT_USER\Software\Indigo Rose\ACData\YOUR_KEY_NAME

      so if "Application.LoadValue" isent finding the key then use "Registry.GetValue" to find it

      eg:
      Registry.GetValue(HKEY_CURRENT_USER, "Software\\Indigo Rose\\ACData\\AP_LICENSE_STATUS", "MONTH_END", true);
      but i would encrypt it anyway, or have some kind of backup system in place (someone could just change the key to "YES" and run the app
      Last edited by RizlaUK; 01-19-2007, 05:02 PM.
      Embrace change in your life, you never know, it could all work out for the best

      Comment

      • Shide
        Indigo Rose Customer
        • Jul 2006
        • 21

        #4
        Marvellous

        Thanks RizlaUK. Registry encryption method works like a dream.
        This is certainly a more professional solution than mine.
        I did get my method working in the end though.

        On my button (on-click) that launches my other .exe file I put

        Application.SaveValue("AP_LICENSE_STATUS", "MONTH_END", "YES");
        File.Open("AutoPlay\\Docs\\AP Reconciliation.xls", "", SW_MAXIMIZE);
        File.Run("AutoPlay\\Docs\\Oracle Accounts Payable.exe", "", "", SW_SHOWNORMAL);
        Page.Jump("Main Menu");

        Then in my embeded .exe file on-startup

        licensed = Application.LoadValue("AP_LICENSE_STATUS", "MONTH_END")
        if licensed=="NO" then
        result = Dialog.Message("vifox.com Notice", "You are not licensed for this module.\r\nPlease click \"Purchase\" to buy now online.\r\nThank you for using FoxDocs.", MB_OK, MB_ICONSTOP, MB_DEFBUTTON1);
        Application.Exit(0);
        elseif licensed=="" then
        result = Dialog.Message("vifox.com Notice", "You are not licensed for this module.\r\nPlease click \"Purchase\" to buy now online.\r\nThank you for using FoxDocs.", MB_OK, MB_ICONSTOP, MB_DEFBUTTON1);
        Application.Exit(0);
        else
        end

        pretty simple. Of course as you pointed out it would be best to put a dummy string in the variable instead of YES. But it works ok.

        I will change over to the encrypted registry variable value, but I will need more than just 2 values I think. If I encrypt "letmein" and "dontletmein" then it's pretty easy to work out what encrypted variable to copy and paste.

        Thanks for the advice.
        Andy

        Comment

        Working...
        X