|
Actually, you can use any application and then use the ServiceController to reference and start your service. This allows you time to attach to a process (or start the process that starts your service) so that you can debug the service all the way from OnStart . If you don't do it this way, all you can do is attach to a running process (your service). By the time the process has started, OnStart has already been called. That's the reason for a separate process to start the service.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi,
This a doubt regarding a service written in C#. I have a service, (developed by some one else), and I modified the dll of the service. Now, the service starts and stops. Is it correct to do the modifications directly in the dll code. Mean to say, will it be any problem with registration kind of thing.
Please clarify my doubt.
Regards,
Satya
|
|
|
|
|
That greatly depends. If the checksum of the PE/COFF executable was no updated, the SCM (service control manager) or even the executable loader may find that the executable is invalid and won't load and execute it.
Make the modifications to the source if you have it, and reinstall the service. You could alternatively export the IL, change it, and reassemble it.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
How to convert a SVG Path string to .NET System.Drawing.Drawing2D.GraphicsPath ?
Who can tell me where can I find the source?
|
|
|
|
|
I don't know of any source for this myself, although it wouldn't be all that hard to write. If you find code for this, I'd be interested. I've been wanting to do this in a utility I'm writing, but haven't had time to work on it recently.
"A people that values its privileges above its principles soon loses both." -- Dwight D. Eisenhower
|
|
|
|
|
i am catching WM_ messages from my form and monitoring for WM_POWERBROADCAST messages which are dispatched when windows goes to sleep (thanks for the suggestions, Heath). but the problem is windows doesn't seem to make any distinction between STANDBY and HIBERNATE. when i place my computer in either standby or hibernate mode, both WM_POWERBROADCASTs are identical (ie, WPARAM values are equal, LPARAM are both 0). the SystemEvent class in .NET also has no distinction (either resume or suspend modes). i even analyzed ALL windows messages sent around the time the WM_POWERBROADCASTS are sent and tried to see if there are any unique windows messages sent just prior to or after the WM_POWERBROADCASTs to see if i could distinguish based on what other messages are sent. no luck there either.
am i basically just out of luck if i want to know whether my system is going into either standby or hibernate?
thanks!
|
|
|
|
|
This might get slightly ugly, however what you may need to do is look at the DEVICE_CAPABILITIES[^] returned from a IRP_MN_QUERY_CAPABILITIES[^] request. Specifically you will want to look at the SystemWake of the DEVICE_CAPABILITIES . Native code or at least MC++ would make things much easier on your end.
- Nick Parker My Blog | My Articles
|
|
|
|
|
Hi all,
I'm working on a method that parses through a html source file, and puts coldfusion comments around script tags. My problem is that the String.Input method is not working with the line read from my streamreader. When using the debugger, it hits the .Input(index, string) line, but it does actually change my string. I think this is because the line is in a stream, but I'm not sure. I know there is a programmatically simple workaround for this, but I haven't done it in so long that I can't remember. Suggestions please - my code is as follows:
private void outputnoscript(StreamReader reader, StreamWriter writer)
{
string line = "";
int opencounter = 0;
int closecounter = 0;
while(line!=null)
{
line = reader.ReadLine();
if (line!=null)
{
MatchCollection opencollection = Regex.Matches(line, "<script",RegexOptions.IgnoreCase);
for (int i = 0; i < opencollection.Count; i++)
{
Match openmatch = opencollection[i];
line.Insert(openmatch.Index + opencounter, "<!---");
opencounter += 5;
}
MatchCollection closecollection = Regex.Matches(line, "/script>", RegexOptions.IgnoreCase);
for (int i = 0; i < closecollection.Count; i++)
{
Match closematch = closecollection[i];
line.Insert(closematch.Index + 8 + closecounter, "--->");
closecounter += 4;
}
writer.WriteLine(line);
}
}
}
|
|
|
|
|
There is no Input member of the String class, but looking at your code I assume you mean Insert .
Strings are immutable. Performing an operation on a string does not change the string itself, but changes a copy of the string and returns it. So, either use something like string s = line.Insert(...) and write that using writer.WriteLine , or use a StringBuilder which is a mutable string.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Is it just me or did Microsoft leave out a nice feature like allowing datagrid hyperlink columns for Windows Forms projects??? It's easy to do in ASP........
I've looked all over for someone who has succeeded to create a dataGrid.dataColumn hyperlink. I'm not using a database, just importing a firewall.txt file and sorting the IP's looking for duplicate access attempts. The idea is to simply click on the questionable IP and jump to arin.net for a quick look, however............ help......
|
|
|
|
|
Actually, MS left out more than hyperlinks in their datagrids.
What you can do, is derive a hyperlink column class from the DataGridTextBoxColumn and put a hyperlink control in it, override some events and voila, you have yourself a hyperlink column.
Here's an example on how to create a combobox column[^]. Just substitute it with a hyperlink control.
"if you vote me down, I shall become more powerful than you can possibly imagine" - Michael P. Butler.
|
|
|
|
|
Ok, I'm sure there's an easy answer to this... I just can't figure this out? DUH..
I have a main application (form) that brings up a different form. What I want to do, is to detect ANY click while this new form is up. If the click is OUTSIDE the bounds of this form, I want to perform some action (such as closing the form). Any ideas?
|
|
|
|
|
If you're just wanting to monitor mouse messages for a short period of time (such as for a popup/menu), you can set the form's Capture property to true . This will redirect all mouse messages to your window. After the first click outside of your window, the mouse capture will be released and you won't get any more mouse messages from outside your form.
Other windows, including child windows on your form, will not recieve any mouse messages while your form has the mouse capture. If you need child windows to recieve mouse messages, release the capture when the mouse moves within your form's bounds.
Note that it is bad practice to capture the mouse for more than just a brief period/operation, as the mouse pointer is a shared system resource.
"A people that values its privileges above its principles soon loses both." -- Dwight D. Eisenhower
|
|
|
|
|
Well, a maybe simpler way could be to add an event handler for the Leave or Deactivate event.
The moment the user clicks outside your form it's losing focus and this event can be caught and handled.
But you have to remember that when you close the form yourself then these events are generated as well IIRC.
And that switching the window by using Alt-TAB for example also triggers this event, not just mouse clicks.
Regards,
mav
|
|
|
|
|
At least you have a decent user name
|
|
|
|
|
When my screensaver is running, I want to wake it up after a short period of time,
how can I do that?
Thanks..
|
|
|
|
|
If your application uses a message queue (i.e., a Windows Forms application), you can use SendKeys.Send("+") , otherwise use SendKeys.SendWait("+") (which you could also use in a Windows Forms application if you'd like). This sends a message for the SHIFT key, a safe key to wake-up the machine (and stop the screensaver, unless the particular screensaver doesn't simply quit with certain key strokes or mouse movement).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
After your Timer has run, call this.Close(); . Your question is rather open ended however you will simply need to end the execution.
- Nick Parker My Blog | My Articles
|
|
|
|
|
Ok got a big problem. I have a brand new machine..i.e I rebuilt it and now I want to run a web project that references some C++ assemblies and some C# assemblies. I have done everything by the book but I keep getting the same error:
Parser Error Message: File or assembly name Core.Data.TM1, or one of its dependencies, was not found.
With the trace as follows:
=== Pre-bind state information ===
LOG: DisplayName = Core.Data.TM1
(Partial)
LOG: Appbase = file:///c:/inetpub/wwwroot/TMJTester
LOG: Initial PrivatePath = bin
Calling assembly : (Unknown).
===
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Post-policy reference: Core.Data.TM1
LOG: Attempting download of new URL file:///C:/WINDOWS/Microsoft.NET/Framework/v1.1.4322/Temporary ASP.NET Files/tmjtester/51fb5434/c4dfe5c7/Core.Data.TM1.DLL.
LOG: Attempting download of new URL file:///C:/WINDOWS/Microsoft.NET/Framework/v1.1.4322/Temporary ASP.NET Files/tmjtester/51fb5434/c4dfe5c7/Core.Data.TM1/Core.Data.TM1.DLL.
LOG: Attempting download of new URL file:///c:/inetpub/wwwroot/TMJTester/bin/Core.Data.TM1.DLL.
LOG: Publisher policy file is not found.
LOG: No redirect found in host configuration file (C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\aspnet.config).
LOG: Using machine configuration file from C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\config\machine.config.
LOG: Post-policy reference: Core.Data.TM1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=4c3e63d723dc8458
___________________________________________________________
this seems like it is a circular reference issue...cannot be sure though. Any suggestions on how to figure out where the problem might be ?
Thanks
Sameer
|
|
|
|
|
sameer handa wrote:
I have done everything by the book but I keep getting the same error
And what book is that? Make sure that your assemblies are strongly named, and it's best to intall them into the GAC. There are known problems with using signed files in the private path (bin sub-directory by default for ASP.NET). The .NET service pack documentation claims this is by design, however.
If you need additional help, please be specific about how you have set up your ASP.NET Web Application. I.e., where are your assemblies (remember that the PATH environment variable matters not) and are they strongly named?
The fusion log above just states that an assembly cannot be found so it is searching for redirects and in common locations. All that means is that the assembly cannot be found.
Believe - when developed and deployed correctly (i.e., typically into the GAC) .NET assemblies do end DLL hell. I recommend you read the section How the Runtime Locates Assemblies[^] in the .NET Framework SDK - the only "book" I ever follow.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Thanks in part to your verbal smackdown I was inspired to read the SDK last night. Sometimes...reading the big C# book is not the same as reading the SDK.
Anyway I think I am close to finding the problem.....The problem is that in the Temporary ASP.NET Files directory there is a file being created called
__AssemblyInfo__.ini which has "wrong" information i.e it has the wrong
PublicKeyToken=4c3e63d723dc8458. Not quite sure where it is getting this information and I say this simply because it is my 3rd day here and I am not that familar with the code and set up yet.
So if yuo have any ideas on where I could start may be good.
|
|
|
|
|
I'm sorry you view it as a "verbal smackdown" - it wasn't intended as such.
Make sure the correct assembly is installed into the GAC. If your putting signed assemblies into the bin sub-directory (it works, but you may have problems when the AppDomain is recreated due to changes in the web application). This is done for you automatically if you add references to other assemblies (besides those already in the GAC, or those with "Copy Local" set to "True") or projects in your solution.
I also recommend you shutdown the web site(s), clear the Temporary ASP.NET Files" directory, and restart the web site(s). This should recreate all information once you have everything in place correctly as I described above.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I have 2 questions, and answering either will easily solve a problem.
The first, where might I find the lovely bitmaps and such that Microsoft uses in their operating system so that I can use these same ones in my application? Particularly, the arrow button that you see at the ends of slider bars and combo boxes.
~OR~
If I have a combobox with nothing in its list, and I click the dropdown button, how can I prevent the list from showing one blank line?
Either answer will help! Thanks a bunch.
- D
|
|
|
|
|
See the ControlPaint.DrawComboButton method in the .NET Framework SDK for one option. Otherwise, you'll need to include bitmaps yourself, either embedding them into a ResX file (using an ImageList in the designer does this for you, which base64-encodes it) or embed them as manifest resources by adding them to your project and changing the build action to "Embedded Resource". You can access these bitmaps (which I use generically for pixel map images) using Assembly.GetManifestResourceStream or some methods on the Image and Bitmap classes allow you to specify a manifest resource from which an Image or Bitmap (derivative of Image ) is created.
It's important to understand that most of the Windows Forms controls are not implement in .NET, per se. They encapsulate the Windows Common Controls, so it's the native window classes that are being used and which take care of drawing themselves (for the most part).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I like the ControlPaint.DrawComboButton method, however, why doesn't the OnPaint handler fire in a class inherited from a TextBox?
If I change the base class to Label, or another control, the OnPaint handler fires, but not with TextBox...any ideas?
|
|
|
|