Was creating a simple console application to do some prototyping and was shocked to see that the right-click/context menu is missing from a standard .NET console app!
I'm unable to find any information about this, and intellisense isn't helping.
So what happened to it? Can I get it back? And if not, how can I configure my console application to treat ctrl-c/ctrl-v as standard?
This is a windows console settings thing. Right click on the task bar of the app, click Properties and check / uncheck quick edit mode.
Also there is no way to get Ctr-C Ctrl-V working in console apps (as far as I know)
Context menu doesn't show up when you right click on the console app body (not the title bar) when VS debugger is attached.
Related
I am developing a console application in C#, and was wondering if there was a way to get the "copy-paste" or "mark-paste" functionality into my application, similar or identical to that of the standard Windows command prompt. Is this a wild goose chase or a simple application variable?
I've copied text from the Console window and pasted it into another source many times.
It's there as default in a Console application;
Right click the console border:
Select Edit > Mark:
Drag over the text you want using the mouse (Or use the arrow keys) to select the text you want:
Again, right click on the console border and select Edit > Copy:
From here you can paste it into another application as you would with any other text.
This was taken from a C# Console application and the only code entered was the command to write to the console, no settings were changed.
Hope this helps!
Thank you Sean for making me realize the complete idiocy of this question. Let me be an example to others to not jump on the conclusion train.
Sean pointed out that "copy-paste can be done using cmd.exe's built-in functionality", making me recognize that, yes, absolutely duh, when you run your command line application in Windows it already has this functionality available.
I erred by jumping to conclusions, for I was doing all my initial testing with the DEBUG execution through the IDE, and vshost does not give you that functionality.
A quick "Start Without Debugging" revealed my short-sightedness.
I don't know why this isn't included in any answer, but as Robert H. stated in a comment, this is absolutely useful information, in case you came here by searching for this problem in a VisualStudio environment:
Run a console app in the debugger (F5). You cannot copy or paste.
Run it outside the debugger (Control + F5). Now, you can copy and paste.
Worked like a charm for me. Thanks Robert H.!
To clarify, is the default command prompt behavior not working at all for you, or just not how you want it to?
From what I understand, it is the terminal implementation that supplies the copy/paste behavior, and what it provides doesn't match rest of Windows. To change this behavior, you'd have to switch the program that implements the terminal. Here are a couple programs that come up on a google search for "command prompt replacement":
http://www.powercmd.com/
http://sourceforge.net/projects/console/
Of those two, I think one of my friends at work tried "Console". It did enough of what he wanted that he didn't feel the need to keep looking.
If you just want your output for this specific program to work more like the rest of Windows, your other choice is to make it a Windows program.
Edit: Fixed the URL to Console. Was posting to someone's blog that linked to it, before :)
Maybe I am late but there is a shortcut for pasting text in Console Window in c#. Press Alt+Space then 'E' then 'P' and there you have your text pasted in the Console Window
im using c# .net 2.0 Console Application.
How can i prevent my console application from ALT+F4 shortcut?
is there any way to do that?
everywhere there is winform solution.
I need console app solution.
please help me
#Jeroen Mostert:
i found a final working solution from prevent exiting console app by the user.
Everybody says its not possible. But yes it possible with simple tweak.
Here we go
using C#
RegistryKey objRegistryKey = Registry.CurrentUser.CreateSubKey(#"Console");
objRegistryKey.SetValue("AllowAltF4Close", "0" , RegistryValueKind.DWord);
I cant post my full code here due to copyright
but this code works within my application. I tried to make a sample but that not works. But within my full application this works and Nobody can close by pressing ALT+F4.
this is a real solution for all. I don't know which part is required within my all code to make sample.
but this works.
you can just change value 0 to 1 to enable ALT+F4
CMD will not closing if you use this code. try code and launch another cmd.
i dont need to launch another CMD. within my code that works for itself.
I have an MVC application which uses a silverlight control.
Somewhere along the line something is happening in the silverlight cs code that isn't right. I've inserted break points in the CS silverlight code to get a better idea of what's happening, but for some reason I just can't step through the code.
I know code is being hit, but it's just not showing me in the debugger.
I thought it might be because I was using Chrome as the default browser but I changed this to Internet Explorer and still no joy.
I realize this is a very vague question, but has anyone else experience anything similar, and if so, how did you get around it?
Any help would be appreciated,
Thanks.
Be sure to set the Silverlight Debugging checkbox on the project properties Web tab
If Chrome is your default browser and your breakpoint tooltip shows this message:
"The breakpoint will not currently be hit. No symbols have been loaded for this document"
... then it is possible the debugger attached to the wrong Chrome process at debug startup. A work-around is:
Start debugging your Silverlight app. Your app should be running in Chrome.
From the Debug menu, select Attach to Process...
Scroll through the available processes and locate the chrome.exe process that shows the type as 'Silverlight x86'.
Select that process and click Attach.
I had firefox as my default browser and nothing was being hit(I even tried attaching to a process). What finally worked for me was setting IE as the default.
Silverlight break points are now being hit for me! :)
Right Click on Web.UI project in solution. go to Web , check Debuggers --> Silverlight save and Debug..
Make sure you have silverlight developer installed.
Your code may be part of a class marked with the System.Diagnostics.DebuggerStepThroughAttribute. This happens with auto generated classes (like with Add Service Reference). If you are extending a partial class, other parts of the class definition may have that attribute.
Try unckecking the Options / Debugging / General / Enable Just My Code checkbox.
Otherwise put your mouse over the red dot in the source code window, which becomes an empty circle if the debugger disabled it, a tooltip will give you additional information.
i am facing a problem with Getting a pop up message through pop up window in a stand alone application using c sharp.please help us ,thanks in advance.
I want to pop up a message to user to perform task at particular time .then i need to send the message to user through pop up window thats my requirement.
i am writing console application programs.
Regards,
M.Channabasappa
If you have console project - the best user message would, of course, console message. But If you still want to send pop up message to user just add reference to System.Windows.Forms assembly to your project and call message box:
System.Windows.Forms.MessageBox.Show("Hello! Im console app");
In WinForms, you need Form.ShowDialog(). In WPF, it's Window.ShowDialog().
To achieve a modal popup on a website is more tricky. Only IE really supports modal popups, and they don't "feel" nice to use. You can use bits of jQuery UI to get what looks like a popup but is in fact a div layered over the top of the whole page, inside the browser window.
HTH.
Anton's answer is correct, but in my case (Visual Studio 2010, Win7), I had to add System.Windows.Forms to my project as a reference to get it to work.
To do so, right click on your project in Solution Explorer > Add Reference > .NET tab > System.Windows.Forms > OK
Once I did this, I was able to add a MessageBox to a console application, which while it seems a bit counter intuitive was a good solution for this particular problem.
My target is to send keyboard events to external application.
From my application, I'm launching a C# exe (console application) that bring the target application to the front and uses SendKeys.SendWait to send keyboards events. I ran into a rate case were the command don't have any affect.
When debugging it, it works but when running it not in debug it fails.
I think it as something to do with the fact that when debugging my application is the active application.
You'll need to do a little work, and it changes depending on the version of Windows. There's an MSDN page that has a good explanation and an example:
http://msdn.microsoft.com/en-us/library/ms171548.aspx