Check Windows Media Player

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • pgrimpo
    Forum Member
    • May 2003
    • 37

    Check Windows Media Player

    I have my main page which calls the following OnShow:

    --Check for Windows Media Version
    ir_GetWMPVersion()
    if (_WMPVer < "9.0.0") then
    Page.Jump("MP9 Install");
    end


    Then it goes to the MP9 page because the version is low.

    On MP9, when I install the program I do the following:

    File.Run("AutoPlay\\Docs\\MPSetupXP.exe", "", "", SW_SHOWNORMAL, true);
    Page.Jump("MainMenu");


    So you can see, I install the program and when it's done, it jumps back to the MainMenu.

    Now, on the main page, when I run that Check for Windows Media Version, shouldn't it check and see if the newly installed version is correct? Currently it just keeps looping and saying that I need to re-install.

    Any help would be greatly appreciated!

    -Grimps
  • Lorne
    Indigo Rose Staff Member
    • Feb 2001
    • 2729

    #2
    What's the value of _WMPVer when the MainMenu page is shown the second time? (Use a Dialog.Message or Debug.Print action or something to check the value.)
    --[[ Indigo Rose Software Developer ]]

    Comment

    • Intrigued
      Indigo Rose Customer
      • Dec 2003
      • 6138

      #3
      Originally posted by Brett
      You are correct. However, the dependency plugin that is used to detect WMP puts a function into the engine that you can call at any time and get "live" results:

      ir_GetWMPVersion()

      If you ever want to see what one of the built-in dependecy checkers are doing, just open the .dep file with WinZip (or similar program) and check out the .lua file inside. Dependency files are typically located in the C:\Program Files\AutoPlay Media Studio 5.0 Professional\Plugins\Detect folder.
      from this thread:



      Hope that helps (credit > Brett)
      Intrigued

      Comment

      • pgrimpo
        Forum Member
        • May 2003
        • 37

        #4
        Yes, that thread was actually from my original post on this issue. However, when I call that function, it doesn't seem to be getting me the new results, unless I'm not calling the function correctly.

        This is my code:

        --Check for Windows Media Version
        ir_GetWMPVersion()
        if (_WMPVer < "9.0.0") then
        Page.Jump("MP9 Install");
        end


        Shouldn't that check the version right there?

        -Grimps

        Comment

        • Intrigued
          Indigo Rose Customer
          • Dec 2003
          • 6138

          #5
          WMPVER = ir_GetWMPVersion();

          if (WMPVER >= "9.0.0") then

          else
          Page.Jump("MP9 Install");
          end

          Note: When calling a Function, one must end such with the semi-colon.

          Also, I did put this in to the Global Functions... section: (credit: Brett)

          [CODE BEGINS]

          function ir_GetWMPVersion()
          local bOK = true;

          --We're checking for Media player 7.0+ at this point . . .
          bOK = Registry.DoesKeyExist(HKEY_CLASSES_ROOT,"CLSID\\{6 BF52A52-394A-11d3-B153-00C04F79FAA6}\\InprocServer32");

          if (bOK) then
          strFileName = Registry.GetValue(HKEY_CLASSES_ROOT,"CLSID\\{6BF52 A52-394A-11d3-B153-00C04F79FAA6}\\InprocServer32","NoName",true);
          if (Application.GetLastError() ~= 0) then
          bOK = false;
          end
          else
          --version 7.0+ returned false, so we're now checking for version 6.4 . . .
          bOK = Registry.DoesKeyExist(HKEY_CLASSES_ROOT,"CLSID\\{2 2D6F312-B0F6-11D0-94AB-0080C74C7E95}\\InprocServer32");

          if (bOK) then
          strFileName = Registry.GetValue(HKEY_CLASSES_ROOT,"CLSID\\{22D6F 312-B0F6-11D0-94AB-0080C74C7E95}\\InprocServer32","NoName",true);
          if (Application.GetLastError() ~= 0) then
          bOK = false;
          end
          end
          end


          --If a version was found, we now get the version information
          if (bOK) then
          verInfo = File.GetVersionInfo(strFileName);
          if(Application.GetLastError() ~= 0)then
          strVersion = "0.0.0.0";
          else
          -- OK, we have the file version
          strVersion = verInfo.FileVersion;
          end
          end

          --If there was no version found, bOK = false, and verison is set to "0.0.0.0"
          if (bOK ~= true) then
          strVersion = "0.0.0.0";
          end

          return strVersion;
          end

          [CODE ENDS]
          Last edited by Intrigued; 02-11-2004, 09:03 PM.
          Intrigued

          Comment

          • Lorne
            Indigo Rose Staff Member
            • Feb 2001
            • 2729

            #6
            Originally posted by Intrigued
            Note: When calling a Function, one must end such with the semi-colon.
            Actually you don't have to use the semi-colon unles you want two statements on the same line, but it's very good practice to use it.

            Just a tip, though: you can make your code maintain indentation in these forums by using the (code) (/code) tags. Note: replace the () with [].
            --[[ Indigo Rose Software Developer ]]

            Comment

            • Intrigued
              Indigo Rose Customer
              • Dec 2003
              • 6138

              #7
              Thank you Lorne for the correction on my Function (must end with semi-colon) comment.

              And...

              Thank you for the tip. I did not know 'code' was even the correct syntax. I was close and did not even know how close I really was. (grin)

              Curious to see it in action:

              Code:
              Dialog.Message("Testing . . .", "This did work, super!");
              Last edited by Intrigued; 02-13-2004, 10:00 PM.
              Intrigued

              Comment

              Working...
              X