An easy way would be to directly link to COMMDLG.DLL in the
Windows\System directory to the function:
BOOL PrintDLg(LPPRINTDLG lppd);
where LPPRINTDLG is a long pointer to the initialization structure:
PRINTDLG which is defined as:
typedef struct tagPD {
DWORD lStructSize;
HWND hwndOwner;
HANDLE hDevMode;
HANDLE hDevNames;
HDC hDC;
DWORD Flags;
WORD nFromPage;
WORD nToPage;
WORD nMaxPage;
WORD nCopies;
HINSTANCE hInstance;
DWORD lCustData;
LPPRINTHOOKPROC lpfnPrintHook;
LPSETUPHOOKPROC lpSetupTemplateName;
HANDLE hPrintTemplate;
HANDLE hSetupTemplate;
}
You could make it a bit easier by wrapping this C call up in a wrapper
DLL that is a bit easier for LabVIEW to swallow and hide things like
LPPRINTHOOKPROC from it inside the wrapper.
You could also do it with a DLL but writing MFC style C++ could and
using the CPrintDialog object. I did something similar once for a
better version of a directory picker from LabVIEW. The National
Instruments version of a directory picker is confusing and can lead
to user induced errors that you have to write elaborate code to
protect against because they basically modified a file picker instead
of using the Microsoft directory "shell" style picker which can only
pick directories that exist.
If DWORD, HANDLE, HWND, LPPRINTHOOKPROC, etc. are confusing to you
then you will need to spend some time on the Microsoft MSDN web site
and/or the local bookstore to pick up a book on Win32 programming
and/or MFC programming for Windows.
Finally if you don't like C, you could even write a Visual Basic
ActiveX DLL and call it using LabVIEW ActiveX vi's.
Douglas De Clue
LabVIEW developer /(and MSVC programmer too 🙂
ddeclue@bellsouth.net
"Terry B." wrote in message news:<5065000000050000003C840000-1023576873000@exchange.ni.com>...
> I don't see any way in which your response is useful. The first
> example displays the setup window, but there is no way of putting the
> user's selections to use. Once they hit OK, the window goes away, and
> I'm left with nothing. There are no outputs from the VI except "OK".
> The second VI is locked, so we have no access to the block diagram,
> but besides that, it also appears useless. All it can do is change
> the default printer. It says that changing other settings may have
> unexpected results.