-
Notifications
You must be signed in to change notification settings - Fork 0
/
HTABrowserLauncher.diff
45 lines (44 loc) · 1.18 KB
/
HTABrowserLauncher.diff
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
16a20,22
> import com.sun.jna.*;
> import java.lang.reflect.Field;
>
22a29,35
>
> import java.io.BufferedReader;
> import java.io.BufferedWriter;
> import java.io.InputStreamReader;
> import java.io.OutputStreamWriter;
>
>
25a39,43
> static interface Kernel32 extends Library {
> public static Kernel32 INSTANCE = (Kernel32) Native.loadLibrary("kernel32", Kernel32.class);
> public int GetProcessId(Long hProcess);
> }
>
33a53,56
> private Process browser;
>
72c100
< iexploreProcess.executeAsync();
---
> browser = iexploreProcess.executeAsync();
76a105,232
> public void takePageScreenshot()
> {
> log.info("Taking custom page screenshot now");
> try {
> Field f = browser.getClass().getDeclaredField("handle");
> f.setAccessible(true);
> int pid = Kernel32.INSTANCE.GetProcessId((Long) f.get(browser));
> String[] cmdarray = new String[] {
> "c:\\screenshot.exe",
> Integer.toString(pid),
> "screenshot.jpg"
> };
> CommandLine exe = new CommandLine(cmdarray);
> exe.execute();
> exe.destroy();
>
> } catch (Exception e) { log.info(e.getMessage());}
> }