|
You can set the path to the defragger under the following registry key:
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\DefragPath
The default value specifies the path and usually defaults to %systemroot%\system32\dfrg.msc %c:
You can see how Windows registers it's defragger in the file C:\Windows\Inf\dfrg.inf
Take care,
Tom
-----------------------------------------------
Check out my blog at http://tjoe.wordpress.com
|
|
|
|
|
Hi,
Thanks Tom, much appreciated.
Andrew.
|
|
|
|
|
Can someone help me understand why sr is being viewed as a local variable to the if statement in the finally clause.
the exact error I'm receiving is: "Use of unassigned local variable 'sr'"
As I said, everything is fine until the finally clause.
Thanks for the help!
ArrayList files;
StreamReader sr;
try {
sr = new StreamReader(args[0]);
do {
files.Add(sr.ReadLine());
} while (sr.Peek() > 0);
}
catch (Exception ex) {
MessageBox.Show(ApplaunchErr + "reading the .cfg file!\n" + AppClosing, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
Application.Exit();
}
finally {
if(!(sr == null))
sr.Close();
}
"In the middle of difficulty lies opportunity." Albert Einstein
|
|
|
|
|
You need to explicitly set it to null and create a new instance of the ArrayList like so:
ArrayList files = new ArrayList();
StreamReader sr = null;
Take care,
Tom
-----------------------------------------------
Check out my blog at http://tjoe.wordpress.com
|
|
|
|
|
Payrok wrote: Can someone help me understand why sr is being viewed as a local variable to the if statement in the finally clause.
It's not.
Payrok wrote: the exact error I'm receiving is: "Use of unassigned local variable 'sr'"
That's because the code preceding that statement doesn't guarantee that the variable has been assigned a value. If the creation of the StreamReader causes an exception, the code will exit the try block before any value has been assigned to the variable.
---
"Anything that is in the world when you're born is normal and ordinary and is just a natural part of the way the world works. Anything that's invented between when you're fifteen and thirty-five is new and exciting and revolutionary and you can probably get a career in it. Anything invented after you're thirty-five is against the natural order of things."
-- Douglas Adams
|
|
|
|
|
I'm not going to comment on the problem because you have already received two perfectly good answers. I do have a question though. Why do you not use if (sr != null) instead of if (!(sr == null)) ? The first is more readable.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Thanks for bringing that to my attention. There's a good reason for it actually, and it's because I do a lot more VB.Net development than C#. I'm more used to having to do stupid things like: if Not sr is nothing then ... end if
So it affects the way I structure things in C#. Thanks for the replies, I never realized I had to set an object to null like that to keep it in scope.
"In the middle of difficulty lies opportunity." Albert Einstein
|
|
|
|
|
The variable is not out of scope, it just was not initialized.
Take care,
Tom
-----------------------------------------------
Check out my blog at http://tjoe.wordpress.com
|
|
|
|
|
It's not really keeping it in scope. It's just that the scoping of the compiler means that it can't really do an operation in a block on a variable if it thinks that it hasn't been initialised. I've lost count of the number of times I've been kicked in the butt by this one.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Hi,
Is it possible, my means of registry entries etc to launch the default Defragmenter in Windows. For example, users of OO Defrag can set this as the default, and can be launched as the default instead of the Windows defragmenter.
Thanks, Andrew.
|
|
|
|
|
Hi again... always fighting with my installation...
Now everything works fine... I only have 1 other little detail: I'd like to let the end user choose whether install or not SQL Server Express.
If I put it in the prerequisites and the users cancel the install of SQL Server. also my app doesn't get installed...
Is there a way? I googled around but seems like it's still not possible...
Life is not short... the problem is only how you organize yourself
|
|
|
|
|
Hi all,
I'm working on client-server application
While sending data from server through Socket class,
my client calls the callback function correctly but the problem rises when it gets hang at Client.Receive(buffer[])
in debug mode, when i repost message from server to client, it resumes the code from Client.Receive
what should be the reason, any idea?
thanks
Determination and faith are the only keys !
|
|
|
|
|
nayabsiddiqi wrote: but the problem rises when it gets hang at Client.Receive(buffer[])
nayabsiddiqi wrote: what should be the reason, any idea?
If you are making a blocking call then it is working perfectly.
|
|
|
|
|
thanks.. was confused in somehting
Determination and faith are the only keys !
|
|
|
|
|
Hi friends,
How we can create a tearable-tab in C#? Means, suppose we have 2 tabs in a window/dialog. The user can be able to detach a tab from its parent window/dlg.This kind of tab implementation is called tearable-tab(I heard some term like "tab to window extension").
Hope some one can help me.Thanks in advance.
Thanks buddies
|
|
|
|
|
cooltuxxx wrote: How we can create a tearable-tab in C#?
Do you mean besides developing it?
|
|
|
|
|
Hi Friend,
I'm new to C#. Can any one give me the code that implement tearable-tab?
Thanks in adavance.
|
|
|
|
|
cooltuxxx wrote: Can any one give me the code that implement tearable-tab?
First, read the post at the top of the forum titled "how to get an answer to your question", pay attention to item #2.
Second, what about the information Patrick Sears gave you? That should provide a solution for you.
|
|
|
|
|
Hi Mike,
Sorry.
Actually I want to construct 2 tabs in a form.These tabs will contain other GUI controls. Also the user should be able to tear off the tab from its parent window to make it a stand alone window. If the user double clicked on the title bar of this window it shoud again comes to the tabbed state.
Hope you got the points. ...I have very less experience in GUI design.
Thanks
|
|
|
|
|
cooltuxxx wrote: Hope you got the points.
Not really. There might not be a tool that will give you this behavior by dragging it from the toolbar and dropping it onto your form. If not you will have to develop a solution, perhaps using a library like Patrick linked to that gives you a partial solution.
cooltuxxx wrote: Hope some one can help me.
Help you with what? How?
|
|
|
|
|
Ok Mike.Thanks
|
|
|
|
|
Take a look at the DockPanelSuite [^]by Weifen Luo. I've used it to create a couple of tearable-tabbed applications.
There are even articles here on CP that show you how to extend the styles and functionality of the library.
"If you think of yourselves as helpless and ineffectual, it is certain that you will create a despotic government to be your master. The wise despot, therefore, maintains among his subjects a popular sense that they are helpless and ineffectual."
- Frank Herbert
|
|
|
|
|
Patrick Sears wrote: tearable terrible-tabbed applications.
Tabs have been so abused in GUI design that I just have to laugh at the idea of a GUI that is spoken of in terms of "Tabs".
|
|
|
|
|
Thanks Patrick. But i need to implement in VC 2005 itself. I will do it anyway...Thanks alot.
|
|
|
|
|
how to create progress bar in C#
thanks
Haloha...!!!!
|
|
|
|