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.
Related
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.
I'm loading an url in my app using the following code,
WebBrowserTask webBrowserTask = new WebBrowserTask();
webBrowserTask.Uri = new Uri("https:www.myurl.com", UriKind.Absolute);
webBrowserTask.Show();
After giving some datas i'll be navigated to another page(response page).
How can i detect the loading of the response page??
How can i pause my execution of the code until the response page is loaded??
I don't think you can do that with WebBrowserTask which is a Windows phone Launcher, here is a definition from msdn :
The Launcher and Chooser APIs invoke distinct built-in applications
that replace the currently running application.
And here are some relevant details about them and related to your need:
An important concept for Windows Phone application developers to
consider in general, and especially when using Launchers and Choosers,
is that the calling application is either put into a dormant state or
tombstoned when another application is launched. When the new task
application is launched, your application is deactivated and is no
longer running. Usually, your application is put into a dormant state
by the operating system. After completing the task, the user can
return to your application that was preserved in memory,
So when you launch a task (like WebBrowserTask) your application is no longer active, you just can't detect or do anything.
If you want to accomplish such a thing then you should check out the WebBrowser control. It is a complete WebBrowser that you can embed into your application (here is a tutorial), it comes with lots of features like the LoadCompleted event that :
Occurs after the WebBrowser control has loaded content.
In order to accompolish the above mentioned task, i have used WebBrowser Control and added LoadCompleted Eventhandler.
The xaml code for that is,
<phone:WebBrowser IsScriptEnabled="True" LoadCompleted="UriContentLoaded" x:Name="browserControl" />
we would like to build a screensaver that shows the desktop and the running applications but prevents user input by showing the login screen. The idea was to build a windows app with no window or a transparent window. However, as soon as the screensaver gets activated the desktop and all applications are hidden from the screen.
Is it possible to start the screensaver without hiding the desktop?
Thx,
bja
Is it possible for you to implement this as something other than a screensaver? I'm assuming that the Windows API does have a method that allows you to tell how long the computer has been idle (otherwise, how does the stuff that manages screensavers do it?), so if you use that you could just set up your application such that it's continuously running as a background process, and will pop up a modal dialog box (or your idea of a transparent window) or something that prompts for the user's login info when the computer has been idle for a certain amount of time.
Why can't you just grab an image of the screen when the SS kicks off. Then use that as the backdrop of your SS.
Vista has a bubbles screen saver that just starts putting bubbles on the screen. Not sure how they do it.
You are better off just creating a full-screen application with a transparent window that starts up on a timer like a screensaver. The screensaver functionality while similar to what you are doing, functions much differently.
As an alternative suggestion, you could always use a service (or background app) to gather the information you want these monitoring tools to display, or even just to grab periodic screenshots of the (hidden) desktop, and then have your screensaver query that app to get the data it needs to display.
That way, you get the benefit (the secure desktop, the usual Windows login sequence, etc.) of a screensaver, but still get to display what you need to.
I have an application where the taskbar flashes if an event has occurred. This is working perfectly, and was relatively easy to implement using a Win32 API described below:
http://blogs.x2line.com/al/archive/2008/04/19/3392.aspx
However, when I stop the flashing, sometimes the application is stuck in the "highlighted" state in the taskbar. This only gets reset by clicking on the application in the taskbar, minimizing it, then re-maximizing it. Is there a way to clear this from being highlighted without any user interaction?
Maybe instead of flashing it you could put an overlay icon on it - one line of code from C# with the Code Pack. Then when you want to clear it you could take the overlay icon away - again one line of code. Windows 7 only, however.
Can you post the code that you are using to "Stop" the flashing?
Have you also considered using a different flag such as:
// flash until the window comes to the foreground
FLASHW_TIMERNOFG = 12;
You will still need to click on the applicaiton to get the flash to stop, but you should not have to minimize then re-maximize the app to get the flash to stop.
You can include the FlashTaskbar snippet and use the following code
FlashWindow(Form.Handle, FlashMode.FLASHW_STOP)
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/