We are creating a display system which we will be running on top of Windows 7 embedded.
The computers will not have keyboard or mouse, thus will have no direct user interaction.
Since these computers will only be used during certain times we would like to define schedules for them and make them power off (including their screens), and automatically power on again at specific times.
For this, we need to be able to set the bios WakeOnRTC timer from code. It is not sufficient to wake from hibernate or sleep, as referred to at Schedule machine to wake up.
I know from others that MythBuntu can do this, but that is Linux-based.
I've also heard this is easier to achieve with UEFI-bioses that are emerging.
At this point we are open to select any bios if anyone has a solution.
I'm not going to put too much because this question has already been answered, see the following links.
C#: How to wake up system which has been shutdown?
http://www.codeproject.com/Articles/49798/Wake-the-PC-from-standby-or-hibernation
In short the solution revolves around the following two Win32 API functions:
CreateWaitableTimer
SetWaitableTimer
Related
Even though my long title spoils quite a lot of my question, I'll try to be more specific here.
I have 5 VMWare instances that all have their own tasks to do. They are hosted on one same computer. But I need one program (that I'm actually writing, duh) to get informations and to send informations such as keystrokes and mouse clicks. But from what I've red so far, communication between programs is quite hard to achieve and I haven't found any way to send keystrokes to an unfocused or reduced VMWare windows. Plus I would need to send different and specific keystrokes to each of my 5 VMWare instances.
My program will starts itself each 5 tasks in each 5 windows. The order doesn't matter as long as each instances have its own tasklist. I would need a way to keep track on each window's identity so I don't send let's say window 4's keystrokes to window 5. I would also need to be able to check periodically if each VMWare's instances is doing its job. Additionnaly my VMWare's instances are all running in a win7 environnement.
Now that the whole situation is explained, I'll sum up the question I'm currently submitting. Is there any way for my C# program to keep track of 5 VMWare's instances' identities and both send keystrokes (+ mouseclicks) and get at least screenshots of what's displayed on each of them even though they are reduced or unfocused ?
Thanks a lot.
Is there a way to get
You have an incorrect understanding of how VMWare works. VMWare isn't "running in a window". VMWare is running in a virtual machine at a very low level in your computer. What you see as a "window" is merely a "viewer" that allows you to connect to the remote machine (even though it's running on the local computer). This "viewer" is an application similar to the remote desktop client, or a VNC client. As such, there is very limited interaction between the OS and the host OS and the applications running in the guests.
This means that your host OS doesn't know anything about the individual applications running inside the guest OS, and you can't see it's window handles, or control mouse or keyboard events. In fact, the VMWare drivers "capture" the hardware and steal these events directly from the hardware, so there is no real way for your application to simulate a human interacting with the Virtual machine window.
What you COULD do, and this would be a lot of work, is create "agents" on each of the virtual machines that would have access to the applications running on them. These agents could listen for events on the network, and you could send events to them to do what you want. However, as I said.. this is likely a lot of work.
This whole thing sounds kind of cheesy to begin with, like you're trying to do something the hard way, but since you haven't told us what you're ACTUALLY trying to do.. we can't suggest any better alternatives.
A quick and dirty approach is to look into Visual Studio Test Controller and Agents. The idea is to install the agent on each one of the machines. You can then leverage the MSTest framework (wrongly called unit tests) to execute you c# code one each agent.
There are apps on Android such as Tasker and Trigger that allows the user to set up some "Triggers" and the "Responses" that should execute when each trigger triggers.
The triggers could be, for instance: Connecting to a certain Wi-Fi, Arriving a certain location (Geo-Fencing), Plugging the earphone, tapping an NFC Tag and so forth.
I wonder if there's any way to to something like this on the Windows Phone platform. I have no background in developing for WPhones (even though i have a huge C# background), so i'm not sure whether the platform itself allows this sort of "background monitoring of sensors or, if there are such sensors (such as "headphone plug").
After a quick research, seems that access to some APIs are not allowed from Background Threads, i wonder if there's anything related to security here, or just an inability of the platform.
Is there any way to achieve what i want?
On Windows Phone 8 you can perform background processing, with Background Agents.
You can use Sceduled Taksto register a class containing a method that is called periodically, even when your app is not running. They are multipurpose and offer the greatest utility for extending your app to perform background activities.
You can surely display a message to the user, or fire an alarm or something, a message would be more suited, for location aware apps. Those registered as geographic location providers are able to continue running despite there being another app running in the foreground.
For the rest of your triggers, I'm not sure. You'll have to check the Sensors.
No, you can't hook any triggers or events. The only thing you can, as Pantelis said, is to create very limited PeriodicTask that may or may not be run every roughly 30 minutes and be constrained to max 25s of running time. This is deliberate platform limitation, AFAIK done mostly because of battery usage and security reasons.
If something can't be achieved by PeriodicTask, give it up. This is the most versatile background process, others are even more limited. This is by design to prevent daemons from taking over the phone.
With many new devices such as the Vaio Duo, Vaio Flip, XPS 12, Lenovo Yoga, etc., which are all ultrabook/tablet convertibles, how can I detect which form factor its currently operating in? I know that the Vaio Duo switches performance modes depending on whether its being used as a laptop or as a tablet, so there should be some way, whether it be through pinvoke or something else.
In Windows, to directly check if your system is in tablet (or "slate") mode or not, you can call GetSystemMetrics(SM_CONVERTIBLESLATEMODE). For a discussion of a sample app that does this, check out https://software.intel.com/en-us/articles/how-to-write-a-2-in-1aware-application.
As well as checking on startup, you should be able to get a WM_SETTINGCHANGE message if the mode changes, which will have "ConvertibleSlateMode" as its LPARAM. In some cases, though, we've seen this message lost. So, it's a good idea to have a manual way to force a mode change in your app anyway.
Shouldnt your program work the same for all form factors, so there for it wouldnt matter which form factor there in.
Also have a look at this if you do need to access that sensor then this may help you.
http://archive.msdn.microsoft.com/WindowsAPICodePack/Release/ProjectReleases.aspx?ReleaseId=4906
This will get you all of your sensors.
Microsoft.WindowsAPICodePack.Sensors.SensorManager.GetAllSensors();
I've been working on this today. So I decided create a wrapper cause I haven't found one. I focused on universal portable class library (because of dispatcher used in monitor) but I can port to...
Here is:
https://github.com/daemun/DeviceExtCapabilitiesUniversal
Found a lot of information on this here: http://software.intel.com/en-us/articles/ultrabook-and-tablet-windows-8-sensors-development-guide
How to prevent terminal (Windows-CE) from shut-down after 5 minutes
the terminal is Motorola MC3190 (Windows-CE) and if i dont touch the screen for 5 minutes
the terminal shut-down. how to prevent this ?
i need the solution in C# code.
thanks in advance
I initially voted to close, but have been thinking more about this, and I think the question you've asked may have been missing an important piece of information.
I think what you need to look at are the Windows CE Power Management functions, specifically SetPowerRequirement. This allows you to indicate that your application is using some device within the system. If not, it's unclear why your application, absent some device interactions, wants to prevent power management from doing its job.
No code needed for this. Go to Start->Settings->Power and uncheck the box next to "Turn off screen if device not used for".
If you tried to do this programmatically, you would be draining the battery power faster than the user intends. That will probably irritate your user.
If your heart is set on doing this, then you can modify the value in [HKLM]\System\CurrentControlSet\Control\Power\Timeouts
I also gave this answer on the MSDN forums
-PaulH
I dont know Windows-CE and i Dont know C#, but I found you an answer on google. Here you go. And now I want to try programing something for some station. Would be great home control device.
Is your Motorola MC3190 configured to Turn Off if it is running on Battery Power? Will it ever turn off if on External Power?
NOTE: I had to post as answer to show image, but this isn't really an answer.
EDIT: If this is what you are interested in, consider reading the device's SystemState property. There are many members to SystemState, and one of them just may be what you are after.
There is no easy technique for what you are wanting to do, because the devices are designed to power down when not in use. If the battery goes dead, the devices have to be completely reset. Make sure this is what you want to do, because there is a reason it is hard to get around.
You'll likely have to register for a BatteryStrength changed event (like >> THIS <<), then try to trick it somehow ...maybe by popping up a dialog box or simulating a key press.
You'll most likely need to P/Invoke some of the lower level coredll.dll functionality (examples >> HERE <<) to get what you want, as this stuff doesn't come wrapped up in the standard WinMobile SDK.
EDIT 2: Here's a Great example that someone wrote to read and control as much of the Power State as possible: techlicity blog I liked it so much I've copied the code to a class in my Mobile Project!
I have an application for PDAs with a long running process, and I'm getting the problem that the PDA is going to sleep before the process has completed.
I haven't got any control over the power settings on the PDA, does anyone know a good way for my application to stop the PDA from going to sleep?
Many thanks
Have a look at:
http://www.pinvoke.net/default.aspx/coredll.SystemIdleTimerReset
You need to make a function that calls SystemIdleTimerReset, SHIdleTimerReset and simulates a key touch. Then you need to call it on a regular basis from within your application.
For an example in C++, look here:
Disable sleep mode in Windows Mobile 6