簡體   English   中英

如何使用JNI獲取瀏覽器上當前活動選項卡的進程ID

[英]How to get process id of currently active tab on browser using JNI

我嘗試下面的代碼,
但是它給了我瀏覽器父線程id。我想知道使用jni當前活動的選項卡進程ID。
使用Example會非常有幫助。 提前致謝。

HWND hwnd = User32.INSTANCE.GetForegroundWindow();
IntByReference pId=new IntByReference();
int tmp= User32.INSTANCE.GetWindowThreadProcessId(hwnd, pId);
int processId=pId.getValue();
System.out.println("processId : "+processId);

您無法使用Win32 API獲取tab的進程ID,因為它取決於瀏覽器。 並非所有瀏覽器都在單獨的進程中執行選項卡。
對於谷歌瀏覽器,您可以為此使用它的API

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM