|
Hello,
I would like to change dos prompt caption using C#.
Usually, we kicked bat file using Process.start() or double click, dos prompt caption is "c:\WINNT/system32/cmd.exe".
I would like to change another title.
If you have some solutions, please tell me.
best regards,
yu-yu
|
|
|
|
|
just use the title command in the bat file
title mytitle
"When the only tool you have is a hammer, a sore thumb you will have."
|
|
|
|
|
Or you could just use the following:
Process.Start("cmd.exe", "/k title Title");
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Great.
My new year's resolution:
1. Refrain from giving stupid answers in the programming forum.
2. If failed to do #1, delete my post as soon as Heath posted his answer.
My articles and software tools
|
|
|
|
|
the vs designer is ok for generating menus but the code gets quite bloaty.
is there either a more compact way to generate menus and their click handlers, or alternatively some slick way of collecting them all in a separate "menus.cs" file?
TIA
________________________________________
Gosh, it would be awful pleas'n, to reason out the reason, for things I can't explain.
Then perhaps I'd deserve ya, and be even worthy of ya..
if I only had a brain!
|
|
|
|
|
I solve this problem using #region directives:
#region Menus
private MenuItem mnuFile;
private MenuItem mnuFileNew;
private MenuItem mnuFileOpen;
private MenuItem mnuFileLine1;
private MenuItem mnuFileSave;
private MenuItem mnuFileSaveAs;
private MenuItem mnuFileLine2;
private MenuItem mnuFileExit;
#endregion
#region Menu events
#region File
private void mnuFileNew_Click(object sender, System.EventArgs e)
{
}
private void mnuFileOpen_Click(object sender, System.EventArgs e)
{
}
private void mnuFileSave_Click(object sender, System.EventArgs e)
{
}
private void mnuFileSaveAs_Click(object sender, System.EventArgs e)
{
}
private void mnuFileExit_Click(object sender, System.EventArgs e)
{
}
#endregion
#endregion
Since you use Visual Studio, this would hide the menu code, and add more structure to your source file.
- Daniël Pelsmaeker
And if your dream is to care for your family, to put food on the table, to provide them with an education and a good home, then maybe suffering through an endless, pointless, boring job will seem to have purpose. And you will realize how even a rock can change the world, simply by remaining obstinately stationary.
-Shog9
|
|
|
|
|
You could just type everything manually. Using the designers isn't magic - they generate code. Instead of using the designer - just type it yourself. Write a class with your menus, instantiate it, and assign that as the menu for your application.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
How is it possible to find a server in a network with dynamic IPs? (A custom server)
|
|
|
|
|
|
Until now, I've just gone on my merry way assuming that the only way to determine whether a time was AM or PM was either to get back a string with .ToShortDateString() and parse it out using Split, or to check to see if the Hours field in the date's TimeOfDay field was greater than 12. I haven't been happy with either answer, but haven't found a better one. What is the "proper" API way of doing this? Or is what I've mentioned all I get?
-Matt
------------------------------------------
The 3 great virtues of a programmer:
Laziness, Impatience, and Hubris.
--Larry Wall
|
|
|
|
|
Why not just check if DateTime.Hour >= 12 ?
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
I'm an idiot! I recall stepping through the debugger on a recent project and I could have sworn a 1 o'clock appointment record was coming up with an hour value of 1 rather than 13, but sure enough, I just built a simple desktop app to test it again and it came up with 13 on a 1:00 pm. I had just ASSumed that there was someething I was missing to determine meridian. Oh well. Here's to assuming!! Thanks. I appreciate you answering a stupid question.
-Matt
------------------------------------------
The 3 great virtues of a programmer:
Laziness, Impatience, and Hubris.
--Larry Wall
|
|
|
|
|
Hi, I'm looking through a lot of COM interfaces with a mind to reproduce them in C#, but i'd idealy like a handful that are simple enough to implement without going into complex background structures.
If anyone knows 6 or so objects, i'll have a play with them.
Thanks
Cata
|
|
|
|
|
Look in the Shell Programming section of the Platform SDK. There's TONS of easy and useful interfaces in there that you can use.
Other important often easy ones are like IPersistFile , IPersistStream , and other IPersist* interfaces.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Thanks m8
I've downloaded the Windows SDK, but i can't find the shell section.
There appears to be no documentation, although I've found what appears to be the shell section in the following path:
X:\Microsoft SDK\Samples\winui\Shell
I've found a few examples, but there isn't much documentation. Am I in the right place?
Additionaly, how do i access the windows help files associated with the SDK? Are they automaticaly linked to VS.net? Or do i have to tie them in manualy?
Additionaly, .NET can't build C. I'm looking for a microsoft certified C compiler, but they don't have any listed on their site. They are either C++, or .NET.
Do i even need to compile them? Or are they all already present in the windows directory?
Cheers
Cata
|
|
|
|
|
Why are you looking in directories? You're supposed to be looking in the help files which - at least for the core that should include this stuff - is a required download. Click on Start->Programs->Microsoft Platform SDK Month Year and you'll see the help files. You don't need to build anything.
And "certified C compiler"? You do realize that VS.NET includes the C/C++ compiler - it's the same compiler that builds mixed mode and pure .NET assemblies when the /clr switch is used. The PSDK also includes the compiler and linker in the bin directory, as is the common place for binaries in SDKs and in *nix systems. Again, though, you don't need to build anything. Just look in help for information.
If you don't have all the right help files, click on the Update link in that directory and install all the relevent documentation.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
ROFL! OMG! I didn't even know it was in the start menu!
Heh... I'm not stupid... really... just 99% of what I do is mistakes :P
So, how does .NET compile C? I mean, you don't get C Projects? Does it just compile C with C++ then?
And no, I never knew
Cata
|
|
|
|
|
Ok mate, I've got it. Thanks for the pointers.
I'll see how it goes from here.
I really love learning programming.
I'm such a geek.
Peace
Cata
|
|
|
|
|
I'm down a little program that shows image sequences and I'm having a hard time with error handling, i have an xml settings file that i first want to load and when that has loaded and only if it has been successfull do I want the program to continue so heres the code at it's current state.
but it doesn't seem to be picking up if the file really exists or not, and I usually get a nullrefrence exeption, so how's the best way to check if the file exists?
private bool readXML()
{
bool returnValue;
doc = new XmlDocument();
if(File.Exists(xmlSettings))
{
doc.Load(xmlSettings);
nodeReader = new XmlNodeReader(doc);
nodeReader.MoveToContent();
title = nodeReader.GetAttribute("title");
name = nodeReader.GetAttribute("name");
totalframes = Convert.ToInt32(nodeReader.GetAttribute("totalframes"))-1;
rotate = Convert.ToInt32(nodeReader.GetAttribute("rotate"));
reverse = Convert.ToBoolean(nodeReader.GetAttribute("reverse"));
autoplay = Convert.ToBoolean(nodeReader.GetAttribute("autoplay"));
play_ms = Convert.ToInt32(nodeReader.GetAttribute("playms"));
autoresume = Convert.ToBoolean(nodeReader.GetAttribute("autoresume"));
autoresume_ms = Convert.ToInt32(nodeReader.GetAttribute("autoresumems"));
if (nodeReader != null)
{
nodeReader.Close();
}
returnValue = true;
}
else
{
// If any errors are found Exit Application
DialogResult result;
result = MessageBox.Show(this, "\nError: settings.xml Missing!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
if(result == DialogResult.OK)
{
Application.Exit();
}
returnValue = false;
}
return returnValue;
}
|
|
|
|
|
What does the path look like for xmlSettings ? The code to check if the file exists is correct, however you need to check the path, is it absolute or relative?
- Nick Parker My Blog
|
|
|
|
|
It's as simple as xmlSettings = "settings.xml";
how would the path look if a wanted to place the file in a folder in the program folder?
and a want to keep it relative.
|
|
|
|
|
Well, typically this will work (i.e.; xmlSettings = "settings.xml"; ), however say you want to place the file two directories above the executing file path you could simply do: @"..\..\settings.xml" . I have seen an instance where when using an open file dialog can cause the selected path (even though not related to your particular file) being appended as the path infront of "settings.xml" when you call the Load(..) method. You might check into something such as Application.ExecutablePath so that you know you are always getting the absolute path to your file.
- Nick Parker My Blog
|
|
|
|
|
maybe you better get the application path first, as the working directory is not always equal to it ...
something like string path = new FileInfo(Process.GetCurrentProcess().MainModule.FileName).Path
greetz
*Niels Penneman*
Software/Dev Site Personal Site
|
|
|
|
|
Does anyone know if I can change my MSN nickname with .NET code in an existing MSN Messenger 6 session?
I could do it by communicating with the server but I want to keep my Messenger session running...
I have seen somebody doing it with VB5 or 6 but the guy doesn't seem to have any website or e-mail address and VBDE could not decompile the executable.
I know the application does something with API functions, to open the Options dialog, change the name, close it. It's rather annoying and I want to know if any other methods exist?
Note: I already tried the API, but the property MyFriendlyName is not writable...
greetz
niels penneman
|
|
|
|
|