Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Detection of an installed program

Detection of an installed program

Scheduled Pinned Locked Moved C#
question
17 Posts 7 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Lost User

    The system will do it for you. If the framework is not installed then your program will not even start.

    One of these days I'm going to think of a really clever signature.

    L Offline
    L Offline
    Lost User
    wrote on last edited by
    #3

    Richard MacCutchan wrote:

    your program will not even start.

    Technically inaccurate. It will indeed start and display a message box telling you that the required framework is missing. :-)

    L 1 Reply Last reply
    0
    • L Lost User

      Richard MacCutchan wrote:

      your program will not even start.

      Technically inaccurate. It will indeed start and display a message box telling you that the required framework is missing. :-)

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #4

      Shameel wrote:

      Technically inaccurate.

      On the contrary, the actual program will not start. The system will receive a request to start it, and the loader will check for prerequisites and abort the loading when it discovers that a required library is not present. The point being that the user code will never get control in order to 'see' this problem.

      One of these days I'm going to think of a really clever signature.

      L 1 Reply Last reply
      0
      • F Fred 34

        How can we detect from our program that a prerequired program such as dotNetFrameWork3 or 4 is installed and also is active now or not? thanks

        OriginalGriffO Offline
        OriginalGriffO Offline
        OriginalGriff
        wrote on last edited by
        #5

        The only way to do it is to write a native code pre-loader which checks the requirements you specify and only starts your porgram if they are met. But you can't do that in C# or any other .NET language as Richard has already said - you would need to use C or C++ most likely.

        Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water

        "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
        "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

        1 Reply Last reply
        0
        • F Fred 34

          How can we detect from our program that a prerequired program such as dotNetFrameWork3 or 4 is installed and also is active now or not? thanks

          A Offline
          A Offline
          Abhinav S
          wrote on last edited by
          #6

          Create an installer for your program and let this installer check the required framework for you - Add Prerequisites of .NET Framework in Visual Studio Setup Project[^].

          WP7.5 Apps - XKCD | Calvin | SMBC | Sound Meter | Speed Dial

          F 1 Reply Last reply
          0
          • L Lost User

            The system will do it for you. If the framework is not installed then your program will not even start.

            One of these days I'm going to think of a really clever signature.

            F Offline
            F Offline
            Fred 34
            wrote on last edited by
            #7

            FrameWork was just an example.

            L 1 Reply Last reply
            0
            • A Abhinav S

              Create an installer for your program and let this installer check the required framework for you - Add Prerequisites of .NET Framework in Visual Studio Setup Project[^].

              WP7.5 Apps - XKCD | Calvin | SMBC | Sound Meter | Speed Dial

              F Offline
              F Offline
              Fred 34
              wrote on last edited by
              #8

              As I mentioned before, FrameWork was just an example. In general, how is it possible to check that a dll which is not even famous, is running or not?

              L 1 Reply Last reply
              0
              • L Lost User

                Shameel wrote:

                Technically inaccurate.

                On the contrary, the actual program will not start. The system will receive a request to start it, and the loader will check for prerequisites and abort the loading when it discovers that a required library is not present. The point being that the user code will never get control in order to 'see' this problem.

                One of these days I'm going to think of a really clever signature.

                L Offline
                L Offline
                Lost User
                wrote on last edited by
                #9

                Richard MacCutchan wrote:

                On the contrary, the actual program will not start.

                The actual program WILL start and execute a native bootstrap that loads the mscoree.dll (which is Framework version agnostic). It is this dll that actually checks if the supported Runtime is installed and displays a message box if it is not installed.

                Richard MacCutchan wrote:

                the point being that the user code will never get control in order to 'see' this problem.

                Agree.

                L 1 Reply Last reply
                0
                • F Fred 34

                  FrameWork was just an example.

                  L Offline
                  L Offline
                  Lost User
                  wrote on last edited by
                  #10

                  And I gave the answer based on that information. If you wish to discuss some other issue then maybe you could explain further.

                  One of these days I'm going to think of a really clever signature.

                  1 Reply Last reply
                  0
                  • L Lost User

                    Richard MacCutchan wrote:

                    On the contrary, the actual program will not start.

                    The actual program WILL start and execute a native bootstrap that loads the mscoree.dll (which is Framework version agnostic). It is this dll that actually checks if the supported Runtime is installed and displays a message box if it is not installed.

                    Richard MacCutchan wrote:

                    the point being that the user code will never get control in order to 'see' this problem.

                    Agree.

                    L Offline
                    L Offline
                    Lost User
                    wrote on last edited by
                    #11

                    So the program still never gets started, the only thing that gets any control is the framework that is wrapped round the app. My point was to show that the user code has no way of checking whether a required feature is present or not. Which, after all, is what the questioner is asking about.

                    One of these days I'm going to think of a really clever signature.

                    1 Reply Last reply
                    0
                    • F Fred 34

                      As I mentioned before, FrameWork was just an example. In general, how is it possible to check that a dll which is not even famous, is running or not?

                      L Offline
                      L Offline
                      Lost User
                      wrote on last edited by
                      #12

                      DLLs do not 'run', they are loaded by the system when an application attempts to call a function within the DLL. Alternatively an application can load the DLL and make 'unlinked' calls to functions using the LoadLibrary()[^] and associated functions. This is true in native applications but I'm not sure that it is particularly straightforward in .NET based applications. Perhaps a clearer explanation of what you are trying to achieve would help.

                      One of these days I'm going to think of a really clever signature.

                      F 1 Reply Last reply
                      0
                      • L Lost User

                        DLLs do not 'run', they are loaded by the system when an application attempts to call a function within the DLL. Alternatively an application can load the DLL and make 'unlinked' calls to functions using the LoadLibrary()[^] and associated functions. This is true in native applications but I'm not sure that it is particularly straightforward in .NET based applications. Perhaps a clearer explanation of what you are trying to achieve would help.

                        One of these days I'm going to think of a really clever signature.

                        F Offline
                        F Offline
                        Fred 34
                        wrote on last edited by
                        #13

                        You are right, assume that a program wants to check out a printer driver is loaded or not?

                        P L 2 Replies Last reply
                        0
                        • F Fred 34

                          You are right, assume that a program wants to check out a printer driver is loaded or not?

                          P Offline
                          P Offline
                          Paul Conrad
                          wrote on last edited by
                          #14

                          Though Enumerating All Device Drivers in the System[^] is in C++, I'm sure you could implement this in C#. You may want to look into this. A code sample at http://www.pinvoke.net/default.aspx/psapi.enumdevicedrivers[^] in C#, hope this sheds some light for you :)

                          "Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus

                          1 Reply Last reply
                          0
                          • F Fred 34

                            How can we detect from our program that a prerequired program such as dotNetFrameWork3 or 4 is installed and also is active now or not? thanks

                            J Offline
                            J Offline
                            jschell
                            wrote on last edited by
                            #15

                            Based on your other responses your question is imprecise. There are many things that at application either requires or desires. The impact on the application on those depends on the nature of the item itself. As an extreme example if you have compiled windows binary it will not run on a BASIC-STAMP. It is also ridiculous to even consider that case. The needs can be broken into the following 1. It will always be on the target system 2. It will often be on the target system 3. It will sometimes be on the target system. What your application does based on the above depends on the need. Choices are. 1. Do not run. 2. Run but do not enable certain functionality. 3. Run and provide default functionality. 4. Inform the user and ask them to install the functionality. You can attempt to minimize problems by creating an appropriate installer. The nature of that installer depends on the decisions related to the above. But in general the installer must check for the specific functionality and then install it. How it does that still depends on the nature of the resource though. And all of the above also is impacted by the license of the specific resources.

                            1 Reply Last reply
                            0
                            • F Fred 34

                              You are right, assume that a program wants to check out a printer driver is loaded or not?

                              L Offline
                              L Offline
                              Lost User
                              wrote on last edited by
                              #16

                              Well, as Paul explains, you can enumerate all sorts of information in C++, which probably means you need to learn about P/Invoke[^]. However, you still have not explained what you are trying to achieve.

                              One of these days I'm going to think of a really clever signature.

                              1 Reply Last reply
                              0
                              • F Fred 34

                                How can we detect from our program that a prerequired program such as dotNetFrameWork3 or 4 is installed and also is active now or not? thanks

                                P Offline
                                P Offline
                                PIEBALDconsult
                                wrote on last edited by
                                #17

                                I wouldn't bother; I'd just write the app normally and if something is missing it will throw an Exception. For instance, if my app tries to use the ACE engine to query an Access or Excel file, if ACE isn't present I get an Exception explaining this.

                                1 Reply Last reply
                                0
                                Reply
                                • Reply as topic
                                Log in to reply
                                • Oldest to Newest
                                • Newest to Oldest
                                • Most Votes


                                • Login

                                • Don't have an account? Register

                                • Login or register to search.
                                • First post
                                  Last post
                                0
                                • Categories
                                • Recent
                                • Tags
                                • Popular
                                • World
                                • Users
                                • Groups