I want my project to have two executable windows. Whether that results in two executable files, or if both windows are launched when the exe is double clicked doesn't matter.
I want to be able to close the first window and have the second window continue to run. opening up a new instance of the first window shouldn't effect the second window, and no more than 1 instance of the second window should be allowed to run at once.
Ideally I would like my project to have two executable files, but I'm not sure how to implement this. I don't want to make them separate projects, because they share a lot of the same methods and variables, as well as user settings, but I may have to if that's the only way.
What is the best way to go about this?
Becuase they share so much I would suggest making 3 projects
1 for each of the windows
1 for the shared functionality.
This way, the shared functionality can be compiled into a separate DLL and can be used by both exe's
Related
I want to launch my AHK script like described here. I will need to do two different things, A and B. I can either put them in one script, or two separate scripts. But B needs some data from A, which is where my problem lies.
Solution one: Put A and B into one script, and somehow notify it when it's time for part B, but without restarting it. But how?
Solution two: Put them into separate scripts, and somehow pass the values between them. But again, how? The value does not fit into the exit code, and I also don't know how to get the exit code and now to launch multiple executables from and UWP app.
I was wondering if it is possible to open a second project (in the same solution as the first one) by code in the first project.
For example i have one form application project and another console application project.
The form application starts and when the user clicks a button i want the console application to run and the form application to stop.
Or could someone tell me how to delete my application .exe file?
The projects don't need to be in the same solution to do that. Just use Process.Start to start the executable for another application, and then close the main form to end the current application.
If you don't want to run the code as an entirely different process then it may also make sense to have a 3rd project that is a "class library" that the other two projects could add a reference to. This would allow you to define common code used in either application, using classes that are generalized to be helpful in either project.
I'm not sure what you're trying to do; but Process class has Start and Kill methods that will let you launch / exit processes.
http://msdn.microsoft.com/en-us/library/system.diagnostics.process.aspx
I want to learn how can i run a external program in my c# form.
with these speccifications:
FormBorderStyle = none
Size and Location fixed.
You cannot run an external process within your own. You can start one, but it's gonna run on its own and you cannot access its internal behaviors. However, if your goal is to use a class (like a form) from another .exe or .dll, you can do it by referencing it in your solution and creating that instance like any other. But if that form is already controlling its own location, size and so on and doesn't allow to be modified, you're kinda stuck. You could force it with some reflection, but the behavior might be highly unpredictable.
I have a C# Console app than runs a pre-build step (to get NuGet Packages).
When I am debugging this, I want to pass in a parameter and show the console. When I am not debugging it I don't want to see it. I don't even want it to flash up there for a second.
I have found ways to hide it, after it has shown. But I can't find a way to never make it show unless I am willing to change it from a console app to a Windows app. (Which I would do if I could then find a way to show the Console when needed.)
Build as a Windows application and show the console when you need it. To show the console when needed use P/Invoke to call AllocConsole (pinvoke.net has the declaration you need).
(Console sub-system processes always get a console, their parent process's if there was one, otherwise a new one. This is the way Windows works at a deep level.)
Use FreeConsole WINAPI function:
http://pinvoke.net/default.aspx/kernel32/FreeConsole.html
Another solution is to simply switch to a WinForms application as project type. No console will be allocated then (and you do not need to show a form).
I have a visual c# project from which I want to compile two executables: Full.exe, and Limited.exe. Limited.exe simply hides a couple of UI controls.
I'm thinking of adding another pair of solution configuration (DebugLimited and ReleaseLimited) which simply sets a flag, and then in my build script just build my app with Release configuration and with ReleaseLimited configuration.
Is there an easier way to accomplish this?
If you really want 2 differnet executables this approach works. Make sure that each flavor builds into its own directory. "Build-> batch build" option will let you build all of them at once.
If goal is to have different UI instead of different executables you can use setting in .config file to control what UI to show/hide (with appropritate code to turn on/off controls).
I would make a couple of projects. One called Full and the other called Limited. They are simply wrappers around your main project and set your appropriate options before starting. This way, on a full build of your solution you always get both executables.