473,398 Members | 2,403 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,398 software developers and data experts.

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 7483
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Jimmy Johns | last post by:
Hi, I have some classes as follows: #include <iostream> using namespace std; class A { public: virtual A* clone() const = 0; };
4
by: Jamie B | last post by:
Is it possible to use System.Type, Activator or whatever to create a complete "blank", unitialized object of a given type, and then at a later time call a constructor on it. The only caveat is that...
2
by: Charles Law | last post by:
Is there anyway to connect a ProcessThread and a Thread object? When a debug event is notified, I receive a thread ID. I would like to get the name of this thread, but ProcessThread (which is...
10
by: John | last post by:
Trying to find out what is essential / optional, I made an extremely simple Class and Module combination to add two numbers. (see below) It appears that an empty constructor is needed n order to...
7
by: John Grandy | last post by:
My ASP.NET Web Service project has a Web Method that returns an array filled with instances of a custom class. The custom class is defined in a Class Library that is included in the web-service...
70
by: garyusenet | last post by:
I'm using an example piece of code: - namespace Wintellect.Interop.Sound{ using System; using System.Runtime.InteropServices; using System.ComponentModel; sealed class Sound{ public static...
7
by: =?iso-8859-1?Q?S=F8ren_M._Olesen?= | last post by:
Hi How do I pass a complex type to a webservice?? What I have is a Class 'MyComplexClass' which lives in it's own dll/namespace. I'd like to pass this class to my webmethod: <WebMethod()_...
21
by: Michael Hull | last post by:
Hi, I remember from somewhere reading that inlining constructors is a 'BadThing', but now can't seem to find the original source. I can't however thing of a reason why it would be for simple...
1
by: lesani | last post by:
hi, i want to find out stacktrace of a thread that is only have its thread id (which have created in vc++ project), i can find processthread by searching in ids of...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.