Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Managed C++/CLI
  4. Pause button.....

Pause button.....

Scheduled Pinned Locked Moved Managed C++/CLI
helpquestiondatabasegraphicsregex
6 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    Thilek
    wrote on last edited by
    #1

    hi guys, i am working on a worm scanner... most of the modules are done... but there is a problem regarding the pause button.. i not sure how to do it... below is my coding :-

    vector files;
    wstring directory =(L"C:\\Windows\\system32");
    if (ListFiles(directory, L"*", files))
    {
    for (vector::iterator it = files.begin(); it != files.end(); ++it)
    {
    keepname = WStringToString(it->c_str());
    searchkmp();
    int index = listBox1->Items->Add(String::Concat(gcnew String(it->c_str())));
    listBox1->SelectedIndex = index;
    count++;
    listBox1->Update();

    	}
    }
    

    when user click on start the program will get the filenames... each time it gets the filename it will call for the string matching function (searchkmp()) to match the for signature... My question is how can i make a pause function in this program ya.. when user click on the pause the program should pause and when user click back on the same button it will continue.... kindly help me ya... regards, Thilek

    L 1 Reply Last reply
    0
    • T Thilek

      hi guys, i am working on a worm scanner... most of the modules are done... but there is a problem regarding the pause button.. i not sure how to do it... below is my coding :-

      vector files;
      wstring directory =(L"C:\\Windows\\system32");
      if (ListFiles(directory, L"*", files))
      {
      for (vector::iterator it = files.begin(); it != files.end(); ++it)
      {
      keepname = WStringToString(it->c_str());
      searchkmp();
      int index = listBox1->Items->Add(String::Concat(gcnew String(it->c_str())));
      listBox1->SelectedIndex = index;
      count++;
      listBox1->Update();

      	}
      }
      

      when user click on start the program will get the filenames... each time it gets the filename it will call for the string matching function (searchkmp()) to match the for signature... My question is how can i make a pause function in this program ya.. when user click on the pause the program should pause and when user click back on the same button it will continue.... kindly help me ya... regards, Thilek

      L Offline
      L Offline
      led mike
      wrote on last edited by
      #2

      I don't see anything in your post indicating a Managed C++/CLI question. kindly help me ya...

      Thilek wrote:

      My question is how can i make a pause function

      Pausing and resuming threads might not seem as straight forward as you might think. It might interest you to know that older .NET frameworks had Thread.Pause/Resume but they were deprecated due to numerous problems (ok mostly user created problems). There are many resources you can read, you might start here[^] Of course you don't actually have to pause/resume the threads because you can build into your system the functionality yourself. Meaning that you would upon your pause event actually stop the threads (gracefully of course) and then restart them on the resume event. This of course requires much work on your part.

      modified on Monday, March 23, 2009 11:59 AM

      T 2 Replies Last reply
      0
      • L led mike

        I don't see anything in your post indicating a Managed C++/CLI question. kindly help me ya...

        Thilek wrote:

        My question is how can i make a pause function

        Pausing and resuming threads might not seem as straight forward as you might think. It might interest you to know that older .NET frameworks had Thread.Pause/Resume but they were deprecated due to numerous problems (ok mostly user created problems). There are many resources you can read, you might start here[^] Of course you don't actually have to pause/resume the threads because you can build into your system the functionality yourself. Meaning that you would upon your pause event actually stop the threads (gracefully of course) and then restart them on the resume event. This of course requires much work on your part.

        modified on Monday, March 23, 2009 11:59 AM

        T Offline
        T Offline
        Thilek
        wrote on last edited by
        #3

        well i am doing this program in .net... the entire program is done in managed C++ but there are some i had to use normal c++ since i am new to managed c++...

        L 1 Reply Last reply
        0
        • T Thilek

          well i am doing this program in .net... the entire program is done in managed C++ but there are some i had to use normal c++ since i am new to managed c++...

          L Offline
          L Offline
          led mike
          wrote on last edited by
          #4

          I yes. I missed the gcnew, among other things, in your first post. My fault.

          1 Reply Last reply
          0
          • L led mike

            I don't see anything in your post indicating a Managed C++/CLI question. kindly help me ya...

            Thilek wrote:

            My question is how can i make a pause function

            Pausing and resuming threads might not seem as straight forward as you might think. It might interest you to know that older .NET frameworks had Thread.Pause/Resume but they were deprecated due to numerous problems (ok mostly user created problems). There are many resources you can read, you might start here[^] Of course you don't actually have to pause/resume the threads because you can build into your system the functionality yourself. Meaning that you would upon your pause event actually stop the threads (gracefully of course) and then restart them on the resume event. This of course requires much work on your part.

            modified on Monday, March 23, 2009 11:59 AM

            T Offline
            T Offline
            Thilek
            wrote on last edited by
            #5

            hm.... how can pause them since when i am running the scan.. the form does not accept any events.... :)

            S 1 Reply Last reply
            0
            • T Thilek

              hm.... how can pause them since when i am running the scan.. the form does not accept any events.... :)

              S Offline
              S Offline
              Sci_fie
              wrote on last edited by
              #6

              Hi, you´ll have to deal with thread. Take a look here, I think this can help you out. http://www.codeproject.com/KB/mcpp/managedsafethreads.aspx[^]

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups