473,320 Members | 1,910 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

'Simple' Kill button/progress bar problem

I'm a n00b to Visual C++ and OOP, but not to programming in general.

Here's the problem: Not knowing what I'm doing, I've made my VC++
application as a CLR Window Forms project. Now, I have a process that
is lauched by pushing a button. The code for this process is inside
the Button_Click event handler for that particular button.

The problem is that I need to be able to kill that process with another
button. I have a global flag that would kick out of that process, and
that flag is changed in the Kill button event handler. But I can't
actually use that button when I need to, because when the process is
running it's still technically inside the event handler for the "Go"
button click.

I've even started a second thread with ThreadPool to house this
process. Now, I can supposedly do what I need, but I can't tell if I
need it because the progressBar that I'm using in my UI can't be used
by the new process thread. If I put code in the main thread to move
the progressBar based on another global variable, I once again can't
use the Kill button because I'm stuck back in the Go Button_Click event
handler.

I've posted this question before and all of the responses that I
recieved utilized message pump - type ways of handling this, but since
I made this with the CLR windows form designer, I don't have access to
that part of the program - CLR hides that all away.

I also can't find a convenient Idle process in the Forms class.

Is there an easy way to accomplish this with the CLR resources? If
not, is there some way to design the UI graphically but then use the
MFC or the Windows API? I'd rather not have to redo my UI in code just
because I can't get the Kill button and progressbar to work at the same
time.

Thanks in advance,

-Cory

Jan 23 '07 #1
1 1704
I've posted this question before and all of the responses that I
recieved utilized message pump - type ways of handling this, but since
I made this with the CLR windows form designer, I don't have access to
that part of the program - CLR hides that all away.
Not at all. You can override the WndProc method in your form.

You can also use Control.Invoke, which .NET probably implements by sending a
message, to allow your worker threads to run snippets of code back in the UI
thread.
Jan 24 '07 #2

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

Similar topics

1
by: elastic | last post by:
I'm trying to implement a simple timer to work on win32 (98,2k,xp), solaris and linux. where the last two are simple, the first seems to be problematic. the problem is that the kill command seems...
0
by: Glen A Stromquist | last post by:
I have a SQL 7 database that won't let me perform a backup as it says there is a backup of the trasaction log currently in progress. I found the offending process and have tried to kill it via sql...
0
by: Markus Poehler | last post by:
Hi my program should run on terminal server. I open Acrobat process and I have to kill them at some points in my application. This fails cause of insufficient rights on terminal server. the...
15
by: tabonni | last post by:
I want to check each button groups and save the checked value into a 2 dimensional array. But, it doesn't work. Could anyone tell me what's wrong with my code. My code is as follow: <html>...
1
by: dixie | last post by:
I am trying to delete the temporary files that MS Word leaves behind sometimes when it fails to clean up properly. Files like ~$lename.dot. I have used the Kill command, but find that this...
10
by: Steve | last post by:
Hi- I had this nice little wizard application running. It was comprised of several Panel controls initially set w/ their visibility off except for the first one, then as you progress through...
2
by: Fabrice | last post by:
Hello, I 'would like to build a system (based on database, not SqlServer but MySQL) to permit only one session per user. I'm using a form athentication. My Solution : --------------- When...
0
by: WATYF | last post by:
This is my problem... I have some code that starts a Process and returns it to a variable... (prcBat) At any time while that process is running... I want to be able to Kill it by pressing a...
3
by: ctbfalcon | last post by:
So I have a progress bar that I would like to be diplayed as the program is working on adding a network printer. I want to do this because while the program is "thinking" the user is not sure if...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.