Create "printer" to print as PDF to SQL database - windows

I would like to create a "printer" that would display as an available printer when a user tries to print a document.
If this printer is used, a window will be displayed showing the available locations in the database that the document can be stored. The document will then be converted to PDF format and the resulting blob data will be inserted into the database.
I found a similar topic here: How to create own XP printer driver. However, some of the answers suggest using RedMon (which does not look like it currently supports Windows 7). The solution should be supported in Windows XP and up.
I thought I would start a new question to see if anybody has done anything more recently than that previous question.
Any help would be greatly appreciated.
Thanks.

You don't need RedMon. The top answer to the question you linked (the answer from Oleg) is precisely the answer to your question. Just take the Port Monitor sample from the WDK and modify it to do as you need. However, you will also need a print driver in order to create a printer. For that you can use the Unidriver or Postscript drivers shipped with Windows. All you'll need to provide is an .inf file that will install and name your printer appropriately and a .ppd or .gpd file to describe its characteristics. Many examples of both can be found readily in the WDK or online.

using pdfcreator or bullzip pdf as a printer to create a pdf file in a folder and then using use some folder watchers (like 'Watch4Folder') in order to trigger a script (to insert the file into a blob field), in a way that you can create several folders so you can customize the target database by choosing diferent folder where to "print" the pdf file.
Sorry for my english
Claudio

Related

How to extract data from Microsoft Visual FoxPro .app files?

I have been given some Microsoft Visual FoxPro application files and I'm responsible for extracting the data contained in these .app files. I haven't heard of VFP before but a quick search shows me it's going to be challenging to get the data out.
I asked the person who gave me the files how to open them. He told me to use the VFP program. I don't have the VFP program on my Mac and don't even know where I would buy it from.
Ideally, I'd like to open the VFP .app files in Excel or a database that can read the files and dump them into TXT / CSV files. I've read documentation on Microsoft that walks me through opening the files in Excel by creating a data source but I can't seem to get the OLE DB drivers working. I found some ODBC drivers that are unsupported by Microsoft that in theory could allow me to open the files in an ETL Data Integration tool. (Links of blog sources on this topic:
http://saltydogllc.com/in-visual-foxpro-using-32-bit-odbc-drivers-on-a-64-bit-machine/
https://www.berezniker.com/content/pages/visual-foxpro/visual-foxpro-odbc-driver ).
But I'm getting an error about architecture with 32-bit drivers running on a 64-bit Windows EC2 machine. The error says "Data Source name not found and no default driver specified". And the follow up error: "[Microsoft][ODBC Driver Manager] The specified DSN contains an architecture mismatch between Driver and Application".
I also have application files, not .exe and no access to the VFP database. Not sure if this last point matters.
Does anyone have experience with VFP? Anyone have advice for how I can open up these VFP .app files?
As Tamar has indicated above, you are most likely looking in the wrong place.
The App is the compiled executable code and it typically it contains NO Data.
VFP can use 'native' FREE data tables that would be contained in files with the extension: .DBF, .FTP (the Memo field contents), .CDX (the index files)
Or it can use 'native' data tables contained within its own VFP Database which would be contained within the files with extensions: .DBC, .DCT, and .DCX
You will most likely need access to VFP (or a contractor with VFP) to get ALL of this data into another format.
Remember that if this project is BUSINESS-CRITICAL, then it is worth spending the $$ necessary to get the job done - both expeditiously and right.
Lastly VFP can use data from an 'exterior' source such as from a SQL Server database, etc. via ODBC connections.
If this were the situation, you can use that Database's own interface to access that data.
Good Luck

How to tell if a specific file extension has a default program to open it? e.g. PDF, in Windows 7

I want to know if there is a specific entry to check in the registry to see if there is a default program associated with a specific file type?
My main example would be a PDF. Documentation in my company is mainly PDF. We want to be able to distribute the latest Adobe Reader because, generally, a lot of the PCs using my company's software will not have access to the internet.
During installation, I want to be able to check if the computer we are installing on already has a program to view PDF files. If yes, carry on. if not, then run the Adobe distribution as part of the install.
I'm focused on Windows 7 PCs, registry entry(ies) I can read programatically to see if, as an example, PDF has a valid program to open it.
No this option not exists. Although HKCR\'PROGID'\shell\open may points to the installed software.
User MC ND have wrong answer. See my screenshot:
During installation, I want to be able to check if the computer we are installing on already has a program to view PDF files. If yes, carry on. if not, then run the Adobe distribution as part of the install.
So I have pdf reader (!!!) with no associations. MC ND you are still thinks, I have no pdf reader?
From console
assoc .pdf to get the "fileType" associated to the extension. Once you have the fileType (ex. AcroExch.Document.11):
ftype AcroExch.Document.11 to get the associated program.

