WP7: how to create background process? - windows-phone-7

It needs to create instant messenger application.
Background thread should work under lock screen and after Home button is pressed.
As I see, it is possible and IM+ (by SHAPE services) works the same way, but how it is possible?
Working under lock screen possible by creating DispatcherTimer, but how to make process alive after user press Home button?

You can't run a application in the background on Windows Phone. You can run it under the lock screen sure, but not in the background.
And Periodic Background Tasks won't suit your need, as they only run every 30 minutes, as a separate process.
So again, it's not possible to run a chat/IM application in the background.

Related

Auto unlock screen in batch file

I want to run a batch file which set in task scheduler without display console window, my batch need open one wpf app at the end. I tried to set Security Options in task scheduler like this https://i.stack.imgur.com/IgfjU.png, the console window really disappear but my app run in background process (see in task manager) so that I can see it in screen. Since this reason, I change to lock screen by using LockWorkStation(); of user32.dll but I can't auto unlock it. So could I do to unlock the screen?
If can't do it, I want to display a image full screen on top while run batch to hide every thing or any else to notify user that machine under maintenance or in idle as ATM machine do. Currently, I can only open an image with maximized but not full screen. Please help me solve this.

Setting foreground window with Windows scheduled task

I build a fullscreen GUI application for Windows (using LabVIEW but the language should not matter much) that should start with Windows.
I want it to be fullscreen (hiding the Windows taskbar), so I set the window bounds to the screen's resolution.
When I manually launch the exe from explorer, the window hides correctly the taskbar.
But when I launch it from a scheduled task at Windows logon, it is behind the taskbar, until I click on the application. Same thing when I run the scheduled task manuallay in the task scheduler.
I tried the Win32 API function SetForegroundWindow but without success. Maybe the conditions are not met but I do not understand why, there is no other visible window.
How could I force the fullscreen of the app when it auto-starts?
If this is impossible from the application itself, an external solution to the application's code might be ok (e.g. some script running with the scheduled task), but I don't see one either.
Hey so I was having the same trouble when I scheduled a full screen application to run at login. the way I got around this was by creating a mouse click macro and scheduling it at user login with the app (had to set a 10 second delay to allow for the app to load).
It's a bit dodgy but it got it done for me

How to close windows 8 store app from background task

I have a windows 8 store app and a Background task is also associated with it. Everything working fine. And my question is, is there any possibility to close my app from BackgroundTask Run method ?
thanks for suggestions.
No, You can't do that instantly!
But you could save a file in your app's local storage -or settings- and let the foreground app check for this file every 10 minutes -whatever- and close the app in a specific condition ..
Your background task can be hosted in its own dedicated process or it can be hosted in the same process as your UI. In a separate process your foreground app can open and close without impacting your background process. In the shared process when your foreground app closes, so does the background task. This is not true in reverse, the shared process model does not allow a closing background task to close the foreground app. Too bad, huh?
Technically, it is not recommend that a foreground application close itself. But, hey, that API is there for something, right? When the background task shares the process with the foreground app then it can communicate directly between them with shared memory. This would introduce method 1 for communicating from your background task to your foreground app - probably by using a static event.
If that's not what you want, and you need separate processes, then your options are a bit more tricky.
Here's the best option:
You set a special setting (let's say it's ApplicationData.LocalSettings.Values["DataFromBackground"] = "PleaseExit") and then call the ApplicationData.SignalDataChanged method from the background task which will raise the ApplicationData.DataChanged event handled by the foreground app. How much lag will there be? I am not sure, but there will be some, so be ready for that.
Be sure an remember to set DataFromBackground back to some empty value, including calling Value.Remove() so you don't mistakenly process it again. That being said, you should also poll for that value when your application launches (or resumes) in case your background task wrote it while the event could not be heard.
This is probably the easiest way to implement communication.
Make sense? I speak more on this in my Ignite session on the topic.
Best of luck!

Autoit anti-idle script after screen lock

I'm trying to make an simple anti-idle script (that moves the mouse or whatever) to prevent an application from stopping.
How can I keep it running after screen lock ?
It seems like this is explained in the Autoit faq :
http://www.autoitscript.com/wiki/FAQ#Why_doesn.27t_my_script_work_on_a_locked_workstation.3F
On locked station any window will never be active (active is only dialog with text "Press Ctrl+Alt+Del") In Windows locked state applications runs hidden (behind that visible dialog) and haven't focus and active status.
So generally don't use Send() MouseClick() WinActivate() WinWaitActive() WinActive() etc.
Instead use ControlSend() ControlSetText() ControlClick() WinWait() WinExists() WinMenuSelectItem() etc. This way you may have your script resistive against another active windows. It's possible to run such script from scheduler on locked Windows station.
You can't automate anything after your screen is locked. User input is simply ignored. A much easier way would be to prevent your screen from locking, for example, by moving the mouse randomly every 30 seconds.

Make screensaver fire whenever computer locks?

Is it possible to force the screensaver to appear whenever a computer becomes locked? Specifically on XP, 7 if possible.
Windows has several desktops. You're familiar with the one you are looking at right now. There's another one for the login screen. And there's one for the screen saver. Locking the workstation switches the desktop to the login screen. You cannot switch back to another desktop (like the screen saver one) until you login.
You can however get the screen saver started, that selects the screen saver desktop. Which automatically switches to the login desktop if you configure the screen saver that way.
I believe that the SS is only triggered when the timeout is reached, regardless if the PC is locked or not.
The other way to think of this is to lock the PC whenever the screensaver fired.
Windows 2000 and above has an option to enable lock the PC when the screensaver is active, just enable this, and set the timeout and you are ready to go.

Resources