Using Progress Bars with CopyFileEx

  • Thread starter Thread starter H Glenn Hatfield
  • Start date Start date
H

H Glenn Hatfield

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
 
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#.

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
 
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.
 
Back
Top