Emulator vs Device - device

Using C# how do I know if I am running on a device or emulator?
I use the devicename to retrieve data, there will be no data for an emulator;
so i will manipulate the emulator name to retrieve data.

Since you mentioned the words C# and device in your question I'm assuming you mean a Windows CE or Windows Mobile device. If that is the case the following link will help. It details how to PInvoke the SystemParametersInfo function to determine the OEM name for the device.
https://blogs.msdn.com/netcfteam/archive/2006/09/15/756755.aspx

I would think that if it were a REALLY good emulator, your program would never know the difference. ;)

Related

Is there any way Not to detect USB from windows PC?

Is there any way Not to detect USB from windows PC?
The USB device should not mount on windows PC ,It should be handled by my application..
Suggestions please...
As far as I know there is no way of stopping the mount on the windows PC, however, you could set it up to autorun so that when it is plugged it in attempts to launch your application. This answer has some information on how to do this: https://stackoverflow.com/a/255067
There is also the option to hide a drive in windows by removing is drive letter (http://www.howtogeek.com/97203/how-to-hide-a-drive-in-windows-so-that-no-one-will-know-its-there/) however, this is almost certainly going to stop your application from reading it too.
If this is for a specific security reason then perhaps you could look at encrypting the drive and allowing only the application to decrypt the data. Thus, whilst mounted in windows it will be of little use.
Sorry I couldn't be of much more help.
Microsoft provides a utility called devcon for free download.
It's a "Command Line Uility Alternative to Device Manager".
It can actually do many things that I won't get into here, but removing a plug & play device is a simple operation once you know the unique name of the device you want to manipulate.
Refer this to check how to work with it.
It sounds like you don't want your device to show up as a drive in My Computer. In that case, why are you using the Mass Storage Device class at all? You could make a custom, vendor-specific device and talk to it using control/interrupt/bulk transfers with WinUSB. You would need to change the Device's USB descriptors to indicate it is a vendor-specific device and not a mass-storage device.

Windows phone debugging in device

I am a windows phone app developer. My PC do not have enough graphics to support windows phone emulator. So I am developing application by using the windows phone device (HTC HD7) for debugging and testing from almost 5 months now. Now my device is so hanging and switch-off automatically sometimes. Is it bad for the device to use the developing purpose rather than using emulator ?. Is my device have problem because of the continuous use for developing ?
I think it is not a problem in using device for the developing purpose.
Looks like a fault in the device - I'd send it in for repair. I've certainly not heard of debugging causing issues with devices.
Do check if your internal storage is about getting full. Also if you have minimum RAM config, try not using multiple apps while debugging. Probably this should help.
And nonetheless, you can just visit a technician and get your phone thoroughly checked for issues.

Windows phone emulator

I want to develop app for windows phone but I got a big problem, my laptop can't run the emulator, after checking the requirements I know that my vga driver doesn't support it. My question is, are there any alternative for windows phone emulator instead of the officially one from Microsoft? Or any other way to tweak it to be run on my laptop? Thanks
From my understanding there isn't any other windows phone emulators. If you can get a hold of a windows phone 7 it would be possible to test on that. You can try to contact a Microsoft windows phone evangelist in your area, the one in my area helped me get a phone to test on.
I am not sure about tweakinging your laptop to get the emulator to work. Is your vga driver up to date? If not maybe try to update it. I know it takes quite a bit of computer power to run the emulator smoothly.
If you wanted you can try to register for a virtual lab, here you remote into a windows machine and are able to build and test on the remote machine, but it is time limted and is usually for a class to learn about it. https://msevents.microsoft.com/CUI/EventDetail.aspx?culture=en-US&EventID=1032485600&amp%3bculture=en-US

Finding the graphics card device ID without drivers installed

I need to create an automated process in which a script detects the graphics card type on first boot, then installs the appropriate drivers, which will be included in the image, before performing the next steps. The target platform is Win XP Pro.
I came across some WMI code which can get hardware information but since it uses a PNPSignedDriver class I would presume that it requires drivers to be installed before it can detect the device.
I can't use devcon, as it isn't redistributable. Am I right in assuming that WMI cannot help me here, and if so what are my other options?
Thanks,
Bill.
WMI does seem to be the way to do this, as found here. I will confirm after testing.
EDIT - Not sure if this is possible, WMI can only get the name of the display adapter not the device ID of the card, and before the drivers are installed this is something generic like "Video Controller (VGA)". I will update this page if I find a way.

Resetting a device in device manager

I am looking for a programmically API on how to restart any device that allows enable/disable in the device manager,
such as Audio devices and Network adapter
You will have to use SetupApi / ConfigManager API. But be aware that under x64 you app. must be also x64 to enable/disable device (so you cannot do it in Delphi directly right now - first I thought that it's a problem with file/registry redirection for x86-app under x64, but it didn't help). Device enumeration works fine. There was something about it in one article on MSDN but I cannot find it right now. I've made FP/Lazarus x64 application for enable/disable devices under x64 OS.
You can download WDK and look for source code of DevCon (C:\WinDDK\7600.16385.1\src\setup\devcon). In cmds.cpp there is function ControlCallback which enables/disables device using SetupApi). But first you need to enumerate device classes (by GUID or ClassName), and then enumerate device instances or open device by DeviceInstanceId string. It's in C but it should be easy to learn how to use that API.
Not sure what you are doing, but maybe it would be easier to use that devcon.exe (don't know if license permits it) and enable/disable devices by it?
I have no experience with it but I think you can use the DeviceIoControl API.

Resources