Application in focus

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Alan T

    #1

    Application in focus

    How do I make my application back to focus during it is processing I switch
    to other application and back ?

    During my application processing, I open another application, eg. notepad.
    Then I select my application, my application screen is in white.


  • Nicholas Paldino [.NET/C# MVP]

    #2
    Re: Application in focus

    This isn't a focus issue, this is a matter of you doing all the
    processing on the main UI thread.

    Perform your processing on another thread, and leave the UI thread to
    process messages, and you should have no problem switching back.

    Hope this helps.


    --
    - Nicholas Paldino [.NET/C# MVP]
    - mvp@spam.guard. caspershouse.co m

    "Alan T" <alanpltseNOSPA M@yahoo.com.auw rote in message
    news:ufneBpI0GH A.4932@TK2MSFTN GP02.phx.gbl...
    How do I make my application back to focus during it is processing I
    switch to other application and back ?
    >
    During my application processing, I open another application, eg. notepad.
    Then I select my application, my application screen is in white.
    >

    Comment

    • Cor Ligthert [MVP]

      #3
      Re: Application in focus

      Alan,

      You have in my idea more possibilities to that as
      the method
      http://msdn2.microsoft.com/en-us/lib...rol.focus.aspx

      or the properties
      TopLevel and TopMost be aware that those can be annoying so when you use
      them you can set them to true and direct than to false.

      I hope this helps,

      Cor


      "Alan T" <alanpltseNOSPA M@yahoo.com.aus chreef in bericht
      news:ufneBpI0GH A.4932@TK2MSFTN GP02.phx.gbl...
      How do I make my application back to focus during it is processing I
      switch to other application and back ?
      >
      During my application processing, I open another application, eg. notepad.
      Then I select my application, my application screen is in white.
      >

      Comment

      • Alan T

        #4
        Re: Application in focus

        What I want to do is I want to let the process finish first before the user
        can select the main form.
        During the process the cursor is in "wait" type.
        I just want to make the main form appear normal except cannot select the
        controls on the form.If the main form appears in white, the user may think
        the system is hang.

        "Nicholas Paldino [.NET/C# MVP]" <mvp@spam.guard .caspershouse.c omwrote in
        message news:%23P3uwLJ0 GHA.4264@TK2MSF TNGP05.phx.gbl. ..
        This isn't a focus issue, this is a matter of you doing all the
        processing on the main UI thread.
        >
        Perform your processing on another thread, and leave the UI thread to
        process messages, and you should have no problem switching back.
        >
        Hope this helps.
        >
        >
        --
        - Nicholas Paldino [.NET/C# MVP]
        - mvp@spam.guard. caspershouse.co m
        >
        "Alan T" <alanpltseNOSPA M@yahoo.com.auw rote in message
        news:ufneBpI0GH A.4932@TK2MSFTN GP02.phx.gbl...
        >How do I make my application back to focus during it is processing I
        >switch to other application and back ?
        >>
        >During my application processing, I open another application, eg.
        >notepad. Then I select my application, my application screen is in white.
        >>
        >
        >

        Comment

        • Alan T

          #5
          Re: Application in focus

          Hi,

          This is what I did to solve my problem:

          Main Form:
          private void tsMnRebuild_Cli ck(object sender, EventArgs e)

          {

          Thread KeywordThread = new Thread(new ThreadStart(thi s.ExecuteRebuil d));

          KeywordThread.S tart();

          }

          private void ExecuteRebuild( )

          {

          .........

          .........

          }



          I have a conern:

          Is there any possibility to make the main form crash if something happen to
          the thread ?



          "Cor Ligthert [MVP]" <notmyfirstname @planet.nlwrote in message
          news:OPXvqZK0GH A.4044@TK2MSFTN GP04.phx.gbl...
          Alan,
          >
          You have in my idea more possibilities to that as
          the method
          http://msdn2.microsoft.com/en-us/lib...rol.focus.aspx
          >
          or the properties
          TopLevel and TopMost be aware that those can be annoying so when you use
          them you can set them to true and direct than to false.
          >
          I hope this helps,
          >
          Cor
          >
          >
          "Alan T" <alanpltseNOSPA M@yahoo.com.aus chreef in bericht
          news:ufneBpI0GH A.4932@TK2MSFTN GP02.phx.gbl...
          >How do I make my application back to focus during it is processing I
          >switch to other application and back ?
          >>
          >During my application processing, I open another application, eg.
          >notepad. Then I select my application, my application screen is in white.
          >>
          >
          >

          Comment

          Working...