Click here to Skip to main content
15,888,461 members
Home / Discussions / C#
   

C#

 
GeneralRe: Removing leading zeros from negative string Pin
Paw Jershauge13-Apr-10 19:44
Paw Jershauge13-Apr-10 19:44 
GeneralRe: Removing leading zeros from negative string Pin
PIEBALDconsult14-Apr-10 3:15
mvePIEBALDconsult14-Apr-10 3:15 
GeneralRe: Removing leading zeros from negative string Pin
PIEBALDconsult13-Apr-10 13:15
mvePIEBALDconsult13-Apr-10 13:15 
GeneralRe: Removing leading zeros from negative string Pin
Paw Jershauge13-Apr-10 20:28
Paw Jershauge13-Apr-10 20:28 
GeneralRe: Removing leading zeros from negative string Pin
PIEBALDconsult13-Apr-10 13:29
mvePIEBALDconsult13-Apr-10 13:29 
GeneralRe: Removing leading zeros from negative string Pin
Paw Jershauge13-Apr-10 20:33
Paw Jershauge13-Apr-10 20:33 
GeneralRe: Removing leading zeros from negative string Pin
PIEBALDconsult14-Apr-10 3:12
mvePIEBALDconsult14-Apr-10 3:12 
QuestionStopping threads (semi-safely).... Pin
Jacob Dixon12-Apr-10 9:42
Jacob Dixon12-Apr-10 9:42 
I have a little issue and I know you will say that you always make sure the threads close. The problem I have is I spawn 3 threads to check for various information using WMI. The one thread that pulls applications can be time consuming and there really isn't a function to tell WMI to stop once it has started...

So a user selects a computer and tells it to open, when the other form for that specifc computer opens it begins pulling information. Basically I want the user to be able to close the form even if it is not finished. But I don't want it to cause the application to fail or they get a popup just because the thread couldn't write to the handle.

There has to be a way. I mean Windows does it. If you launch a application in debug mode and that application is running multiple threads, then you go to visual studio and tell it to stop debugging everythign quits with no errors!

I am creating the thread like this:
appThread = new Thread(new ThreadStart(GetApplications));
appThread.IsBackground = true;
appThread.Start();


GetApplications:
private void GetApplications()
{
    WMI_Commands wmi = new WMI_Commands(Username, Password,
        System.Management.ImpersonationLevel.Impersonate, System.Management.AuthenticationLevel.Default);

    List<Product> products = wmi.InstalledApplications(NetBios);
    foreach (Product p in products)
    {
        AddApplication(p);
    }

    products = null;

    SetPBVisible("pbapplications", false);
}

AnswerRe: Stopping threads (semi-safely).... Pin
PIEBALDconsult12-Apr-10 9:58
mvePIEBALDconsult12-Apr-10 9:58 
AnswerRe: Stopping threads (semi-safely).... Pin
Dave Kreskowiak12-Apr-10 9:59
mveDave Kreskowiak12-Apr-10 9:59 
GeneralRe: Stopping threads (semi-safely).... Pin
Jacob Dixon12-Apr-10 10:16
Jacob Dixon12-Apr-10 10:16 
GeneralRe: Stopping threads (semi-safely).... Pin
Jacob Dixon12-Apr-10 10:51
Jacob Dixon12-Apr-10 10:51 
GeneralRe: Stopping threads (semi-safely).... Pin
PIEBALDconsult12-Apr-10 13:02
mvePIEBALDconsult12-Apr-10 13:02 
GeneralRe: Stopping threads (semi-safely).... Pin
Jacob Dixon12-Apr-10 13:39
Jacob Dixon12-Apr-10 13:39 
GeneralRe: Stopping threads (semi-safely).... Pin
PIEBALDconsult12-Apr-10 13:51
mvePIEBALDconsult12-Apr-10 13:51 
GeneralRe: Stopping threads (semi-safely).... Pin
Jacob Dixon12-Apr-10 13:58
Jacob Dixon12-Apr-10 13:58 
GeneralRe: Stopping threads (semi-safely).... Pin
PIEBALDconsult12-Apr-10 14:15
mvePIEBALDconsult12-Apr-10 14:15 
GeneralRe: Stopping threads (semi-safely).... Pin
Dave Kreskowiak12-Apr-10 15:33
mveDave Kreskowiak12-Apr-10 15:33 
AnswerRe: Stopping threads (semi-safely).... Pin
William Winner12-Apr-10 10:23
William Winner12-Apr-10 10:23 
GeneralRe: Stopping threads (semi-safely).... Pin
Jacob Dixon12-Apr-10 10:27
Jacob Dixon12-Apr-10 10:27 
GeneralRe: Stopping threads (semi-safely).... Pin
Luc Pattyn12-Apr-10 10:55
sitebuilderLuc Pattyn12-Apr-10 10:55 
GeneralRe: Stopping threads (semi-safely).... Pin
Jacob Dixon12-Apr-10 11:14
Jacob Dixon12-Apr-10 11:14 
GeneralRe: Stopping threads (semi-safely).... Pin
Luc Pattyn12-Apr-10 11:23
sitebuilderLuc Pattyn12-Apr-10 11:23 
GeneralRe: Stopping threads (semi-safely).... Pin
Jacob Dixon12-Apr-10 11:27
Jacob Dixon12-Apr-10 11:27 
GeneralRe: Stopping threads (semi-safely).... Pin
Luc Pattyn12-Apr-10 11:40
sitebuilderLuc Pattyn12-Apr-10 11:40 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.