|
how can i change the background color of console window
not only of text area but of hole background when we run the app.
AMit Katiyar
|
|
|
|
|
If your using .NET 2.0, all this has been made very easy for you. eg:
<br />
Console.BackgroundColor = ConsoleColor.Blue;<br />
Console.Clear();<br />
If not, then its down the old InterOp path I'm afraid.
Regards,
Rob Philpott.
|
|
|
|
|
|
Hello there,
I'm having a problem using XMLConvert.ToDateTime(str) when str = "2005-07-13T11:12:00Z". But it works when the last character 'Z' is removed from the string. What could be a work around for this? I know we can't just remove 'Z' since it denotes that the time is in GMT and not in local time.
Thanks!
~Rafferty
|
|
|
|
|
Hey,
Off the top of my head (better solution probably exists) - why don't you replace the Z of present with ' +00:00' and try that?
Regards,
Rob Philpott.
|
|
|
|
|
That won't work, Z represents the time to be in GMT time. so if I add +00:00, the xmlconvert class may think that the time is in local time which will give me wrong time values
|
|
|
|
|
Not so,
You can either express a date using the Z to denote UTC time (same as GMT), or you can use local time and specify the timezone. By using " +00:00" you are using the local time in Greenwich which also happens to be GMT.
Take a look at http://www.w3.org/TR/NOTE-datetime[^]
Regards,
Rob Philpott.
|
|
|
|
|
Hi,
I had to create Windows Service Application for my project. I have a client-server application. The server application, is a form with a button, and on click of it the server starts. So i need to convert this application to 'windows service'. I went through MSDN, and created a service. In the 'OnStart' method, u need to write the code which will run the application, so i wrote the 'code which was in the buttonClick event' of the form...
the service was created and installed, but when i 'started the service', i got this errror :
"The Service1 service on your Lcal Cmputer started and then stopped. Some services stop automaically, if they have no work to do, for example, the Performance Logs and Alert services."
Please do tell me what to do.....
|
|
|
|
|
1. You need to construct a loop in thread somewhere, else the program will just quit.
2. Im not 100% sure, but you are trying to use UI code in a service. .NET services dont interact with the desktop.
xacc.ide-0.1 released! Download and screenshots
|
|
|
|
|
Hi everyone,
I need some help and would appreciate any constructive ideas. I've never done anything like this before and I don't know where to begin. I have a program running on my computer that reads my current IP address from a config file. Unfortunately, the program only reads the config file at startup - it never checks it again. The problem is that my IP address changes, and the program is completely unaware of it. (and I'm not always available to restart the service) I've been back and forth with the author, throwing ideas at him. (he hasn't released the source and doesn't plan on updating the program) His last email was revealing though, he mentioned that the IP address is checked (where it's stored in memory) at intervals of 1 minute. He also suggested that I could write a program to replace the IP address in memory with the current address.
I don't even know where to begin. I haven't received more information then that. Hopefully the author will help, but I can't exactly rely on that and wanted to get started with something.
My experience is probably beginner level C#. I've written several windows forms, some pocket pc applications, and some asp.net stuff. I'm working on my first directx game.
here's what I believe I need to do:
- find running programs and identify the one i need
- dump everything that the program has in memory
- search for the area that matches my old ip address
- write a program that compares ip addresses and if needed, replaces the old address with the new one.
- wrap this into a service (be fine if this was a windows form for now - there's a couple of excellent articles on writing the service)
Where do I start? I've learned most of my C# from example so I'm missing the formal background that many people have. Can someone recommend an article/example (C# preferred) that is even remotely related. That would really help!
Thanks so much!
Emi ^_^
|
|
|
|
|
Yikes. Good luck.
I think this is going to be a non-starter. Programs run in processes, and processes are isolated from each other in a protected Operating System such as Windows to prevent exactly the thing you are trying to do.
As for the program, why would it load the IP address once at start up and then check its in memory copy once a minute - most strange.
Also out of curiosity, why does your IP address change?
Regards,
Rob Philpott.
|
|
|
|
|
Yeah, I had a feeling this was going to be interesting, but I really don't have any alternative if the author refuses to help.
The program is a server that when started retrieves the IP address you've configured in a settings file. (this is the last known ip address) It then updates a master server with sed ip address so that clients can connect to it. The server was originally meant to run as a windows form and has a textbox for entry of the ip address. Once that field changes - the master server *should* be updated. (or perhaps the server needs to be restarted - not sure of the details)
Anway, I have this program running as a service so there isn't a UI to interact with. This solution has worked great - until we moved recently and changed ISPs. This one is horrible - my IP changes sporatically somtimes twice a day, sometimes a couple of days. The problem I'm trying to solve is that the server is still running and listed in the master server. Of course, the IP has changed and anyone trying to connect can't. There's no notification to the clients why this failed either.
Whew. complicated huh? I don't have any alternative as I want to continue to run the server here. I also can't afford a static IP
So, I figured I'd try to tackle this one small problem at a time.
First question: How can I get a list of all programs currently running. I know the exe name - is that enough to identify the process?
Thanks!
Emi ^_^
|
|
|
|
|
Hmm. What an utterly grim situation you are in.
I can guarantee you won't be able to access a seperate process' memory. Each process has its own address space which is mapped into a different area of physical memory. This is done so that a rogue pointer in one process couldn't harm the memory of another process - if you go out your own process space an exception is thrown.
Perhaps one solution could be to programmatically stop the service and restart it when the IP changes - something to think about.
I would certianly consider changing ISPs as well - that's plain madness having an IP address change so frequently - presumably some bizarre DHCP lease time.
The only other thing which springs to mind is if you could replace the IP address with a hostname then use a dynamic dns service to make sure that you have a domain name which always points to your server. Have a look at http://www.dyndns.com/[^] if you're unfamiliar with this.
Best of luck!
Regards,
Rob Philpott.
-- modified at 12:08 Thursday 1st December, 2005
One other thought - get a packet sniffer and establish the form of the message sent by the server. Perhaps you could write a service to replicate this and take that part of functionality away from the server.
|
|
|
|
|
This may seem silly, but instead of trying to jump through these hoops (good luck solving this problem!! )
... why not just call the ISP and see if they can arrange a permanent IP for you? If not, I'd seriously begin looking for a more stable ISP.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Okay so CollectionBase has a built in ArrayList. So collection creation is quick and easy
an IList doesn't, becuase well its an interface.
But, it's much lighter and IList can easily contain a ArrayList
Which would be recommended. CollectionBase is bulky but has all the housing.
Which do you use and why.
I'm not an expert yet, but I play one at work. Yeah and here too.
|
|
|
|
|
Ista wrote: Okay so CollectionBase has a built in ArrayList. So collection creation is quick and easy
an IList doesn't, because well its an interface.
But, it's much lighter and IList can easily contain a ArrayList
Which would be recommended. CollectionBase is bulky but has all the housing.
The main advantage to inheriting from IList or one of the other collection interfaces (I prefer IEnumerable myself) is that your object can take its proper place in your object hierarchy. Since you can't do multiple inheritance, if your class extends CollectionBase you get a lot of "free" functionality, but you can't extend any other base class.
It's not that much extra code to implement the interface, you can throw in an indexer property to get your ArrayList -like accessor behaviour, and you get a lot more flexibility in the long run.
Just my 2 cents. Share and enjoy.
Sean
|
|
|
|
|
Hello Everyone. I was wondering is there a way to make a CONTROL static like this:
<br />
public static System.Web.UI.WebControls.Label errorlabel = new Label();<br />
<br />
I tried that but I got an error message when the program ran. My problem is that label, errorlabel should contain an error message on it, but if I click a certain button, and then I click back, the errorLabel does not get set back to "" because it does not go to the Page_Load when you click back. So instead the error message again pops back up when you click back and I dont want that to happen. What I was trying to do was when I go to the next page, since it would be accessable to the that page since it's static, to change it there to the empty string.
So if anyone can help, I would really appreciate it.
Thanks,
TheMajorRager
|
|
|
|
|
TheMajorRager wrote: My problem is that label, errorlabel should contain an error message on it, but if I click a certain button, and then I click back, the errorLabel does not get set back to "" because it does not go to the Page_Load when you click back
This is ASP.NET ? It won't work. Your control is recreated on every post back, no matter what. You need to store the text in viewstate, and restore it, assuming the control is incapable of doing this for you.
TheMajorRager wrote: What I was trying to do was when I go to the next page, since it would be accessable to the that page since it's static, to change it there to the empty string.
When you move to another page, all contact with the class instance that was running the last page is lost. You have to remember in ASP.NET, you don't get one class instance for the page, you get one every time the page is rendered, which is brand new, unless it's a postback, and then it is still brand new, but can repopulate some fields from viewstate.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
How does one get the little grabber at the extreme left of a ToolBar to show? I'm designing dockable toolbars that can also be moved by the user and that visual clue would be a nice touch.
Thanks!
-- modified at 19:53 Wednesday 30th November, 2005
|
|
|
|
|
You have to draw this yourself. Here is some sample code to do this:
<br />
Win32Lib.RECT rc = new Win32Lib.Rect();<br />
<br />
rc.left = this.Left;<br />
rc.right = this.Left + this.Width;<br />
rc.bottom = this.Top + this.Height;<br />
rc.top = this.Top;<br />
<br />
if(DockStyle != DockStyle.Right && DockStyle != DockStyle.Left) <br />
{<br />
rc.left = 1;<br />
rc.right = 1 + 3;<br />
} <br />
else <br />
{<br />
rc.top = 1;<br />
rc.bottom = 1 + 3;<br />
}<br />
<br />
Win32Lib.DrawEdge( hDC, ref rc, Win32Lib.BDR_RAISEDINNER, Win32Lib.BF_RECT );<br />
Note that this calls the Windows API using Interop to do this. This gives you the gripper that you see in VC++ 6.0, There are other ways to do this, this is just an example.
Human beings were not meant to sit in little cubicles staring at computer screens all day, filling out useless forms and listening to eight different bosses drone on about about mission statements. -- Peter Gibbons
|
|
|
|
|
Thanks for your reply, Andy.
Does this require additional references? I don't see the Win32Lib in Visual C#.
I'm using VS 2003, FYI.
What other ways would you suggest to get the gripper?
|
|
|
|
|
This is a wrapper library around the Win32 API that I created. I am using interop to make calls to the native API. This like on MSDN tells you about this function. You have to use DllImport and define the appropriate constants in your own code. If you are not sure how to interop with native libraries there are lots of articles here that explain this.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/pantdraw_6aat.asp[^]
I hope this helps.
Human beings were not meant to sit in little cubicles staring at computer screens all day, filling out useless forms and listening to eight different bosses drone on about about mission statements. -- Peter Gibbons
|
|
|
|
|
I am looking for ways to write text along a bezier curve but I haven't found any, is there anyone who has done this and possibly give me some ideas on how to achieve this or point me in the right direction.
I have so far figured out how to get the points along the curve (I know how to calculate the pts using a formula, could not find an API in GDI+ that could give me this) but writing text along the curve involves more since the text itself must be rotated to get the right effect.
Thanks
Bhanu
|
|
|
|
|
I need to incorporate a Query By Example Grid in my application, something along the lines of those used in MS Access where the user can enter the criteria in a grid and an SQL statement is generated depending upon that grid.
Before I start on the process does anyone know if such aleady exists - seaching Codeproject for "QBE" found no results
Thanks
|
|
|
|
|
I'm working on a dockable forms/controls project. How does one get that "pin"-like icon to be displayed on a dockable MDI form / control? I'm talking about the icon immendiately to the left of the "X", in the top right corner of, say, the Soultion Explorer window, Properties window, etc.
|
|
|
|