I need to lauch abode acrobat and pass it a file name i would like it to open and then print. Does anyone know how to do this? Help is appreciated! Thanks!
Printable View
I need to lauch abode acrobat and pass it a file name i would like it to open and then print. Does anyone know how to do this? Help is appreciated! Thanks!
Try ShellExecute:
Code:HINSTANCE H;
H = ShellExecute(
this,
(LPCTSTR) "print",
(LPCTSTR) "c:\foldername\program_name",
(LPCTSTR) "c:\anotherfolder\anotherfile.pdf",
(LPCTSTR) "c:\",
SW_NORMAL
);
You shouldn't need to cast it there, also, you're casting to an unsafe type, use:LPCTSTR is const TCHAR*, where TCHAR is either char or wchar_t depending on the definition of UNICODE.Code:HINSTANCE H;
H = ShellExecute(
this,
_T("print"),
_T("c:\\foldername\\program_name"),
_T("c:\\anotherfolder\\anotherfile.pdf"),
_T("c:\\"),
SW_NORMAL
);
_T will evaluate to a wide string or an ANSI string dependent on UNICODE.
Mind the double \! Since \ is the escape character, i.e. it has a special meaning, you need to escape it to get the real character: \\.
I used LPCSTR since they were all constants. Which is alright in this instance.
I did not escape the \ to \\, which is not alright.
Mm-hmm, but they don't match the datatype (TCHAR).Quote:
Originally posted by jim mcnamara
I used LPCSTR since they were all constants. Which is alright in this instance.