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
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.
While trying to use both cameras for windows phone app i am not able to display both cameras at the same time..
one of them freeze when the other is working. i used the same code that has been given for reference here:
http://msdn.microsoft.com/en-us/library/windowsphone/develop/hh202956(v=vs.105).aspx
any suggestion or code that shows an example of it?
This scenario is not supported by the API. Opening an additional instance of the camera will close the previous one.
However, to behave nicely with battery usage, you should explicitly .Dispose the device as soon as you are done with it (instead of relying on the auto-close behavior).
(Note that some hardware actually shares resources between the FFC and the BFC, so even if the API allowed for it, it is still unlikely to work with the current version of the OS).
refer this link
http://social.msdn.microsoft.com/Forums/wpapps/en-US/cdefd4cb-94f8-4d98-a4b4-7671606815c6/can-i-use-frontcamera-and-primary-camera-at-the-same-time
but in the phone like S4 it is possible
refer this link
http://www.wpxbox.com/dual-shot-camera-apps-wp/
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!
We are developing a platform with Windows CE 5 (soon to be upgraded to 6) in .Net CF 2 C#.
What we have recently discovered is that if we are touching the touchscreen while using our peripheral, the peripheral data trafic times out and our application crashes. So it seems like the touchscreen is blocking it. As a quick fix we would like to disable the touchscreen while using the peripheral, and the reenabling it.
So our question is, how do we do it?
Do we need some extra packages in the OS build or can we do it manually. We have had a look at touchpaneldisable() and touchpanelenable(...). But the enable method requires a handle to the callback function. So I have no idea on how to fix this.
From an application perspective tehre really isn't a fix. Touchpanel ddrivers a re alittle different than otehrs becasue they get loaded by (and into) GWES, rather than device.exe. They are not designed to be disabled and enabled, though some OEMs do provide the capability (typically by just masking the touch panel interrupt).
It sounds like the touchpanel sampling rate is really high and the device is saturating the processor when it startes sampling. It's something that the OEM probably needs to fix. Some OEMs do provide registry entries to adjust the driver behavior, so check with them to see if this might be available to you. In that case you may be able to fix the issue yourself.
If you have the BSP you might want to go through this blog post as it suggest possible bottle necks for the touch driver.
Several years back, I innocently tried to write a little app to save my tactically placed desktop icons because I was sick of dragging them back to their locations when some event reset them. I gave up after buring WAY too much time having failed to find a way to query, much less save and reset, my icons' desktop position.
Anyone know where Windows persists this info and if there's an API to set them?
Thanks,
Richard
If I'm not mistaken the desktop is just a ListView, and you'll have to send the LVM_SETITEMPOSITION message to the handle of the desktop.
I googled a bit for some c# code and couldn't find a example, but I did found the following article. Torry: ...get/set the positions of desktop icons?. It's delphi code, but I find it very readable and with some P/Invokes you'll be able to translate it to c#.
The desktop is just a ListView control and you can get its handle and send messages to it to move icons around using LVM_SETITEMPOSITION.
Getting icon positions using LVMGETITEMPOS is a bit more complicated, though. You have to pass a pointer to a POINT structure as your LPARAM. If you try to do that, you will likely crash Explorer. The problem is you passed it a pointer in your address space, which the control interpreted as a pointer in Explorer's address space. Ouch!
The solution I've used is to inject a DLL into the Explorer process and send the message from there. Then you just have to have a way to get the position info back to your process.
I am still looking into this and will post the result once I finally get something working. I'm posting this because, thanks indirectly to Davy's post, I also found a classic VB implementation:
Shuffle Desktop Icons Using Interprocess Memory Communication
and that will probably be the basis for my code.
I have no idea about the API, but I know Ultramon (http://www.realtimesoft.com/ultramon/) has a feature included for preserving icon placement (although I've never used it for preserving icon location, it is indispensable for multiple monitor usage). The latest beta release works flawlessly with Vista (except for sometimes having a minor glitch or two when initially logging into my machine via RDP), and of course, haven't had any issues with XP. I've used it for over four years now.
And did I mention that it's the best utility for multiple monitor usage?
may be you want this one?I find it in 《WindowsCoreProgramming 5th》 https://github.com/wang1902568721/WindowsCoreProgramming