-
ShellExecuteEx problem
Hi friends,
One new problem. Not working the following simple codes.
SHELLEXECUTEINFO shell;
// set struct parameters
shell.cbSize = 1028;
shell.fMask = SEE_MASK_NOCLOSEPROCESS;
shell.hwnd = m_hWnd;
shell.lpVerb = "print";
shell.lpFile = "C:\Documents and Settings\avaneesh\Desktop\This is Geodesic Company.doc";
shell.nShow = SW_SHOW;
shell.hInstApp = AfxGetInstanceHandle();
shell.lpDirectory = "C:\Documents and Settings\avaneesh\Desktop";
shell.lpParameters = NULL;
// print the file
int val = ShellExecuteEx(&shell);
DWORD dword = GetLastError();
//ShellExecuteEx
Any help?
-
What message does GetLastError() give you?
Look at the docs to see how to get the textual message.
-
Yes that I got and looked in LookUpError and got message as
"Access denied". It means I am not able to get access to printer which is remote (as I am on LAN). But same time I tried printing a .doc file it prints.
What you about codes. I find it correct. Then ...?????
-
Strange, if it doesn't have permission it should pop up a box asking for a password...