Pause button.....
-
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
-
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
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
-
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
-
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++...
-
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
-
hm.... how can pause them since when i am running the scan.. the form does not accept any events.... :)