|
-
Jun 10th, 2002, 09:31 AM
#1
Launching an application
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!
-
Jun 10th, 2002, 10:31 AM
#2
Try ShellExecute:
Code:
HINSTANCE H;
H = ShellExecute(
this,
(LPCTSTR) "print",
(LPCTSTR) "c:\foldername\program_name",
(LPCTSTR) "c:\anotherfolder\anotherfile.pdf",
(LPCTSTR) "c:\",
SW_NORMAL
);
-
Jun 10th, 2002, 11:37 AM
#3
Monday Morning Lunatic
You shouldn't need to cast it there, also, you're casting to an unsafe type, use:
Code:
HINSTANCE H;
H = ShellExecute(
this,
_T("print"),
_T("c:\\foldername\\program_name"),
_T("c:\\anotherfolder\\anotherfile.pdf"),
_T("c:\\"),
SW_NORMAL
);
LPCTSTR is const TCHAR*, where TCHAR is either char or wchar_t depending on the definition of UNICODE.
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Jun 10th, 2002, 02:44 PM
#4
_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: \\.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Jun 10th, 2002, 08:37 PM
#5
I used LPCSTR since they were all constants. Which is alright in this instance.
I did not escape the \ to \\, which is not alright.
-
Jun 11th, 2002, 10:47 AM
#6
Monday Morning Lunatic
Originally posted by jim mcnamara
I used LPCSTR since they were all constants. Which is alright in this instance.
Mm-hmm, but they don't match the datatype (TCHAR).
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|