|
Evidently, there is no easy way to access the same information as that in the applications tab of the task manager the way one can easily access the same information as that in the processes tab. Or, if there is, it isn't obvious to any of us. Instead, I used the method below (resulted from suggestion by Luc Pattyn) to determine whether the IDE simply had the application open or was running it.
Note - non-relevant portions of code omitted (the ...'s).
const string IDE_INDICATOR = ".vshost";
Process current = Process.GetCurrentProcess();
string IDE_Name;
...
if (current.ProcessName.Contains(IDE_INDICATOR))
{
IDE_Name = current.ProcessName;
}
else
{
IDE_Name = current.ProcessName + IDE_INDICATOR;
}
... (looping through all processes)
if (process.ProcessName == IDE_Name)
{
IntPtr WindowHandle = process.MainWindowHandle;
if (WindowHandle != IntPtr.Zero)
{
}
else
{
}
}
|
|
|
|
|
Hello,
I need to pass a command line argument containing a database connection string to the registry.
I pass it to a windows installer exe made with VS2005. I can obtain the string from inside the installer. But if i try to manually insert it, for example in
void ProjectInstaller_Committed(object sender, InstallEventArgs e){...}
i can read the registry but when i try to SetValue, i get an exception. Probably lack of permissions.
Is there any way to do this?
Thanks in advance!
|
|
|
|
|
I need to connect to multiple servers and call their web methods of the webservice. But the problem is - the IP address of those servers will be known to me only in run time and this list may change.
The same web-service will be running in each of these servers except that- they have different IP Addresses.
I accessed web-services from clients by adding the web-services as web-reference(with specifying web url). But in this case- it doesn't seem possible.
Can anyone please give me some ideas about how i can do this?
thanks
Chayan
|
|
|
|
|
Add a reference to one of the services. Once you have created an instance of the generated class, you can change the Url property to make it connect to any of the servers.
---
single minded; short sighted; long gone;
|
|
|
|
|
thanks a lot man !!! this is such a simple and cool solution..thanks for the great help.
Chayan
|
|
|
|
|
C#
How can add two numbers through generic function and the type is int or double or float
anybody help me.
Continue...
|
|
|
|
|
I didn't test it but this should work:
T Add<T>(T x, T y) where T: int, double, float
{
return x+y;
}
"Throughout human history, we have been dependent on machines to survive. Fate, it seems, is not without a sense of irony. " - Morpheus
"Real men use mspaint for writing code and notepad for designing graphics." - Anna-Jayne Metcalfe
|
|
|
|
|
You should have tested it then
'int' is not a valid constraint. A type used as a constraint must be an interface, a non-sealed class or a type parameter.
'double' is not a valid constraint. A type used as a constraint must be an interface, a non-sealed class or a type parameter.
'float' is not a valid constraint. A type used as a constraint must be an interface, a non-sealed class or a type parameter.
Operator '+' cannot be applied to operands of type 'T' and 'T'
only two letters away from being an asset
|
|
|
|
|
Oh, thank you. That was too cool to work
Ok so unless I am missing something obvious it's not as easy as it looks...
IConvertible Add<T>(T x, T y) where T : IConvertible
{
return (IConvertible)(x.ToDouble(CultureInfo.InvariantCulture)+y.ToDouble(CultureInfo.InvariantCulture));
}
Doesn't look that bad, but that's still not it. I don't want to return IConvertible but T, I want T to be only int, float or double (looks like this is impossible with where ).
Whatever, why not do just
int Add(int x, int y){return x+y};
double Add(double x, double y){return x+y};
...
"Throughout human history, we have been dependent on machines to survive. Fate, it seems, is not without a sense of irony. " - Morpheus
"Real men use mspaint for writing code and notepad for designing graphics." - Anna-Jayne Metcalfe
|
|
|
|
|
Thank u for helping me.
I need ur help that code is not working properly.
Give me the full source and ( where) what is the use of that one in generic.
I expect get soon
Continue...
|
|
|
|
|
Unfortunately I was wrong as Mark pointed out.
where doesn't allow specific structs as type constraint. See http://msdn2.microsoft.com/en-us/library/d5x73970(VS.80).aspx[^]. Because int etc. are structures, you can't do this
However, from what you said, it looks like easiest (and sufficient) thing to do is to have 3 overloads of Add(x,y) method - one for int, one for float, etc...
"Throughout human history, we have been dependent on machines to survive. Fate, it seems, is not without a sense of irony. " - Morpheus
"Real men use mspaint for writing code and notepad for designing graphics." - Anna-Jayne Metcalfe
|
|
|
|
|
hi all
how can i use the graphics object of the form to store
its contents as an image
thanks
Generator
|
|
|
|
|
You can't.
Use the DrawToBitmap method of the form, or create an Image and use the Graphics.CopyFromScreen method on a Graphics object for the image.
---
single minded; short sighted; long gone;
|
|
|
|
|
ok
what about if i want to draw in empty image by my self
dawing some images and some shapes
thanx
Generator
|
|
|
|
|
Create a Bitmap object and a Graphics object from it, then draw using the Graphics object.
---
single minded; short sighted; long gone;
|
|
|
|
|
sorry,
but can i have some explanation
i want to draw some objects in image then
save this image in disk
the save is not a problem
thanx
Generator
|
|
|
|
|
hi
Bitmap workSpaceBitmap = new Bitmap(tabctrlMain.SelectedTab.Width, tabctrlMain.SelectedTab.Height);<br />
tabctrlMain.SelectedTab.DrawToBitmap(workSpaceBitmap, tabctrlMain.SelectedTab.Bounds);<br />
workSpaceBitmap.Save("c:\\image.jpeg", ImageFormat.Jpeg);
i write this code and thanx very much for ur help(DrawToBitmap u told me about it) thanx alot
but one question if there is a scroll bar is this code will draw disappeared parts of screen to image or not
Generator
|
|
|
|
|
Hi All..
Can u please help me in displaying parent and child records in a single datagridview. My requirement is like a "+" sign should be there in a grid. On click of that + sign child rows should get displayed. How can i achieve that in windows forms. Please help me in this regard.
If anyone knows the solution, please mail me at shwethak32@yahoo.co.in or reply to this forum
Regards
Shwetha
|
|
|
|
|
I'm looking for a Windows Forms control that acts as a sort of "danger meter." Basically a ProgressBar that gradiates from green (when the "progress" is low) to red (when high). But basically I just can't find the right keywords; everything I search for gives me a totally different type of control.
Any ideas?
-Domenic Denicola- [CPUA 0x1337]
“I was born human. But this was an accident of fate—a condition merely of time and place. I believe it's something we have the power to change…”
|
|
|
|
|
Check out
http://www.codeproject.com/cs/system/CpuUsage.asp[^]
This is a control which monitors CPU usage and shows a progress bar accordignly - like the Task Manager thing.
I'm sure you can adapt the code to be able to monitor whatever you need - changing the color of the control depending on a particular level should be pretty easy....
|
|
|
|
|
|
First of all I see that you have posted this same question on the Windows Forms forum as well - be careful because you'll just annoy people if you do,
As for the issue - check out
http://www.codeproject.com/cpp/rwformulaparser.asp[^]
I did a quick search for "formula" and guess what there's about 50 items on it on here alone. That was one of the items and it seems to be able to do more than you need,
Check that out and then if you have any questions we'll more than happy to help - but you have to put some of the effort in....
|
|
|
|
|
Wow - I just noticed that you asked the same question 5 hours ago.....
Dude - you have to do some of the work here - no-one is going to write all of the code for you - which part are you having the most trouble with?
|
|
|
|
|
iam getting trouble with columns of the table.
so pls dont mistake me.
|
|
|
|
|
Hi guys!
I got a general problem here with UDP multicasts not reaching the server I want to reach.
Perhaps there's a general misconception on my side, perhaps it's just a configuration thing, hope someone can help me out.
I want to create a dynamic service discovery. A client wants to use a service, but doesn't know which server is offering the service.
So I developed a class a service process can use to listen for service discovery requests on a given port and another class for the client to find these services. For this to work I thought I'd use UDP multicasts.
The service joins a multicast group (I've tried 224.0.0.1, 225.0.0.1, 225.1.1.1 and a few more), the client sends a datagram to one of these IP adresses, the service receives the datagram and can reply with an "I'm here" response.
This works fine if I try it within my LAN, but doesn't work if the server and client are located in different subnets. These subnets are connected via a VPN with Zyxel ZyWalls (the ZyWalls are capable of IP multicast according to the specs), yet the packets don't seem to reach the service.
If I don't send the request to a multicast address but use a subnet-specific broadcast or the real target IP, the service gets notified, but that's not what I need - I don't want to make any assumption on the subnet a service is on.
I thought multicast groups were especially designed for such a scenario? According to the documentation I found, members of multicast groups don't have to be part of the same network, so it looks like a routing problem. But unfortunately I don't have any idea what to modify to allow multicast packages to be routed to the other subnets.
Can anyone help?
Thanks in advance,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|