![]() |
|
[.NET] Read all tabs open in chrome for example. - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118) +---- Thread: [.NET] Read all tabs open in chrome for example. (/showthread.php?tid=5066768) Pages: Pages
1
2
|
Read all tabs open in chrome for example. - pakalupapito - Nov 22, 2015 Hey guys ^_^ So at the moment im working on this project i have so far... its almost done But theres one thing that bothers me... my program does not read all the tabs i have open in chrome... Code Dim p() As Process = Process.GetProcessesByName("chrome")Code Try//Edit: My goal is for the program to read all tabs i have open in chrome. * - debug - Nov 22, 2015 Check this out: https://stackoverflow.com/questions/7814027/how-can-i-get-urls-of-open-pages-from-chrome-and-firefox They mention a library you can use to get URL's, so you should be able to get the window titles as well. * - pakalupapito - Nov 22, 2015 Quite hard for me since i only know some basics of VB.NET :/ im trying to get what they are trying to do there... but... its as good as my japanese :^| * - He B TeMy - Nov 22, 2015 (Nov 22, 2015 03:30 PM)pakalupapito Wrote: Quite hard for me since i only know some basics of VB.NET :/ im trying to get what they are trying to do there... but... its as good as my japanese :^| I guess don't bother from that example, because the comments mention it doesn't work on every major browser anymore... But, doesn't chrome spawn a new process per window? Reading the mainwindowtitle property returns what? * - pakalupapito - Nov 22, 2015 (Nov 22, 2015 04:09 PM)He B TeMy Wrote: I guess don't bother from that example, because the comments mention it doesn't work on every major browser anymore... It returns the last active window ^-^ so if like... i have for example 1 window only youtube right... seperate from my other window with 6 tabs, it is still gonna read my last "chrome" window title, and not seperately * - Agent Raigar - Nov 22, 2015 https://msdn.microsoft.com/en-us/library/windows/desktop/ms633494(v=vs.85).aspx * - pakalupapito - Nov 22, 2015 Yea i tried that too this morning @Agent Raigar... i've searched around and they mostly got it done till the EnumChildWindows function. I did not get further than that to be honest... My VB.NET knowledge/expectation isnt that amazing ^.^ but thanks :] * - He B TeMy - Nov 22, 2015 Well, p/invoke is usually helpful, that and some reading capabilities on the API documentation should be enough, i can't give you an example right now myself though. http://www.pinvoke.net/default.aspx/user32.enumchildwindows * - pakalupapito - Nov 23, 2015 Ya ill give it a go then^^ thanks man * - pakalupapito - Nov 26, 2015 To be honest im quite stuck with enumchildwindows... is there any example i could find somehow... * - He B TeMy - Nov 26, 2015 The link i posted has an example, but by looking at it it was written by some retard. Anyway, it should be easy... Code EnumChildWindows(hwnd, ChildWindowsCallBack, IntPtr.Zero)* - pakalupapito - Nov 26, 2015 I literally have been searching for 2 days now non-stop :/ for example... to add the childwindow of chrome right... to a listbox should i be using Listbox1.items.add(childwindowscallback(hwnd:="chrome.exe"; 32))? I found this aswell wich is quite interesting, but tbh... its so hard for me to understand... im just trying to get all window titles of chrome >-< #edit nvm... can't post links... i found this if u google it "sendmessage notepad c#" first link, they work with childs aswell, but pretty hard to understand /watch?v=9H8rQqy13Kk -> this might be interesting, but i get random numbers in my listbox now.. * - He B TeMy - Nov 26, 2015 my god, do you even know what you're doing? Or how to read? Or how to... fml EnumChildWindows, by the fucking name, it enumerates the child windows of ANOTHER window, the MainWindow for a process in your case, HWND is a type in c++, it has a meaning of 'handle to a window', which means you must pass the handle to the window (an IntPtr in .net) to the function that you want to get the child windows from, understood thus far? the callback i declared above which you need in order to enumerate the child windows that i named 'ChildWindowsCallBack' has two parameters, the first one is another HWND (this time, the handle is retrieved for you to do what you need to do with it) the second one doesn't matter in this case. So... if you want to get the window text from each HWND, you'll have to use the https://msdn.microsoft.com/en-us/library/windows/desktop/ms633520%28v=vs.85%29.aspx]GetWindowText API which this time it seems to have a nice example on p/invoke, http://www.pinvoke.net/default.aspx/user32.getwindowtext Then, if you still don't understand where's the text on the window, it's on the variable "sb" which is a stringbuilder in the example above. * - pakalupapito - Nov 28, 2015 Code Private Shared Function ChildWindowsCallBack(hwnd As IntPtr, lParam As IntPtr) As BooleanWhere 'Do what you need with the window parameters, is where i use the get text api right...? * - He B TeMy - Nov 28, 2015 (Nov 28, 2015 09:44 AM)pakalupapito Wrote: yes... you pass the 'hwnd' parameter (1st one) to the getwindowtext function. p/invoke has an example. |