开发者

How to capture result from a rundll32 invocation?

I've been b开发者_运维知识库itten by this old bug/missing feature in Java:

http://bugs.sun.com/view_bug.do;jsessionid=b2ac8ea11f05c16d948e24d36fb5?bug_id=4673406

The thing is that the "Properties" button in Java's standard print dialog is seemingly always disabled on Windows. The button is only enabled if PrintService.getServiceUIFactory() returns something that isn't null. Unfortunately Win32PrintService instances always return null. Always.

By googling, I discovered that you can invoke Windows' own print properties dialog thingy by calling rundll32:

rundll32 printui.dll,PrintUIEntry /e /n "name of printer here"

I'm hoping I can use this to circumvent the bug/missing feature in Win32PrintService. However, I don't know how I can query the PrintUIEntry-dialog for the user's choices.

In other words, how can I get a result of the above rundll32-invocation? (If I have to write something in C/JNI and use the Windows API directly, so be it. I'd rather not, though.)

Or is there a better way to solve this problem?


rundll32 does not give you any return value, its exit code is always zero.

I think you'll have to find another way.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