469,362 Members | 2,285 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,362 developers. It's quick & easy.

type ProcessThread has no constructors defined

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
3 7311
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
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
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.

Similar topics

4 posts views Thread by Jimmy Johns | last post: by
70 posts views Thread by garyusenet | last post: by
7 posts views Thread by =?iso-8859-1?Q?S=F8ren_M._Olesen?= | last post: by
21 posts views Thread by Michael Hull | last post: by
1 post views Thread by lesani | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.