Customizing Print to File in WIndows - winforms

I have a requirement where my client want to install a custom "Print to File" printer (apparently MS has an SDK for this?). They want to be able to install this as a kind of "application" so that if someone chooses to print to this printer, they have to answer a few questions, and the file gets "printed" to a path of our choosing. (we will then do some other things with the file such as rename it and SFTP it)
I have tried googling, looking for things such as "customize print to file" and I have found nothing. Does anyone have any experience with this and can give me a kick in the right direction?
EDIT: I would rather have a c# oriented solution but I am willing to take anything right now.
Edit 2: The idea is for this "custom print driver" is for a document imaging company to provide an easy method for their customers to store/archive documents. The idea, is that the customer, if they want to store/archive a document, they would print, from standard windows applications such as Word, Excell, Acrobat Reader, Web Pages, etc., to the "company X" printer driver. When doing so, the document would get "printed" to a file in a specific location that another application (which has a filewatcher service on it, which would rename it and send it to the SFTP server), knows to watch. The document that is printed to the file, should ideally also be able to come out on paper (AKA just like normal). When printing to the "Custom print driver", we also need to have a form filled in which would provide meta-tags for the archiving system, which would also be uploaded to the document imaging system.
I am not looking to recreate a printing application, nor am I looking to add "printing" into a custom application. This needs to work at the Windows level.
I have no problems with the SFTP, FileWatcher, Alchemy integration (the document archiving application) or the document renaming portion. It's the "custom print driver" that I am having issues with. This is all compounded by the fact that when installing the application, I need to automatically install the "custom print driver", and configure it during the install process. Essentially the solution needs to be installed as a printer available under "My Printers" and should be available for any type of document, Word, Excell, PDF, etc. Oh, and it needs to be availabe for XP, Vista, and Windows 7 . . . . :(
Thanks in advance for everyones help. I have a feeling that this one is going to be a doozy :(

Hah! I knew I'd seen at least one...
ActMask Virtual Printer Driver
Can't make a recommendation of any sort not having tried this particular toolkit - but it would appear to me to bear a strong resemblence to the sort of solution you're after.

What kind of customization you are talking about? Can't you use the .Net inbuilt one?

Related

How to lock an exe file?

(Sorry in advance, if I have the wrong tags)
Hello!
So I am trying to work on a personal WPF project which would allow the client application exe to download another application exe (Unity Application) and open it within the client exe's Grid. Everything is working fine.
But, I am wondering if there's a way to "lock" the downloaded application in a way that only my client exe can open the downloaded exe?
Here's the only solution I have thought of but not sure with
Check for command line arguments within the Unity Applications
This works well but people who knows about the existence of decompiler might be able to decode that I am trying to check the arguments, and input relevant data there. :(. So, it won't help too much?
Thanks for any insights.
-Kevin
There is no non-hackable solution, you can only make it harder for crackers to break into the app by code obfuscation (hard to read the code) + adding integrity checks (make sure that your app is not modified).. There are commecial apps out there to do this (ex. PreEmptive), and their solutions differ from each other, nothing is ultimate.
Anyway, You might make Unity Application read some file or some registry value that Client application has updated just before launching the Unity Application, along with command line args method that you mentioned..

Parse and Display ESC/POS file in windows

I am trying to parse an ESC/POS file which is created by the POS Printer Driver and display it on windows. Unfortunately I couldn't find any parser / renderer for that and I've been researching this for 2 weeks now.
All the existing solutions are build for the other way around, meaning - for creating ESC/POS files but I need the opposite direction which is taking an existing ESC/POS file and display it in my windows application.
Does anyone have an idea how this can be done? Thanks!
The language is dead simple and well documented. Of course, there may be extensions for newer printers or other vendors, but in two weeks you could have written a parser.

Listing and finding windows on OS X

I am trying to do some stuff on OS X using the carbon api, but I can't find anything I am looking for on google or the Apple development website.
Ideally I would like to find a function that finds the window at a certain location on screen. It seems that there are similar functions, but one of them says that it only finds windows in the current process, and the other says that it is for locating the destination of mouse clicks.
Assuming that there is no way to do that, how would I go about iterating through all the windows on the screen. Finding information about how the OS X window manager works is quite difficult, because it has no name, and any google search is overpowered by referenced to the operating system Windows. Does it have nested windows? What is a window list? Is there only one? does each process have one? can you create arbitrarily many of them? I tentatively guess that GetWindowList is what I am looking for, but there is no example, and the documentation is all vague "Gets the next window", without any explaination of the abstraction or example code.
If someone could either explain how I could do this, or how the window manager sees things, or point me to somewhere I could read about it, that would be great!
I think what you're looking for is Quartz Window Services, part of the Core Graphics framework. You'll probably want to start with the CGWindowListCreate() function to get a list of ID numbers for the windows on screen, which you can then use to get further information about each individiual window.

How to safely remove orphaned values in the Windows registry?

I had an application installed on my windows machine which I removed, but it has left an orphaned drive icon under "My Computer". Having dug through the registry, to find it by name, it seems to be associated with a GUID that occurs in other parts of the registry. I'd like to write a quick C program to do the job, once I understand what it is I need to remove. I understand the API, but what is all that cr*p in the registry? Short question: what registry values do I need to remove to reliably delete the unused drive icon? Longer question: where do I find out how the windows registry is organised at that level, to achieve the required result? I've looked on MSDN, but either the information I require is not there, or I don't know what I'm looking for (I'm not a windows programmer, but I do know a little about coding...). RTFM answers welcome, I'd just like to know which FM to R...
Have you tried tools like CCleaner?
Short anser to the longer question:
No such documentation exists. The registry is a rather ad-hoc pile of data, shared between many developers in- and outside Microsoft.
Try RevoUninstaller if CCleaner does not help and you have not already coded something for this yet.
TFM - About the Registry
TFM - COM Registry Entries
TFM - Shell Extensions
TFM - Registering Verbs for File Extensions
TFM - Registering Preview Handlers
TFM - Registering Programs with Client Types
As easy as eating pancakes

Best place to save user information for Windows XP and Vista applications

I need to save a user's login information in encrypted form for this application I'm building, but I'm not sure of the best place to save the file. I don't want to save it into the program application folder as I want it per user.
So what is the best folder (or way) to save it into?
Edit: Using C++.
Seems like C:\Documents and Settings\%username%\Local Settings\Application Data may be the appropriate place according to Wikipedia. The article says this location is used for "User-specific and computer-specific application settings".
Edit: Cruizer pointed out in the comments (I'd reply there but I can't comment yet) that in Vista it is C:\Users\%username% and that it shouldn't be hard-coded. Thanks.
Use the Data Protection API (DPAPI) - a part of the CryptoAPI in XP and Vista. Here's a good overview of DPAPI - http://msdn.microsoft.com/en-us/library/ms995355.aspx
Yeah, local application path looks like a winner.
I found this article in MSDN to get it in C++: http://msdn.microsoft.com/en-us/library/bb762494.aspx
Example:
char localAppPath[MAX_PATH];
SHGetFolderPath(NULL, CSIDL_LOCAL_APPDATA, NULL, SHGFP_TYPE_CURRENT, localAppPath);
are you using .NET? how about IsolatedStorage? That way you wouldn't have to worry about the directory location, it'll just be there...
User information should always go in some sub directory in %HOMEDRIVE%%HOMEPATH% (Which maps to the users home directory). No exceptions.
A good place for application specific settings per user is a sub directory inside %APPDATA%. This maps to: "%HOMEDRIVE%%HOMEPATH%\Application Data" on XP and to: " %HOMEDRIVE%%HOMEPATH%\AppData\Roaming" on Vista.
If you are using .NET to get special folders you can use
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
or
Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
for the non-roaming version.

Resources