javascript - How to get window handle (int) from chrome extension? -
i got chrome extension , in event of new tab want window handle in windows if current window.
on event got tab object , got chrome's internal window id not handle in windows.
chrome.tabs.oncreated.addlistener( function (tab) { var intmainwindowhwnd = 0; // how it? not tab.windowid… });
thanks!
well, if encounter same problem, solved using npapi plugin in c++ access win32api...
in invoke method i've checked method (getprocessid) , got parent process (since addon in different process):
ulong_ptr myaddon::getparentprocessid() // napalm @ netcore2k { ulong_ptr pbi[6]; ulong ulsize = 0; long (winapi *ntqueryinformationprocess)(handle processhandle, ulong processinformationclass, pvoid processinformation, ulong processinformationlength, pulong returnlength); *(farproc *)&ntqueryinformationprocess = getprocaddress(loadlibrarya("ntdll.dll"), "ntqueryinformationprocess"); if(ntqueryinformationprocess){ if(ntqueryinformationprocess(getcurrentprocess(), 0, &pbi, sizeof(pbi), &ulsize) >= 0 && ulsize == sizeof(pbi)) return pbi[5]; } return (ulong_ptr)-1; }
then got main hwnd of process , return js addon.
Comments
Post a Comment