By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,312 Members | 1,806 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,312 IT Pros & Developers. It's quick & easy.

type ProcessThread has no constructors defined

P: n/a
I'm trying to inherit from System.Diagnostics.ProcessThread but I keep
getting the same error no matter what I try:The namespace 'CSRSystem'
already contains a definition for 'Program'

None of these pieces of code work:

using System.Diagnostics;
namespace CSRSystem {
class Program : ProcessThread{
}
}

using System.Diagnostics;
namespace CSRSystem {
class Program : ProcessThread{
Program() { }
}
}

using System.Diagnostics;
namespace CSRSystem {
class Program : ProcessThread{
Program() : base() { }
}
}

I can't understand why the first one doesn't work. It's a public class,
there's nothing in the documentation about not being allowed to inherit
from it. I'm trying to get at the protected events member of this
class, hoping it will give me what I'm looking for.

Maybe there's a better solution to my problem. I'm trying to respond to
a button click. The problem is that the button click is happening in
another program that I didn't write, and don't have the source code
for. Any solutions for the inheritance problem or the button click
problem on a whole?

Feb 14 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
MegaGreg wrote:
I'm trying to inherit from System.Diagnostics.ProcessThread but I keep
getting the same error no matter what I try The namespace 'CSRSystem'
already contains a definition for 'Program'
Well, that in itself is because you've got two different types called
CSRSystem.Program, and it has nothing to do with the constructors.

However, you're not going to be able to derive from ProcessThread, due
to it not having any public or protected constructors.
I can't understand why the first one doesn't work. It's a public class,
there's nothing in the documentation about not being allowed to inherit
from it. I'm trying to get at the protected events member of this
class, hoping it will give me what I'm looking for.
Whenever you want to derive from a class just to get at its protected
members (rather than to really change its behaviour) you should get
worried - chances are your design is flawed.
Maybe there's a better solution to my problem. I'm trying to respond to
a button click. The problem is that the button click is happening in
another program that I didn't write, and don't have the source code
for. Any solutions for the inheritance problem or the button click
problem on a whole?


I don't think ProcessThread would help you anyway - but I think you'll
have to delve deep into Win32 stuff to be able to respond to another
process' Windows events.

Jon

Feb 14 '06 #2

P: n/a
MegaGreg,

You cannot inherit from this class. It is not sealed, but it has a internal
constructor. I've no idea why this class inherits from Component, it is not
a component at all.

Anyways even if you could I don't think you can use to achieve your goals.

What do you expect to get from its Events? You want find event for clicking
on a button.

I don't quite understand your problem. Do you have a running application and
you want to respond to a button click in this application from another
application?
--

Stoitcho Goutsev (100)
"MegaGreg" <gr***********@gmail.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
I'm trying to inherit from System.Diagnostics.ProcessThread but I keep
getting the same error no matter what I try:The namespace 'CSRSystem'
already contains a definition for 'Program'

None of these pieces of code work:

using System.Diagnostics;
namespace CSRSystem {
class Program : ProcessThread{
}
}

using System.Diagnostics;
namespace CSRSystem {
class Program : ProcessThread{
Program() { }
}
}

using System.Diagnostics;
namespace CSRSystem {
class Program : ProcessThread{
Program() : base() { }
}
}

I can't understand why the first one doesn't work. It's a public class,
there's nothing in the documentation about not being allowed to inherit
from it. I'm trying to get at the protected events member of this
class, hoping it will give me what I'm looking for.

Maybe there's a better solution to my problem. I'm trying to respond to
a button click. The problem is that the button click is happening in
another program that I didn't write, and don't have the source code
for. Any solutions for the inheritance problem or the button click
problem on a whole?

Feb 14 '06 #3

P: n/a
Woops, that was the wrong error message. I don't know how that ever got
there, but you got it anyway that I was having a problem with there
being no constructors in ProcessThread. I'm in the process of delving
into the win32 stuff right now. This makes me wonder if there's an
aspect weaver out there somewhere for C# that crosscuts at events...
As it turns out http://www.codeproject.com/csharp/popupkiller.asp has
what I was looking for.

Feb 15 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.