Using Progress Bars with CopyFileEx

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • H Glenn Hatfield

    #1

    Using Progress Bars with CopyFileEx

    I know this has come up a couple of times on the group, but I'm still having
    trouble with it.

    I'm fine with creating the delegate and CopyFileEx declarations and the function
    which gets delegated to. The problem I have is the actual updating of the
    progress bar. I can understand passing a pointer through the ldata paramater
    in C++, but I can't find an example of what to do in C#. In all the examples
    using delegates that I have found, they've always done things like Console.Write
    or other things that don't access instance variables.

    Please Help!!!

    H Glenn Hatfield
  • Mattias Sjögren

    #2
    Re: Using Progress Bars with CopyFileEx

    [color=blue]
    >I can understand passing a pointer through the ldata paramater
    >in C++, but I can't find an example of what to do in C#.[/color]

    You probably don't have to, since a delegate can refer to a specific
    instance method.

    But you have to use Control.Invoke to make sure the progress bar is
    updated from the GUI thread.



    Mattias

    --
    Mattias Sjögren [MVP] mattias @ mvps.org

    Please reply only to the newsgroup.

    Comment

    • Nicholas Paldino [.NET/C# MVP]

      #3
      Re: Using Progress Bars with CopyFileEx

      You shouldn't have to worry about any of that (passing lParam or
      wParam). Rather, you will have to create another delegate that has the
      signature of the function you want called as the callback (when you received
      the callback notification from CopyFileEx), and then pass that to the Invoke
      method.

      Can you show some of your code? It would help.

      Hope this helps.


      --
      - Nicholas Paldino [.NET/C# MVP]
      - nicholas.paldin o@exisconsultin g.com


      "H Glenn Hatfield" <hgh@byu.edu> wrote in message
      news:fb1b2cf.03 09182029.1d66d4 f3@posting.goog le.com...[color=blue]
      > I know this has come up a couple of times on the group, but I'm still[/color]
      having[color=blue]
      > trouble with it.
      >
      > I'm fine with creating the delegate and CopyFileEx declarations and the[/color]
      function[color=blue]
      > which gets delegated to. The problem I have is the actual updating of the
      > progress bar. I can understand passing a pointer through the ldata[/color]
      paramater[color=blue]
      > in C++, but I can't find an example of what to do in C#. In all the[/color]
      examples[color=blue]
      > using delegates that I have found, they've always done things like[/color]
      Console.Write[color=blue]
      > or other things that don't access instance variables.
      >
      > Please Help!!!
      >
      > H Glenn Hatfield[/color]


      Comment

      Working...