Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exitcode #21

Open
lazna opened this issue May 7, 2022 · 7 comments
Open

Exitcode #21

lazna opened this issue May 7, 2022 · 7 comments

Comments

@lazna
Copy link

lazna commented May 7, 2022

Does this prohgram provide any exitcode (errorlevel) if sending to printer (or printing itself) failed?

Found nothing in documentaion

@kendallb
Copy link
Owner

kendallb commented May 7, 2022

Not sure if the WebKit print function has a return value to indicate failure but the code currently does not return a failure if it somehow failed to print. It will return an error if the URL fails, but not if printing failed.

Most print routines usually don’t fail as it gets spooled to the print queue and if the printer is not working it is stuck in there until you fix it. So the app doing the printing assumes it all works once it gets spooled.

@lazna
Copy link
Author

lazna commented May 7, 2022

OK, but what about the program itself? If wrong (insuficient) parameter provided for example? Does it only print error message or set exitcode too? Need distinguis between situations:

"data was successfully sent to printer\queue"

and

"any problem occurs"

@kendallb
Copy link
Owner

kendallb commented May 9, 2022

Yes, starting here you can see the error handling. Would not be hard to update it to add more error handling if you needed more fine grained details. I just am not sure if you can tell if the printing actually failed at all.

https://github.com/kendallb/PrintHtml/blob/master/main.cpp#L103

@lazna
Copy link
Author

lazna commented May 9, 2022

Unable to read C code, unfortunatelly :-/

@lazna
Copy link
Author

lazna commented May 11, 2022

Just found, when there is a typo in path to HTML file to be printed, GUI message "Fatal error: HTML page failed to load" is displayed. In console programs, opening GUI boxes should be generaly avoided. Print ERRMSG to STDERR and set errorlevel instead, please

@kendallb
Copy link
Owner

Unfortunately this program is not a console program, as it needs access to Windows UI components in order to print.

@lazna
Copy link
Author

lazna commented May 11, 2022

thanks. This is a very important information and should be mented in the beginning of documentation. The list of switches in documentation look like console program and could mislead people.

Is there a chance to run it by psexec by -i or -x switches?

-i Run the program so that it interacts with the desktop of the specified session on the remote system. If no session is specified the process runs in the console session.
-x Display the UI on the Winlogon secure desktop (local system only).

cant test it now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants