I have a problem, I already have webbrowser in c# app, I want to send url from another app, and open my c# app and url what I sent from another application.
Any ideas, tutorials, anything. Thanks
So based on what I understand from your question, you want to pass URL by app1 and open app2 with that url in app2(webbrowser control).
You can use Commandline Arguments to pass data between process,
Refer this stack overflow link command line arguments to winform applications
You could use Process.Start to start the process:
System.Diagnostics.Process.Start("path/to/browser.exe", "https://sampleurl.org");
And in your application, depending if it is wpf, winforms or something else read the arg (there are plenty of questions how to do it on stackoverflow)
You could use Process.Start to start the process:
Process.Start("path/to/browser.exe", "https://sampleurl.org");
And in your c# program access it in the main
Related
I'm trying to start a Microsoft Teams call from my WinForms c# application.
I think this is possible by opening a link that then triggers the Teams app to open.
I've searched the internet and stack overflow but can't find any good working examples.
I've also tried the below code, but nothing opens.
ProcessStartInfo processStartInfo = new ProcessStartInfo("https://teams.microsoft.com/l/call/0/0?users=<username>");
Changed ProcessStart code to the below and it will now open the link, but I receive an error within the Teams app: 'There's a problem with the link'
Process.Start(new ProcessStartInfo("https://teams.microsoft.com/l/call/0/0?users=<user1>,<user2>") { UseShellExecute = true });
Thanks
You can use msteams: url scheme like this:
System.Diagnostics.Process.Start("msteams:l/call/0/0?users=user#example.com");
Then it opens Microsoft Teams and asks you if you want to make the call.
You can find the supported format and parameters of here:
Deep link to start an audio-video call with users
I just replaced the web URL with msteam: url scheme.
Probably the reason is your link is not correct.
Please look at this answer.
Start Teams call from c#
And also try this kind of link for voice call:
https://teams.microsoft.com/l/call/0/0?users=<user1>,<user2>
and try this kind for video call:
https://teams.microsoft.com/l/call/0/0?users=<user1>,<user2>&withVideo=true
I don't know if it is possible to do this in Windows Console Application (C#) but I really need something like this for my project.
I would like to send a string (or URL link) to the IE and have IE execute that string. However, since this string is static; what it does is just turn a machine ON and OFF via internet. So, in this case I have no interest in seeing the IE to popup/display nor the black screen console to appears when the application got executed.
I know in Console Application C# we can do something like this
Process.Start("iexplore.exe", #"http://myserver.com");
However, when I run the above line, the IE popup and so does the black screen console.
Is there a way to not have IE popup and the screen console to not popup, too?
Thanks.
I think you are going about this the wrong way. IE is merely a portal to web requests. Just make the web request call directly. using something like the new Web API or HttpWebRequest
As to making the console not pop up, maybe you should be creating a Windows Service instead of a console application? We would need more details on the end user. If this is more of an automated action, then a service would work. If it is something the user clicks on, then why is displaying the console a bad thing? Typically, when you click on something you expect some sort of visual representation. But, here is a SO that answers this question already
Try ProcessStartInfo. This will hide the console app, but I'm not positive about it hiding IE.
ProcessStartInfo psi = new ProcessStartInfo("iexplore.exe", #"http://myserver.com");
psi.WindowStyle = ProcessWindowStyle.Hidden;
Process.Start(psi);
I have a console app that prompts for various pieces of information that I want to invoke from C# via the System.Diagnostics.Process.Start() method from a Windows Form app but I can't quite get it to work correctly. As a simple example lets say I want to capture FirstName, and LastName via a Windows Form application and then pass each to the console app dynamically like this:
Forms app launches, the user keys in the values for firstname and lastname and clicks a button to submit
it calls Process.Start for the console app
Console app writes out 'Enter your first name"
Forms app reads this prompt, identifies that it needs to respond with the FirstName value it has collected and writes it to the console app's output
Console app accepts the input and responds with the next prompt "Enter your last name"
Forms app reads this prompt, identifies that it needs to respond with the LastName value it has collected and writes it to the console app's output
Console app now has all the information it needs and continues on its merry way
thanks for any insight, this is not an area I have worked with much at all
From the WinForms app, you can read output from the console app with the StreamReader returned by the Process.StandardOutput property, and write input to the console app with the StreamWriter returned by the Process.StandardInput property.
BTW, did you develop the console app yourself (or have the project files)? If so, I'd suggest using a better form of IPC, such as making the console app a DLL intead of an EXE, or using something from WCF or something like that.
Look at Process.StandardOutput and Process.StandardInput and Process.StandardError.
You need to read from Process.StandardOutput. When you read " 'Enter your first name"" then you write the first name to Process.StandardInput and so on.
Note that the child process can write to its StandardError as well and you probably need to read from it in a different thread so that you can read concurrently from both
In Java there is expect4j that makes this easy. I am pretty sure I saw something on .net but but I am not able to find it right now.
EDIT: Creating a Child Process with Redirected Input and Output seems to be a good article on this topic on MSDN
Can someone tell me what the InteractiveProcessRunner is for? Is it identical to Process.Start?
Here is the class.
And here an example :
InteractiveProcessRunner runner =
new InteractiveProcessRunner(notepad.exe,hSessionToken);
THX
Whit this class you can run a process with the complete environment of the user active: if you call this code from a service, you should find the user mapped resources, the desktop and all the resources that are available when the user is loggen on interactively even if launched from a service ie not logged interactively.
The source code to which your link leads referes to this article: http://asprosys.blogspot.com/2009/03/perils-and-pitfalls-of-launching.html which explains the motivation behind it.
Summary: You can't really use Process.Start() when you want to start a new process as certain user from a windows service. The InteractiveProcessRunner lets you do this (supposedly, never used it so I can't verify it). So it's not the same as Process.Start() - it uses a different Windows API.
I would like to integrate FileZilla with my application written in C#.
please someone show me sample code or web site that shows sample code.
although i found article on web, and that article was saying
"application is integrated with FileZilla is so slow".
but i don't know if i can stand that late or not.
so i would like to challenge.
To support FTP/SFTP or any other protocol in C# you can do it in 3 ways:
1. NEW APP PROCESS - Start an app that does the FTP communication in separate process, and be able to control what file to download, where to save it and to tell the app to terminate when download is finished. This way, you can use FileZilla only if it lets you pass certain parameters in command line, like the URI of the resource you want to transfer through FTP/SFTP, and the path where the file should be saved to. And as I can see HERE this could work.
To start the process and pass it command line arguments in C# you would do something like this:
static void StartNewProcess(string app, string args)
{
ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.FileName = app; //full app path
startInfo.Arguments = args; //command line arguments
startInfo.CreateNoWindow = true; //dont create app window
startInfo.WindowStyle = ProcessWindowStyle.Hidden; //hide app from taskbar
Process.Start(startInfo);
}
Now you can execute FileZila app, pass it args containing file URL and let it do its job... But you cant know how long will it take to download the file, when the download is ended, do you need to log in to get it...
2. EXISTING CLASS LIBRARY - Include a Class Library that is written by someone else, that does the job. This way you are in TOTAL control of the process. And as many other suggested, this would be a perfect way for you. Many answers here contain good class libraries that you can use and be happy with the results.
3. HOME-MADE CLASS LIBRARY - Open RFC 959, read it all and write your code... (Now 2. sounds better, doesn't it? :D)
Filezilla is a GUI FTP client, you can't use it to "script" SFTP operations (it only accepts a very limited set of command line arguments).
You must seek a third party C# component or write one yourself (not recommended) to do the job.
To support FTP or SFTP from your C# application, you could use an external library like the one from Chilkat http://www.chilkatsoft.com/ftp-2-dotnet.asp. I use it and it works great!
In theory, you could also implement the FTP protocoll using socket connections by yourself, but you should save yourself that trouble -> don't reinvent the wheel...
I recommend using SharpSSH, if you need to send files via SSH/SFTP in your application.