Making the ScanDlg more thread safe

Asked by VSeven on 2009-04-10

Move this:
            this.progressBar.Position = 0;
            this.progressBar.PositionMin = 0;
            this.progressBar.PositionMax = this.SectionCount;

From the StartScanning sub to the New decoration (or the "shown" section)

Add a delegate to the decorations:

public delegate void UpdateProgressBar(integer myValue);

Then add this sub:

/// <summary>
/// Updates the progress bars value
/// </summary>
private void UpdateProgressBarValue(int myValue)
    if (this.InvokeRequired) {
        this.Invoke(new UpdateProgressBar(UpdateProgressBarValue), myValue);
    this.ProgressBar.Value = myValue;

Should be close to removing the "CheckForIllegalCrossThreadCalls = False" in the shown sub.

Great program BTW....I've hacked it apart to use it in another program I'm working on (basic computer maintenanace app). Took out all of the restore functionality (my app does a system restore already), took out all options, and removed most of the interface. :) Converted it all to Visual Basic and got it down to a 58 kb executable. Now to convert the rest to a single "RegistryCleaner.vb" class and I'll be set.

Will be watching intently for updates, I did leave all the registry scan classes separate so I can get updates for those easier.


Question information

English Edit question
Little Registry Cleaner Edit question
No assignee Edit question
Solved by:
Last query:
Last reply:
Nick (ub3rst4r) said : #1

My only hope is that if your using this code in another app, your not trying to make profits of it as this is licensed under the GPL. Thanks for the info though

VSeven (vseven) said : #2

Naw, it's for a internal app at work. Possibly I'll distribute it but mine carries the GPL licenses also. My hacked version is so much smaller because it scans and fixes, no chance to pick what to scan, no backing up the files. I do a system restore before hand and that's it, it doesn't work I restore from a restore point.