Looping and processing messages

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

    Looping and processing messages

    Hi,

    In traditional win32 programming, if for example I have to parse a large
    bunch of data where I only need some fragments out, I should create a class
    with a hidden window wich post a message to the window's WndProc who on his
    part fire an event with the data part. Of course othere alternatives are, but
    that's not the question. It is just one solution for particular problems and
    it is very simple.

    The question is what are the alternatives for this in .NET ?

    1. Using P/Invoke for use PostMessage, override WndProc of the form and do
    in fact the same.
    2. Using a thread to handle all
    3. Make a class that does it in a thread, and make an event handler for
    every needed data part, eventually use Control.BeginIn voke or Control.Invoke
    to synchronize with main thread.

    Other alternatives ?

    --
    rgds, Wilfried

  • Bishoy Ghaly

    #2
    Re: Looping and processing messages

    Hi Wilfried,
    Although what you was using was a good solution in the win32 point of
    view but i do not recomment that you use the same way with .NET since .NET
    is feature rich more than C++ and other passive languages, so my
    recommindation is that you try doing your task with a THREAD , which is a
    non blocking way to process other things and still keep the application
    running (Asynchronos processing)
    you need to creat a class to do the processing and make a parameter-less
    methode inside this class and create a Thread for this methode and start
    this thread

    if you need any further help visit those links:


    -----------------------------------------------------------------------------------------
    "Wilfried Mestdagh" <WilfriedMestda gh@discussions. microsoft.com> wrote in
    message news:D8642C55-4B36-432E-A050-6C2207307401@mi crosoft.com...[color=blue]
    > Hi,
    >
    > In traditional win32 programming, if for example I have to parse a large
    > bunch of data where I only need some fragments out, I should create a
    > class
    > with a hidden window wich post a message to the window's WndProc who on
    > his
    > part fire an event with the data part. Of course othere alternatives are,
    > but
    > that's not the question. It is just one solution for particular problems
    > and
    > it is very simple.
    >
    > The question is what are the alternatives for this in .NET ?
    >
    > 1. Using P/Invoke for use PostMessage, override WndProc of the form and do
    > in fact the same.
    > 2. Using a thread to handle all
    > 3. Make a class that does it in a thread, and make an event handler for
    > every needed data part, eventually use Control.BeginIn voke or
    > Control.Invoke
    > to synchronize with main thread.
    >
    > Other alternatives ?
    >
    > --
    > rgds, Wilfried
    > http://www.mestdagh.biz[/color]


    Comment

    • The Man With The Golden Gun

      #3
      Re: Looping and processing messages

      Wilfried Mestdagh wrote:
      [color=blue]
      > Hi,
      >
      > In traditional win32 programming, if for example I have to parse a large
      > bunch of data where I only need some fragments out, I should create a
      > class with a hidden window wich post a message to the window's WndProc who[/color]

      This sounds like an exact match for .net Remoting.

      Have you looked at that?

      Also, WSE 2.0 can perform that task as well -- but it's more http-ish and
      you may want the speed and configurability of Remoting.

      [color=blue]
      > on his part fire an event with the data part. Of course othere
      > alternatives are, but that's not the question. It is just one solution for
      > particular problems and it is very simple.
      >
      > The question is what are the alternatives for this in .NET ?
      >
      > 1. Using P/Invoke for use PostMessage, override WndProc of the form and do
      > in fact the same.
      > 2. Using a thread to handle all
      > 3. Make a class that does it in a thread, and make an event handler for
      > every needed data part, eventually use Control.BeginIn voke or
      > Control.Invoke to synchronize with main thread.
      >
      > Other alternatives ?
      >[/color]

      --
      "You see, in this world there are two types of people, my friend:
      those with loaded guns and those who dig. You dig."
      -C. Eastwood, G,B&U

      Comment

      Working...