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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. Refreshing the system

Refreshing the system

Scheduled Pinned Locked Moved C#
helpquestion
19 Posts 8 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

    Hi, Lemme clarify my question. I am trying to refresh the machine after a specific task has been accmplished. Like:

    private void button1_Click(object sender, EventArgs e)
    {
    //Some statements that needs to be executed on the button click
    .........................................................
    .........................................................

    //In order to make the changes take place, I need to refresh the system from once to thrice.
    }

    Help

    D Offline
    D Offline
    DaveyM69
    wrote on last edited by
    #4

    Do you mean you want to refresh the entire view in the monitor? If so, you'll have to use some PInvoke and at a minimum, get the desktop's handle and call InvalidateRect or UpdateWindow. You may need to do this for every open window too.

    Dave
    BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
    Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
    Why are you using VB6? Do you hate yourself? (Christian Graus)

    L 1 Reply Last reply
    0
    • L Lost User

      Hi, Lemme clarify my question. I am trying to refresh the machine after a specific task has been accmplished. Like:

      private void button1_Click(object sender, EventArgs e)
      {
      //Some statements that needs to be executed on the button click
      .........................................................
      .........................................................

      //In order to make the changes take place, I need to refresh the system from once to thrice.
      }

      Help

      M Offline
      M Offline
      molesworth
      wrote on last edited by
      #5

      Invalid_Win32_app. wrote:

      I am trying to refresh the machine

      What exactly do you mean by "refresh the machine"? Do you mean reboot?

      There are three kinds of people in the world - those who can count and those who can't...

      L 1 Reply Last reply
      0
      • M molesworth

        Invalid_Win32_app. wrote:

        I am trying to refresh the machine

        What exactly do you mean by "refresh the machine"? Do you mean reboot?

        There are three kinds of people in the world - those who can count and those who can't...

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

        molesworth wrote:

        What exactly do you mean by "refresh the machine"? Do you mean reboot?

        Not Reboot, I am just trying to refresh the PC, like we do by right-clicking on an empty space on the desktop and clicking on the Refresh option from the menu display. Thats what I want to do.

        T 1 Reply Last reply
        0
        • L Lost User

          molesworth wrote:

          What exactly do you mean by "refresh the machine"? Do you mean reboot?

          Not Reboot, I am just trying to refresh the PC, like we do by right-clicking on an empty space on the desktop and clicking on the Refresh option from the menu display. Thats what I want to do.

          T Offline
          T Offline
          tom572007
          wrote on last edited by
          #7

          Your request is totally dumb! refresh the system doesn't mean anything. Refresh your desktop doesn't mean to refresh your system... Try to be more explicit Rajdeep

          L 1 Reply Last reply
          0
          • T tom572007

            Your request is totally dumb! refresh the system doesn't mean anything. Refresh your desktop doesn't mean to refresh your system... Try to be more explicit Rajdeep

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

            I think this should do:

            private void button1_Click(object sender, EventArgs e)
            {
            SendKeys.Send("{F5}");
            }

            What do you say? PS: How did you know that I am Rajdeep?

            A D 2 Replies Last reply
            0
            • L Lost User

              I think this should do:

              private void button1_Click(object sender, EventArgs e)
              {
              SendKeys.Send("{F5}");
              }

              What do you say? PS: How did you know that I am Rajdeep?

              A Offline
              A Offline
              Anthony Mushrow
              wrote on last edited by
              #9

              Invalid_Win32_app. wrote:

              PS: How did you know that I am Rajdeep?

              You can see the last 200 messages somebody has posted.

              My current favourite word is: Delicious!

              -SK Genius

              Game Programming articles start -here[^]-

              1 Reply Last reply
              0
              • L Lost User

                Howdy, I'm using this.Refresh() method in the Button_Click event to refresh the machine, but this only works for the form in particular. It doesn't seem to refresh the system, rather it seems like as if the form is getting refreshed up. Any way through which I can refresh the machine from two to three times, on a single button click? And is it possible to send the F5 key in oder to refresh? plz help! i_w32_app.

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

                Hey Rajdeep.NET, did you think that we wouldn't notice if you changed your name? You're still asking strange questions. Now I don't really know about this refresh thing, this is not normally something you even need to consider doing. Why do you even need to do this? Anyway, I'd look into sending a F5 keypress, like you suggested..

                P L 2 Replies Last reply
                0
                • D DaveyM69

                  Do you mean you want to refresh the entire view in the monitor? If so, you'll have to use some PInvoke and at a minimum, get the desktop's handle and call InvalidateRect or UpdateWindow. You may need to do this for every open window too.

                  Dave
                  BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
                  Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
                  Why are you using VB6? Do you hate yourself? (Christian Graus)

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

                  Is there some comprehensive way to this? I mean to say that this is quite difficult. PS: I only want to refresh the desktop. What about this:

                  private void Button1_Click(object sender, System.EventArgs e) {
                  SendKeys.Send("{ENTER}");
                  }

                  Please let me know.

                  D 1 Reply Last reply
                  0
                  • L Lost User

                    Hey Rajdeep.NET, did you think that we wouldn't notice if you changed your name? You're still asking strange questions. Now I don't really know about this refresh thing, this is not normally something you even need to consider doing. Why do you even need to do this? Anyway, I'd look into sending a F5 keypress, like you suggested..

                    P Offline
                    P Offline
                    padmanabhan N
                    wrote on last edited by
                    #12

                    now that guy has changed his name to x+y=xy?! some one has to take care of his activities....

                    Padmanabhan

                    L 1 Reply Last reply
                    0
                    • L Lost User

                      Hey Rajdeep.NET, did you think that we wouldn't notice if you changed your name? You're still asking strange questions. Now I don't really know about this refresh thing, this is not normally something you even need to consider doing. Why do you even need to do this? Anyway, I'd look into sending a F5 keypress, like you suggested..

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

                      Ok Ok!!! Chill now, I haven't asked any strange question this time.

                      P T 2 Replies Last reply
                      0
                      • L Lost User

                        Ok Ok!!! Chill now, I haven't asked any strange question this time.

                        P Offline
                        P Offline
                        padmanabhan N
                        wrote on last edited by
                        #14

                        y do u frequently change you name.... do you think that we are fools here...

                        Padmanabhan

                        1 Reply Last reply
                        0
                        • P padmanabhan N

                          now that guy has changed his name to x+y=xy?! some one has to take care of his activities....

                          Padmanabhan

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

                          Not all are fools, rather than you!

                          P 1 Reply Last reply
                          0
                          • L Lost User

                            Not all are fools, rather than you!

                            P Offline
                            P Offline
                            padmanabhan N
                            wrote on last edited by
                            #16

                            sit and recollect all your posts and the replies then you will know who is a fool....MR.XYZ

                            Padmanabhan

                            1 Reply Last reply
                            0
                            • L Lost User

                              Ok Ok!!! Chill now, I haven't asked any strange question this time.

                              T Offline
                              T Offline
                              tom572007
                              wrote on last edited by
                              #17

                              Invalid_Win32_app. wrote:

                              Ok Ok!!! Chill now, I haven't asked any strange question this time.

                              This question is very strange, to refresh your system, you need to reboot your PC (after changing registery keys...). How does windows refreshing itself after an update? It just reboot.. To press F5 on tour desktop only refresh the 'explorer.exe' program, but not your system who's loaded on startup. To press F5 on your application will do anything :) not even refresh your 'explorer' application. Try to discover the basics of windows before trying to hack it...

                              1 Reply Last reply
                              0
                              • L Lost User

                                Is there some comprehensive way to this? I mean to say that this is quite difficult. PS: I only want to refresh the desktop. What about this:

                                private void Button1_Click(object sender, System.EventArgs e) {
                                SendKeys.Send("{ENTER}");
                                }

                                Please let me know.

                                D Offline
                                D Offline
                                DaveyM69
                                wrote on last edited by
                                #18

                                It seems the easiest way to do this is to make the shell think file associations have changed. When it does, it redraws the desktop. Not sure how 'expensive' this is - but it works.

                                SHChangeNotify(SHCNE_ASSOCCHANGED, 0, 0, 0);

                                [DllImport("shell32.dll")]
                                static extern void SHChangeNotify(uint wEventId, uint uFlags, uint dwItem1, uint dwItem2);

                                const uint SHCNE_ASSOCCHANGED = 0x08000000;

                                Dave
                                BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
                                Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
                                Why are you using VB6? Do you hate yourself? (Christian Graus)

                                1 Reply Last reply
                                0
                                • L Lost User

                                  I think this should do:

                                  private void button1_Click(object sender, EventArgs e)
                                  {
                                  SendKeys.Send("{F5}");
                                  }

                                  What do you say? PS: How did you know that I am Rajdeep?

                                  D Offline
                                  D Offline
                                  Dan Neely
                                  wrote on last edited by
                                  #19

                                  Your level of stupidity is unique.

                                  It is a truth universally acknowledged that a zombie in possession of brains must be in want of more brains. -- Pride and Prejudice and Zombies

                                  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