I have application needs to print on 3 printers
i save the printers names in a txt file
the problem is when the user disconnect and reconnect the printer ( usb printer )
it takes anew name or anther name and the printing get mixed up.
how i select the printer if the name changed ?
I have had the same issue with USB cameras. They also tend to just create another instance/entry for the device under windows with an appended number (example: Epson Blah Blah #1) as soon as the device is moved to another USB port.
The answer most probably lies in the Device Descriptors. More specifically the HardwareID of the device.
For a quick way to see a device's HardwareID go to Control Panel > Device Manager (if Win7 or above) then right-click on the device whether it be a USB Flashdrive or USB Camera. Click on properties and goto the "Details" tab. Change the "Property" value to "Hardware Ids". You will see the HardwareIDs
You can find more information on that here:
https://msdn.microsoft.com/en-us/library/windows/hardware/ff539283%28v=vs.85%29.aspx
and:
https://msdn.microsoft.com/en-us/library/windows/hardware/jj649944%28v=vs.85%29.aspx
The latter talks about the registry keys where you can also find the information of a device. The key would be:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\DeviceClasses\
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\USB\\\Device Parameters
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\USB
So if you can link HardwareIDs to a printer then you would be able to enumerate installed printers to compare with then select the one you want. So you will install a printer initially and let your application select that printer and save its HardwareID. Then everytime devices change on the PC you can just get the one that correlates to the initially installed printer.
I have not tested this as I am currently without two exactly same devices to make sure both don't have the same Hardware Ids.
Related
I take pictures every day with my iPhone S5 (iOS 14) and would like to store them in a day-wise directory on my Windows 10 PC.
To transfer the picture files from iPhone to PC, I use an USB cable connection, allow USB access on the iPhone and then copy the picture files using Windows Explorer.
The Explorer shows something like the following:
To automate the process, I tried to get the directory path, a home-grown utility tool could use to copy the picture files directly without my intervention.
I used the following C# routine to get to know the current path of Windows Explorer:
private void ShowWindows()
{
textBox1.Clear();
foreach (IWebBrowser2 window in new ShellWindows())
{
textBox1.AppendText($"{window.LocationURL}\r\n");
}
}
This works for normal paths on my SSD. But the iPhone paths appear to be different. I don't get any information about them. In Windows Explorer, there is no property dialog for these iPhone directories. I looked through the Windows CLSID list, but this did not help either.
How can I programatically copy iPhone picture files like normal USB flash drive files?
Or is it unavoidable to resort to special tools like iTunes?
The thing is that phones do not get mounted to the filesytem and do not get thier drive letter. Explorer communicates with them using WIA protocol. So you will need to write separate code to deal with images from iPhone.
You can find documentaton is here https://learn.microsoft.com/en-us/windows/win32/wia/-wia-wia-tutorial
I am storing all the config details to a test.cfg file in my BlackBerry device. So every time when i start the application, the app will check if test.cfg exists. If it exists, then it loads all the configuration from that file and if not, the app will show the config page, then the user can enter all the config details and proceed further.
The above is working fine except one scenario. When the device is plugged in to the system and I open the Desktop Manager and the user opens the application, its directly shows the configuration page even if test.cfg already exists in the device.
Does anybody know the solution for this? or any idea why its behaving like this?
My guess would be that when you connect your device to the computer via USB cable, your computer is mounting the SDCard as an external drive. When it does this, the device will essentially lose access to its SDCard. It needs to do this, because the device software and the desktop computer's software don't want to simultaneously be modifying the same files.
Are you saving test.cfg on the SDCard?
If so, you might want to save the file to the device's internal storage instead, for example, in the PersistentStore.
You could turn off the mass storage feature that makes your SDCard available to the PC, if you prefer to have the media card always available to the app. (if you want to do this, tell me which OS version you're using ... but, understand that this only works for you, and isn't a good solution if you want your users to avoid this problem).
You can also test for the SDCard in your app, programmatically
References
Reference on BlackBerry support forums
Data Storage Development Guide on BlackBerry.com
Go to option -> Device -> Storage and deselect and select the media card support and save it and come out the option.Now try to access the media -> explorer folder u can able to access it and also my apps can read the file when its connecting to USB drive now.
I am looking for a screen shot tool that I can use to capture screens from my BlackBerry Tourch 9850. I have tried using the included JavaLoader utility with my SDK but I receive "Retrieving screen <active> data ... Error: buffer too small" errors. I have also tried using the BBScreenShooter v1.67 (I think this is the latest version) but it fails to capture the screen, then crashes.
I need the tool to create a user manual for some software we're developing for BlackBerrys and, as they say, "a picture is worth a thousand words."
If nothing else, perhaps someone knows how to address the small buffer problem with JavaLoader?
With the help of Mark Sohm (thanks Mark ... your help is very much appreicated) the solution was discovered: You have to use the JavaLoader from the v7.0 SDK on devices that have the higher screen resolutions ... the Tourch 9850 is 800 x 480. Versions 6 and lower do not have an implementation that will support the larger buffer required to grab the addition bytes - makes sense.
Although I have not tested it yet it's certainly possible that the BBScreenShooter would work also knowing this .... BBScreenShooter uses JavaLoader to handle the "heavy lifting" with the handset.
Try this way:
Create an application that runs on device startup and listens for GlobalEvents (via GlobalEventListener implementation)
Run this application in JDE or Eclipse and monitor what global events are fired when you press convenience keys on your blackberry device. Write event guids down and find out a guid that corresponds to a convenience key, when it is pressed.
Modify the application created at step 1 to use Display class and invoke screenshot() method of this class when a convenience key is pressed.
As screenshot has been created save it to the device filesystem via BlackBerry FileConnections API. After that you can copy these pictures to your desktop computer when device is connected via usb-cable.
That's it. This application will allow you to solve your task. And may become an additional product for your company, if you add some settings to setup convenience key(s) and path to save created screenshots on device memory/media card.
I'm not sure how to actually fix your problem but alternatively you could just run the application in the device simulator and get the screenshots from there. Run the simulator and go to "Edit" > "Save LCD Snapshot".
Is there a list somewhere of all Apple USB product IDs? I use IOKit to get notifications for attached/detached USB devices and would like to identify the device. Currently I get the device name and search for "iPod" and "iPhone" but I guess that's not really safe since it could also be an accessory (or could it?).
I found this USB Product ID list but unfortunately it's not complete
See the links below. Note that a device will have different product IDs, depending on the mode that it is in. Also, multiple devices share IDs for DFU mode and Recovery mode, so you won't be able to fully tell them apart.
http://theiphonewiki.com/wiki/index.php?title=Normal_Mode
http://theiphonewiki.com/wiki/index.php?title=Recovery_Mode_%28Protocols%29
http://theiphonewiki.com/wiki/index.php?title=DFU_Mode
I am working on a web development project that I want to make sure works well on the BlackBerry browser. As part of both testing and documentation, I want to be able to take screenshots of my application and was wondering where to start.
I see there are a couple of pay applications on BlackBerry App World when I search for screenshot, but I am looking for recommendations or other options. Specifically, I have a Bold 9700 (v5.0.0.296, platform 5.1.0.83).
It appears this feature is built into the iPhone, according to the iPhone User Guide.
Take a screenshot of the iPhone
display: Quickly press and release the
Sleep/Wake and Home buttons at the
same time.
You may want to write you're own app or service to make screenshots.
Use
Display.screenshot(Bitmap bitmap)
or
Display.screenshot(Bitmap bitmap, int x, int y, int width, int height)
Note: you should sign app to use this api
If you have the developer tools installed, you can use "javaloader -u screenshot file.bmp" to capture a screenshot. Otherwise, the easiest way is to install a PC app called Master Control Program which has the capability to capture screenshots as well (as long as you have your device connected to your PC with a USB cable).
I get BlackBerry screenshots in two ways:
-On real devices I connect them to my PC over USB and run javaloader -u screenshot image.bmp from the command line (as Marc says, it's included with the developer tools).
-The BlackBerry Simulator makes it easy to take screenshots by pressing F3 (or choosing Edit -> Save LCD Snapshot from the menu, note you can choose to save directly as a .png, which is handy). You can change which phone model to simulate based on the SDK you have installed. For the 9700 I think you will need the V5.0 OS SDK (I haven't tried that yet), which you can get from here.
BBScreenShooter http://oppitronic.net/pb/ouiVC.php#BBScreenShooter
I've also heard of something called BB Stream that will actually stream the blackberry screen to your PC. Can't find it anywhere though.
This is a very good guide
http://www.aboutonlinetips.com/taking-screenshots-of-blackberry-screen/