Setting C# console application location to a secondary screen - c#

Overview: I am working on a project which involves a WCF and multiple types of clients. I have created several Test clients and I have a WCF which is hosted in a console app.
This results in me having multiple application windows (I currently have 4) when debugging and every time I run them I have to arrange them on multiple screens (I have 2).
Question: I wonder is there a way to set a position of Console application to the secondary screen without a need to drag it all the time.

Move the console to the wanted screen. Go to properties. Note the location. Use that.

I think that you'll find that the answer given on this thread will cover you.
It'll mean saving the position of the console window when it closes and also checking that the position is within the displayable area of the desktop on startup, but it demonstrates how to position the console window for both console applications and windows forms ones.

Related

Multiple Consoles in one window

I'm making a console application and ran into a problem. There are multiple console windows open at the same time and it's really painful to navigate through. Is it possible to create a "master window" - One window that servers as a base for multiple other windows?
Image explanation:

Windows 8 App / Loading screen

Every application in Windows 8 starts from this kind of view
(below is camera application) :
My question is :
Is this possible to change programmatically this view for
progress bar (C# or XAML) or any other animation ?
Or is this view related with time computer need to start application so
we can not use resource of our app yet ?
You cannot change how the launch screen is displayed. You can only change the picture and color.
However, the way to extend the launch screen is to make sure your app's first action is to display another launch screen (typically identical to the first with an added progress bar) while the rest of the app is getting ready. This approach is described in this guide.
Please keep in mind that an extended load screen might not be the best user experience. After all the user is still waiting for the app to launch. I recommend that you optimize launch time to avoid using the extended launch screen if you can. I cover this in more detail in my book (sorry for the shameless plug).
That screen is displayed while the runtime is starting your application. Its an image as defined by your application, so to my knowledge, there is no way to inject logic.
However, you can make your app "start" fast (so that the runtime removes the "loading" image), then put up a splash screen while the rest of your content loads. The NFL for Windows 8 app does a good job of this, as do several other apps.

Determine whether the class library is called from a windows based application

This is based on C#. I am having a classlibrary in which I would like to know specifically if its being called from a windows based application
I searched a lot but all I found was code to know if it was called from a Console application.
I only want to know if its called from a windows based application or not
Please Help
If you want to know whether the application is running as a service or system app and thus cannot display a dialogue, test the state of Environment.UserInteractive.
There is no easy way to determine if the application is a windows or cmd-based application. For example, I might build a winforms-based application that doesn't create a window and instead runs as command-line style application by not opening a window.
Two (not necessarily reliable) ways of testing if it's a windows-based app would be to test Application.OpenForms (if it contains forms, then it's a windows app) or Environment.GetCommandLineArgs() (if 0 args, assume it's a windows app).
If you absolutely need to know whether the app is a console or windows one, then you need to step out of the world of managed code and start delving into the exe file using unmanaged C++ code. There is just one byte difference between the two in the PE header of the exe file: Subsystem is set to 2 for a windows app and 3 for a cmd app. See http://msdn.microsoft.com/en-us/library/ms809762.aspx and http://support.microsoft.com/kb/90493/en-us for details if you really want to do this.

Create a process not an application in C#

I've created a simple application that I wish to be a process and not show up as an application inside taskmanager, simply because it is not an application. It was intended to be a process.
You might want to read about Windows Services.
Walkthrough: Creating a Windows Service Application in the Component Designer
Creating a C# Service Step-by-Step: Lesson I
You don't give much information about what you application does, but either Console or Forms will be displayed on the TaskManager, and even as a process it will be shown over the Processes tab so I'm not sure what are your intentions with this.

How to embed a Console application inside a Winforms application

I'm developing an application which acts as a GUI for Minecraft Server (runs as a console Java application).
I have finished it and I also want to add a console inside the Winforms application because I want to give users more control over the program. But using streams (Process.StandardOutput) I can't simulate a console as it sometimes changes the cursor position, clears the console, etc...
So, I want to embed the process into the application somehow. The first solution I tried was removing the borders and positioning it accordingly to the form's position but unfortunately I couldn't do it.
Any working code snippets would be greatly appreciated!
You cannot target both subsystem gui and console in the same module (msdn).
Instead, you could add a separate console application that uses SOAP to communicate with your application. Take a look at WCF to achieve this task.

Categories