Running a form in another thread

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

    #1

    Running a form in another thread

    Hi there,

    I'm creating a form using the NativeWindow class to process some custom
    messages. Unfortunately as it's created on the main thread of the
    application it doesnt recieve messages while the thread is busy. So I'm
    trying to create it on a separate thread. I can do this but the only way I
    can keep the thread alive is by call Application.DoE vents. I'm not sure if
    this is the correct way to do this as I'm presuming it processes all
    messages to all forms in the application?

    Is there any way I can create a form and keep it in a separate thread?
    Thanks loads in advance.

    --
    Nick Pateman

    ---------------------------------------------------------------
    Please do not reply directly to me, but the entire newsgroup.
    Any views expressed above are my own
    Without predjudice


  • Herfried K. Wagner [MVP]

    #2
    Re: Running a form in another thread

    "Nick" <a@a.com> schrieb:[color=blue]
    > I'm creating a form using the NativeWindow class to process some custom
    > messages. Unfortunately as it's created on the main thread of the
    > application it doesnt recieve messages while the thread is busy. So I'm
    > trying to create it on a separate thread. I can do this but the only way
    > I can keep the thread alive is by call Application.DoE vents. I'm not sure
    > if this is the correct way to do this as I'm presuming it processes all
    > messages to all forms in the application?[/color]

    Your second thread needs a separate message pump. You can call
    'Application.Ru n' on the second thread to create a message pump. However,
    note that forms and controls created in different threads cannot directly
    interact with each other.

    --
    M S Herfried K. Wagner
    M V P <URL:http://dotnet.mvps.org/>
    V B <URL:http://classicvb.org/petition/>

    Comment

    • Nick

      #3
      Re: Running a form in another thread

      Hi Herfried,
      [color=blue]
      > Your second thread needs a separate message pump. You can call
      > 'Application.Ru n' on the second thread to create a message pump. However,
      > note that forms and controls created in different threads cannot directly
      > interact with each other.[/color]

      Thanks for your help :-) Most appreciated.

      Nick.


      Comment

      Working...