473,809 Members | 2,703 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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
Nov 15 '05 #1
2 6760
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

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/
Please reply only to the newsgroup.
Nov 15 '05 #2
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]
- ni************* *@exisconsultin g.com
"H Glenn Hatfield" <hg*@byu.edu> wrote in message
news:fb******** *************** **@posting.goog le.com...
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

Nov 15 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
4250
by: Xarky | last post by:
Hi, I am trying to use progress bars, where the progress is seen as vertical. I am succeding to manage progess bars, where progress is increasing horizontally, but not vertically. Can someone help me out Thanks in Advance
5
7385
by: Søren Reinke | last post by:
Hi there I am working on a program where the user should be able to import some CSV files. With my set of test data, it takes about 2 minutes to import, while it is importing the program sort of freezes. Therefore i would like to open a little window with a progress bar in it that shows how far the import has come.
6
2517
by: Kyle | last post by:
I want to do a single pix update bar instead of the big block that progress bars usually use. I can't seem to find any info on how to do this. Thanks in advance for any help, Kyle
11
2162
by: simon | last post by:
when I execute aspx page, it works about 5 minutes - I calculate some statistics. Is there some way, that I can show user time bar or smething similar? That he nows, that page is working. Thank you, Simon
3
5133
by: Paul | last post by:
I have been trying to code a callback in vb.net using the delegate method. I have successfully compiled the program and run it but after it accessess the copyfileex winapi method and then calls the callback method there are problems. For one the data that is populated in the parameters is wrong. I am expecting a value of 0 , 1 or maybe 2 for the dwcallbackreason and I get some outrageous number like 10788264 which incidentally is the same...
2
2958
by: Robert Smith | last post by:
Hello, I have a problem with my progress bar, as shown in the attached code, the values on the bar are incremented within a threaded timer event. The timer works fine and ticks all the way through. However when you Add a new status bar to the form with a Progress bar and then immediately perform some intense programming that uses a lot of processor resources, the bars in the progress bar are not displayed, even though the timer appears to...
2
2307
by: hzgt9b | last post by:
I've been executing the CopyFileEx code below in a Windows Application for several months... Try If CopyFileEx(fiSource.FullName, strTargetFile, Fpr, ACTION_COPY, 0, 0) 0 Then Else Throw New System.ComponentModel.Win32Exception( _ System.Runtime.InteropServices.Marshal.GetLastWin32Error) End If
3
8678
by: Ritesh Raj Sarraf | last post by:
Hi, I have a small application, written in Python, that uses threads. The application uses function foo() to download files from the web. As it reads data from the web server, it runs a progress bar by calling an install of a progress bar class. When using threads, I get the problem that the progress bar gets over-written by the download progress of files from other threads.
2
4230
by: bryangrif | last post by:
I am attempting to connect a progress bar to my application. I have created a separate form that has a label and a progress bar. I am making a call to CopyFileEx via interop to copy files over a network and would like to use the callback function to update the progress bar on the form. This application is written in C# with VS 2005. Any help would be appreciated.
0
9721
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9601
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10637
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10376
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10379
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9199
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6881
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5687
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3861
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.