I am completely baffled. I am writting a daemon application for my
work to save me some time. The application works fine at my home but
won't work right here at work. Basically I have a MainForm what has a
Start/Stop button that starts and stops the processing thread.
private void StartButton_Cli ck(object sender, System.EventArg s e)
{
if( bStopSignal )
{
// disable controls that aren't valid when running
StartButton.Ena bled = false;
Issue12CheckBox .Enabled = false;
Issue28CheckBox .Enabled = false;
Issue29CheckBox .Enabled = false;
// enable controls that are valid when running
StopButton.Enab led = true;
// start the processing thread
bStopSignal = false;
MessageBox.Show ( "Starting Processing Thread" );
(pProcessingThr ead = new Thread( new ThreadStart( ThreadProc )
)).Start();
}
}
private void StopButton_Clic k(object sender, System.EventArg s e)
{
// enable controls that are valid when stopped
StartButton.Ena bled = true;
Issue12CheckBox .Enabled = true;
Issue28CheckBox .Enabled = true;
Issue29CheckBox .Enabled = true;
// disable controls that aren't valid when stopped
StopButton.Enab led = false;
// stop the processing thread
bStopSignal = true;
if( pProcessingThre ad != null )
{
MessageBox.Show ( "Stopping Processing Thread" );
pProcessingThre ad.Join();
pProcessingThre ad = null;
}
}
private void ThreadProc()
{
MessageBox.Show ( "Please browse to the issue viewer base URL to
start" );
// temporary code because I am lazy
pWebBrowser.Sho w(); pWebBrowser.Bri ngToFront();
pWebBrowser.Doc umentComplete.R eset();
pWebBrowser.Doc umentComplete.W aitOne();
string starturl = pWebBrowser.Doc ument.url;
string member = null;
while( !bStopSignal )
{
}
}
The above are the 3 important functions, the ThreadProc has been
trimmed of the logic in the while block, otherwise no difference from
my code.
When I click the start button I get the message box stating it is
starting the thread but don't get the message from the ThreadProc
function. Stop gives a message that it is stopping. It isn't starting
the thread like it should.
I am wondering if anyone can give me any feedback on possible cause. I
am wondering if I don't have access rights on my computer to start a
thread? Is this possible, if so would the program execute without
informing me it can't start the thread?
Keep in mind I can't debug it here at work because I don't have a
debugger and can't install a debugger.
work to save me some time. The application works fine at my home but
won't work right here at work. Basically I have a MainForm what has a
Start/Stop button that starts and stops the processing thread.
private void StartButton_Cli ck(object sender, System.EventArg s e)
{
if( bStopSignal )
{
// disable controls that aren't valid when running
StartButton.Ena bled = false;
Issue12CheckBox .Enabled = false;
Issue28CheckBox .Enabled = false;
Issue29CheckBox .Enabled = false;
// enable controls that are valid when running
StopButton.Enab led = true;
// start the processing thread
bStopSignal = false;
MessageBox.Show ( "Starting Processing Thread" );
(pProcessingThr ead = new Thread( new ThreadStart( ThreadProc )
)).Start();
}
}
private void StopButton_Clic k(object sender, System.EventArg s e)
{
// enable controls that are valid when stopped
StartButton.Ena bled = true;
Issue12CheckBox .Enabled = true;
Issue28CheckBox .Enabled = true;
Issue29CheckBox .Enabled = true;
// disable controls that aren't valid when stopped
StopButton.Enab led = false;
// stop the processing thread
bStopSignal = true;
if( pProcessingThre ad != null )
{
MessageBox.Show ( "Stopping Processing Thread" );
pProcessingThre ad.Join();
pProcessingThre ad = null;
}
}
private void ThreadProc()
{
MessageBox.Show ( "Please browse to the issue viewer base URL to
start" );
// temporary code because I am lazy
pWebBrowser.Sho w(); pWebBrowser.Bri ngToFront();
pWebBrowser.Doc umentComplete.R eset();
pWebBrowser.Doc umentComplete.W aitOne();
string starturl = pWebBrowser.Doc ument.url;
string member = null;
while( !bStopSignal )
{
}
}
The above are the 3 important functions, the ThreadProc has been
trimmed of the logic in the while block, otherwise no difference from
my code.
When I click the start button I get the message box stating it is
starting the thread but don't get the message from the ThreadProc
function. Stop gives a message that it is stopping. It isn't starting
the thread like it should.
I am wondering if anyone can give me any feedback on possible cause. I
am wondering if I don't have access rights on my computer to start a
thread? Is this possible, if so would the program execute without
informing me it can't start the thread?
Keep in mind I can't debug it here at work because I don't have a
debugger and can't install a debugger.
Comment