I've just created a Winform in C# that uses WaTiN. The program works fine but whenever it opens new WaTiN browser windows in the background and navigates to a page etc. the application it freezes over and can't be used until WaTiN has finished its processes. Can you please help me to prevent this. Thankyou.
You should use background workers. The behaviour you're experiencing is absolutely normal. You can start reading about the workers here and here.
Related
I've completed a winform project that handles a uri scheme (TEL:)
I'm now trying to do the same in UWP. I've successfully got the app launching on TEL activation.
How do I stop the app showing when its run with arguments? Run silent.
The app runs a task and closes. There is no need for the UI unless the user hasn't done the first time set up or there is an error.
I've been looking into prelaunch but before painting myself into a corner I wanted to ask a more experienced user what the best practice is as I would like to publish this application and follow best practice.
I've checked similar questions but they were after a background service.
Thank you.
Answer thanks to Nico Zhu.
Can not launch an app without displaying UI but it is possible to use 'FullTrustProcessLauncher' to run an exe instead.
More information on this can be found here
I am screen scraping a legacy website that uses activex controls. I am using selenium to accomplish this.
This website is buggy and whenever you signout of it, it crashes IE and you get the "Internet Explorer has stopped working" window. This happens no matter what, website needs to be recoded.
Is there a way in InternetExplorerDriver.Quit() to detect if this window is up and close it? The annoyance is that while the dialog is doing "searching for a solution..." it doesn't release selenium, so my code hangs up waiting.
Right now I am attempting to kill the process through the windows api, but that requires waiting for selenium to finish closing.
The solution Richard posted in the comments worked. I just told windows to stop checking for solutions.
I want to create a program that won't close when you click the close button but, only when a exit function is run from within the form.I was thinking i could have it run in the background without the window needing to be open (Like the steam client and dropbox, mediafire, google drive, google chrome extension notification), and was wondering how to do that.
I was thinking of some ways to do it but i wasn't sure how to do them:
A starter program that keeps it open in the background
Running a background process that keeps information stored
I am running c# 2010 so i will need answers relating to that. I would also prefer to not use 3rd party extensions/tools except a basic text editor(Notepad++).Thank you in advance!
There are a number of possible options:
Hide the main form
Create a Tray application
Write a Windows Service
I want close external applications in suspend mode from my own application.
For example :
I run WebBrowserTask from my app
var wbt = new WebBrowserTask();
wbt.URL = "www.site.com";
wbt.Show();
and after i want kill (close, finish) this task from my app.
Please any ideas how this can be done.
Thanks.
You cannot close your or any other application. You must leave handling Application life cycle to the OS.
In your case when you create a WebBrowserTask your application becomes suspended and wont get any CPU time so none of your code will run until it becomes activated again.
SoroushMirzaei already said everything, but I'll add a bit of doubt: Why are you trying to open-and-close this webbrowser and site? If you want to show a nag screen for X seconds or do some website-logon etc, use fullscreen WebBrowser control, where you will have 100% control over it.
You can't close another application from your code. In your case, you could use the WebBrowser control so that the user remains within your app itself. This may require more work, depending on how much of the WebBrowserTask functionality you need but it gives you full control on when and where the web pages are displayed.
I need to write a .NET application that captures screenshots of various web pages periodically. The application needs to run as a windows service in unattended mode - when there is no user session or when the workstation is locked. A situation similar to: (Screenshot of process under Windows Service), only, I need to do this on web pages rather than processes.
When I try to use PrintWindow API, I am able to capture inactive or hidden windows, but get a black image when the workstation is locked. Tried this approach (www.devnewsgroups.net/group/microsoft.public.dotnet.framework.windowsforms/topic34231.aspx) but doesn't work.
I know this is possible since there are apps like WebShot (www.websitescreenshots.com) that are able to do it - capture screenshots of web pages even when the workstation is locked or when it runs as a service.
What am I missing? How do I get this to work?
Thanks much for your time.
Edit: More on my approach - I'm using the .NET WebBrowser control created programmatically. I load the webpage in the browser control and capture the image from it using the PrintWindow API. This I'm able to do whether the control is visible or not, but it trips me up when the workstation is locked.
BrowserShots (http://browsershots.org/ http://browsershots.org/) is an open source application that seems to have similar goals to you - they may already have solved your problem. Unfortunately their site seems a bit broken at present.
Since you are only rendering websites and not getting screenshots of different programs you could try WebBrowser.DrawToBitmap.
That way you would wouldn't have to worry about login state
http://thepursuitofalife.com/the-missing-drawtobitmap-function-in-the-net-webbrowser-class/