Database view in windows phone

I have created my database in my windows phone app. Now i want to see whether it is created and stored data as i programmed it. But i am failed to view this database. Where my local database file get saved ? I like to mentioned that i have stored the database in the isolated storage. I heard about a method by using firefox extension i may be able to see the database but not sure what extension that is.
I've never heard about any Firefox extensions for browsing Isolated Storage on Windows Phone.
You can use Windows Phone Power Tools to copy your data file from the emulator or device to your desktop. If you're using Linq to Sql, you can open it in SQL Server Management Studio. Other data formats (i.e., Sqlite) can be opened in respective administration tools.
After Downloading Windows Phone power tools as mentioned by Michael, you can easily extract the database.
You may find difficulty in finding the exact file as the apps are listed by GUID and not their names in wp power tools.So you may have to go through each app to see which one contains the desired file.
Once you have located the file you will need a viewer (like this) to open the file.
This method worked for me just right.

How to start writing a virtual printer for Mac OSX?

I am new to mac OS world. Please suggest me how to start writing for a virtual printer which fulfill the following requirement:
Software installation process should install it on the target system as a printer driver which should be available for selection from any application installed on the target system.
Can export image(can be any file type like word document, image etc) to pdf.
Welcome for providing any suggestions like how to go for it(Api's, Frameworks) or any links for proof concept projects/content which can help me out.
OS X comes with PDF printer support built-in. You don't need to build anything if you select print to PDF in the standard OS X application Print dialog. You can also easily supply links to specific directories or scripts to run in conjunction with printing to PDF. Google for OS X PDF Services.
After lot of research I have found that below link and knowledge of cups(www.cups.org/)will give you great help to create your own custom virtual printer.
Please refer to this link:-
http://developer.apple.com/library/mac/#samplecode/SampleRaster/Listings/sampletopdf_c.html#//apple_ref/doc/uid/DTS40009295-sampletopdf_c-DontLinkElementID_17
Also search for "CUPS-PDF print to pdf" great help guys.

Where should I store application specific settings?

I've been asked to update a VB6 application that's been running on WinXP for the last 6 years. The client wants to use Windows 7. Up until now, the app stored its settings in an INI file located in the application directory. One key difference between XP and 7 is that you can't write to C:\Program Files\AppFolder anymore.
I am trying to figure out where on the file system should I store settings? Given that the application is still required to run on WinXP, I am kind of confused.
On WinXP, I have the following:
C:\Documents and Settings\profilename\Application Data
C:\Documents and Settings\profilename\Local Settings\Application Data
On Windows 7, I have the following:
C:\Users\profilename\AppData\Local
C:\Users\profilename\AppData\LocalLow
C:\Users\profilename\AppData\Roaming
Each one of these folders have subfolders that seem to store settings/files for various products
So 2 questions:
Given all these folders, where do I store my settings?
I am assuming that there is a nifty Windows API call that would give me the proper location of this folder. And I am hoping it works on both XP and 7. Is my assumption correct? If so, a link would be much appreciated.
There are a number of special folders you can use, on XP/Vista/Windows 7:
The CSIDL_APPDATA folder is the one you will likely be most interested in. Data stored here is available to roaming users at whatever machine they log in to. This is the best place to store simple configuration data. All users have write access to this (and the last) folder. Note that none of the above folders are for user-generated data! That would properly belong under the My Documents hierarchy.
EDIT: As Cody Gray suggests in the comments, also consider CSIDL_LOCAL_APPDATA for application data that will always be local to the current machine, but is set aside on a per user basis. The data in this folder is not available on a roaming basis, so it should be data that the user will likely not miss if they log in to a different machine.
I shamelessly copied the explanation above from a good article by Karl Peterson, explaining this for VB6 programmers. Karl also has a ready-to-use class that will help you find the directories, but IMHO he's overcomplicated things this time. Bob Riemersma has a better way in one line, using the Shell object, as below. EDIT Bob's comment below explains why it's best to use late binding for this rather than early binding.
Const ssfCOMMONAPPDATA = &H23
Const ssfLOCALAPPDATA = &H1c
Const ssfAPPDATA = &H1a
Dim strAppData As String
strAppData = _
CreateObject("Shell.Application").NameSpace(ssfAPPDATA).Self.Path
In my opinion it's fine to continue to use INI files in these directories.
See the question "Does Microsoft have a best practices document regarding the storage of app data?" for some helpful info.
Maybe you just save your settings in Windows Registry?
That's very easy. Using SaveSeting and GetSetting is much easier than creating INI file.
And there is no trouble in compatibility, from WinNT to Windows 8.

Resources