Jacob It can be used to do a lot of things , I mainly use the pass office turn pdf Function of .

In the process of use , Occasionally (1% The probability of ) Process exception , Some problems, such as pop-up box, lead to program feign death .

In order to solve similar problems , In the process of use , It can be optimized from the following details .

<>1. read only mode

use office Time , If the file is occupied , At the beginning of the fight, the box will pop up to prompt :

After the pop-up window appears, the program will be stuck .
If you change to read-only mode , There is no such problem , The code is as follows :

Notice the first parameter in the second line above , Set to true It can be solved .

<>2. Timeout retry

If it's turning PDF In the process , The following error occurred :

This will cause the conversion to fail , And don't click 【 close program 】 The process will get stuck .
After adding timeout retry mechanism , Although the error window is still there , But turn PDF Can continue successfully .

<>3. Regularly clean up error processes

In the above error , The corresponding error process is WerFault.exe, You can close the window by executing the following code in a scheduled task :
Runtime.getRuntime().exec("taskkill /F /IM WerFault.exe");
In the wrong situation , Suppose it was word turn pdf, In the process list , There will always be a corresponding WINWORD.EXE It's running all the time , By monitoring the process PID
The duration of existence is used to determine whether the exception has not been closed for a long time , Close the process by code .

The following code is used to get the process list :
taskkill /nh /FI "IMAGENAME eq XX.EXE"
The code is as follows :

obtain ID after , Record the process ID How many times have you been searched :

Shut down the process when more than a certain number of times :

Batch shutdown process :

Through the above details processing , Basically, it can make Jacob There is no problem with the operation of , The backstage can run smoothly for a long time .

©2019-2020 Toolsou All rights reserved,
Non preemptive static priority scheduling algorithm for operating system (C language )Go Language learning notes (GUI programming )XCTF Attack and defense world web Advanced practice _ 2_lottery What's the difference between computer major and training background ?python realization vlookup_ Dry goods I : Why python It's inside vlookup Bubble sort primary springboot2 Separation of front and rear platforms ,token Put in header Pit for verification Python Case conversion of letters ( Two methods )javascript event ( Detailed explanation of zero basis )Unity2019 UIElement note ( ten ) Simple exercise 2