How can I detect that a windows printer is printing to file - printing

I have a service application that generates files to print as a result of user action. If the user selects a printer that "prints to file" the service hangs waiting for a file name to be supplied. Is there anyway I can detect that the printer I am printing to is sending data to a file rather than a device?

Check the name of the port that is connected to the queue. If the name is "FILE:", then windows will show a dialog asking for the output file name.
The user might of course also use some custom 3rd party port monitor, in that case you would need to go thru the window/dialogs for your process, and check if there is a modal dialog waiting for user input.
If it is a V4 printer driver, you can also check out the DriverCategory, if it is PrintFax.Fax, PrintFax.Printer.File, PrintFax.Printer.Virtual,...

Related

Rails send data to a serial on client

I need to print from my rails app to a printer on the client side of my app
How can I acess the printer from browser to print on client side with rails?
Browsers won’t let you do this without user interaction (the user will need to select print from the file menu while looking at your app’s page).
If you’re ok with that; then this isn’t so much a rails problem as creating a view which will print nicely. For that you’ll want to look at css for print media types.
But before we get any deeper - do you require that your web app have direct access to the printer without user interaction?

Host page locally on iOS

I didn't know it was possible on iOS but lately I went to Japan and one of the free wifi apps wanted to install profile into my iPhone. When I confirmed installation it simply opened Safari with 127.0.0.1. It loaded some page and downloaded profile from there. How do I host some page on iOS?
Creating web server is nothing hard. It is lot of coding of course, but the principle is pretty easy.
There is lot of 3rd party libraries on the github (GCDWebService) just try to search for "ios http server"
To create it manually you need few steps:
1) With the help of CFSocketCreate you open new socket with specific port (standard HTTP 80, or secured one 443 should be forbidden without root access rights) what going to listen on network interface on incomming requests.
2) You need to prepare some receiver what will be triggered as soon as some request income. You can use NSFileHandle class and register NSFileHandleConnectionAcceptedNotification in your notification center. And allow background mode with acceptConnectionInBackgroundAndNotify method. But I recommend to read the manual first
NSFileHandle Apple documentation
3) Process the incoming request. The selector what you register is called and in NSNotification.userInfo property is the incoming request, and you can generate some page here and open it in safari, or in your app or do whatever you want.
4) If you want received some POST data or streams, there is needs to register NSFileHandleDataAvailableNotification what trigger selector as soon as some data to read are available.

Get HID Device data only from my delphi application

I have 2 keyboards attached via usb. I want that my application to receive input only from one of them. I tried to use the TJvHidDeviceController i sucesefully get a handle to the device but i can't get any data.
Is it possible to prevent other applications to receive input from the second keyboard ?
Is it possible for your set-up to not load a device driver for the keyboard you want to listen to? If it is, you could try this method:
Use QueryDosDevice to list all devices on your computer. You can either search the vendor and device ID in the list if you know them, or build a list before and after you plug in the second keyboard and see which item(s) appear on the list.
Use CreateFile with the \\?\ prefix to connect to this device and read/write raw data from it.

unable to get an account BIS

When I want to get an account BIS, a window popup appear like in the picture.
And to make the steps cited in the popup: option > theDevice > Advanced System Settings > Host Routing Table. Then I Pressed the Menu key and clicked Register Now. I obtain Registration message queued. It will be sent once data coverage is available.
You could try a battery pull reboot and see if it fixes it. If not try resending the service books .It sends the service books for the BlackBerry Internet Service. you can look here to get information about how to do it.

Communication Handling using Service in Blackberry 4.5

I am developing an app. (like google talk) which at phone boot-up starts a background service which is continuously running. This service interacts with UI (means any request to server is first sent from UI to service & from service to server) & any response is sent to UI through service.
What i know to start background service at boot up is "Create an alternate entry point and use that to start the background service. "
right click the project properties then go to Application tab, then check "Auto run on startup" / "System Module"
is it right?
In Android u can achieve this Service using system-defined Service class. How to achieve this in Blackberry 4.5? I want to do it (UI & Service) in one project.
Any solution?
Thanks for the reply.
I got a link for
"How To - Setup an alternate entry point for my application"
is it the right solution for starting Service?
I want the app. like email app. which will notify u when an incoming mail comes (like even though ur main application is minimized then also ur service is running in background which will continuously check for any incoming mail & will notify the main UI application through any app icon change)
So for this is there any class like Service class which will start at boot-up or "Setup an alternate entry point for my main UI application" is the only solution for this?
Thanks for the reply..
I read this GlobalEveltListener & tried for handling the communication between the 2 apps (Service app. & UI app.) by starting the Service at auto-startup.
I m using the "Persistent Store" & accessing it in both the apps. But the Persistent Store name should be unique otherwise it gives "Linker error: Cannot start the Service app. as Persistent Store is multiply defined." But I have to access the Persistent Store the both the apps to make some database calls.
So now i m trying for handling the Service by putting both apps in one project. So that the Persistent Store will be unique.
How to achieve this communication between Service & UI in one project?
You only need an alternate entry point if you want the program to behave in both the service mode, starting at boot and running in the background; and in application mode, having an icon in the home screen that the user can click to begin interacting with your software. In that case you need to have an entry point that tells the program "you are starting automatically at boot up", and one that tells the program "you are starting in response to user interaction".
There are other ways to handle this. If your application makes itself available to the user through ApplicationMenus, then you make the one and only entry point "Auto Run" and "System Module" so that it starts on boot, registers the menus and does not display an icon.
You can also use one entry point set to "Auto Run" but not a system module so the icon is displayed and detect the start on boot case using the ApplicationManager.inStartup() method.
The method you describe does work well for the type of application you are developing. It simplifies the initialization by allowing you to specify different arguments to the program in each entry point.
Please see the answer I have given earlier to a different question here. This essentially is an IPC mechanism between two running processes.

Resources