Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

.NET 

Read all tabs open in chrome for example.

(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?
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/user...ildwindows
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)

'ChildWindowsCallBack is where the child windows are enumerated, see https://msdn.microsoft.com/en-us/library/windows/desktop/ms633493%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396

Private Shared Function ChildWindowsCallBack(hwnd As IntPtr, lParam As IntPtr) As Boolean
'Do what you need with the window parameters
Return True 'you must return true to keep enumerating the child windows.
End Function
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...owText API which this time it seems to have a nice example on p/invoke, http://www.pinvoke.net/default.aspx/user...windowtext
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.
(Nov 28, 2015 09:44 AM)pakalupapito Wrote:  
Code
Private Shared Function ChildWindowsCallBack(hwnd As IntPtr, lParam As IntPtr) As Boolean
'Do what you need with the window parameters
Return True 'you must return true to keep enumerating the child windows.
End Function

Where 'Do what you need with the window parameters, is where i use the get text api right...?

yes... you pass the 'hwnd' parameter (1st one) to the getwindowtext function.
p/invoke has an example.
lol.

'hwnd' can't be null, don't know why you're converting it to integer and then checking if it is 0, you have IntPtr.Zero for that.

You're trying to instanciate a new stringbuilder with a fixed length, the stringbuilder is already empty i don't know why you're iniciating it to empty again, just put the length and move on, BUT you don't need to.

Next line, you got the length, but instead of using it directly on the GetWindowText call you decide to ue sb.capacity, that may work since you have a specific length on capacity but don't do that if you don't need to.

I told you the function needs to return true to keep enumerating, however, you apparently don't even know the basics of coding, you can only return ONE thing, that 'return true' there is unreachable, you also have "Return Nothing" which you should delete anyway as from what i said above.

Just save the text somewhereelse like in a variable you declare outside of the function and move on.

That shouldn't even compile... gods sake.


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Shell] by blackcoder00Oct 29, 2018 04:52 AM 4 278 Oct 29, 2018 04:52 AM
Last Post: wirelin3
[.NET] by PrillorFeb 6, 2017 10:25 AM 4 268 Feb 6, 2017 10:25 AM
Last Post: Prillor
[.NET] by Josh‎Jun 22, 2016 03:23 PM 2 208 Jun 22, 2016 03:23 PM
Last Post: Josh‎