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 / C++ / MFC
  4. How to Set Environment Variable using Mfc coding

How to Set Environment Variable using Mfc coding

Scheduled Pinned Locked Moved C / C++ / MFC
c++helptutorialworkspace
5 Posts 3 Posters 5 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.
  • M Offline
    M Offline
    Murugan k
    wrote on last edited by
    #1

    Help-I Don't know how to set environment path for Mycomputer System properties using MFC coding

    P J 2 Replies Last reply
    0
    • M Murugan k

      Help-I Don't know how to set environment path for Mycomputer System properties using MFC coding

      P Offline
      P Offline
      prasad_som
      wrote on last edited by
      #2

      Use _putenv[^].

      Prasad Notifier using ATL | Operator new[],delete[][^]

      M 1 Reply Last reply
      0
      • M Murugan k

        Help-I Don't know how to set environment path for Mycomputer System properties using MFC coding

        J Offline
        J Offline
        James R Twine
        wrote on last edited by
        #3

        Do not waste your time on things like the C-RTL and Win32 functions (SetEnvironmentVariable(...)) to set environment variables - these only affect the process' environment space - other processes will not be affected, nor will you see the change when you bring up up the system properties.    If you need to change these values such that the change remains after your application exists and/or are visible to other application and the system, you will need to modify the registry.    Look up the HKCU\Environment and HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment registry keys for more information on how to do this.    Peace!

        -=- James


        If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong!
        Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road!
        DeleteFXPFiles & CheckFavorites (Please rate this post!)

        M 1 Reply Last reply
        0
        • J James R Twine

          Do not waste your time on things like the C-RTL and Win32 functions (SetEnvironmentVariable(...)) to set environment variables - these only affect the process' environment space - other processes will not be affected, nor will you see the change when you bring up up the system properties.    If you need to change these values such that the change remains after your application exists and/or are visible to other application and the system, you will need to modify the registry.    Look up the HKCU\Environment and HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment registry keys for more information on how to do this.    Peace!

          -=- James


          If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong!
          Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road!
          DeleteFXPFiles & CheckFavorites (Please rate this post!)

          M Offline
          M Offline
          Murugan k
          wrote on last edited by
          #4

          Thanks for your valuable information

          1 Reply Last reply
          0
          • P prasad_som

            Use _putenv[^].

            Prasad Notifier using ATL | Operator new[],delete[][^]

            M Offline
            M Offline
            Murugan k
            wrote on last edited by
            #5

            Thanks for valueable information

            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