Getting text from winExplorer add?
Getting text from winExplorer add?
just want to know how to get the text from window explorer address using PB? anyone?
- netmaestro
- PureBasic Bullfrog
- Posts: 8451
- Joined: Wed Jul 06, 2005 5:42 am
- Location: Fort Nelson, BC, Canada
If you have its window handle, it's easier. However, if you don't, this snippet should return the Address Bar text of the first Windows Explorer window it finds:
Code: Select all
Global AddrText.s = Space(200)
Procedure FindComboBox(win, void)
a.s = Space(200)
GetClassName_(win, @a, 199)
If a="ComboBox"
PokeW(@AddrText,199)
SendMessage_(GetWindow_(win,#GW_CHILD), #EM_GETLINE, 0, @AddrText)
ProcedureReturn 0
EndIf
ProcedureReturn 1
EndProcedure
win=FindWindow_("ExploreWClass", 0)
If win
EnumChildWindows_(win, @FindComboBox(), 0)
Debug AddrText
Else
Debug "Can't find an Explorer window!"
EndIf
BERESHEIT
hello there
am having troubled with handle
when i changed this
to this
"can't find an Explorer Window"
when i try this
the result is this ==> Ç
sorry for my noobness, am not that good.. but am trying..
am having troubled with handle
when i changed this
Code: Select all
win=FindWindow_("ExploreWClass", 0)
Code: Select all
win=FindWindow_(5309050,0)
when i try this
Code: Select all
win=FindWindow_(0,"My Documents")
sorry for my noobness, am not that good.. but am trying..
Code: Select all
win=FindWindow_(5309050,0)
If you're using a global atom, then I think these are 16 bit values only, which means that 5309050 is out of range.
I may look like a mule, but I'm not a complete ass.
If I understand what you've done, then it's a big no no!
A window's handle (used by window's and applications to identify different windows and controls etc.) is only valid for a particular session and so you cannot and must not attempt to hard code this.
For example, run windows explorer a first time and the window's handle allocated to it's main window could be, say, 100100.
Stop the program and run it again and the handle could have changed to, say, 200050 etc.
The thing to remember is that handles are dynamically allocated and are always subject to change between instances of running your program.
Right, now that's out of the way (assuming I understand what you did?) what exactly are you trying to do?
netmaestro posted some good code there. I don't see much scope for altering the code in anyway.
If you're after a detailed explanation of how it works, then fair enough; just ask.
btw, I wouldn't concern yourself with global atoms, I don't think many people use them anyhow.

A window's handle (used by window's and applications to identify different windows and controls etc.) is only valid for a particular session and so you cannot and must not attempt to hard code this.
For example, run windows explorer a first time and the window's handle allocated to it's main window could be, say, 100100.
Stop the program and run it again and the handle could have changed to, say, 200050 etc.
The thing to remember is that handles are dynamically allocated and are always subject to change between instances of running your program.
Right, now that's out of the way (assuming I understand what you did?) what exactly are you trying to do?

netmaestro posted some good code there. I don't see much scope for altering the code in anyway.
If you're after a detailed explanation of how it works, then fair enough; just ask.
btw, I wouldn't concern yourself with global atoms, I don't think many people use them anyhow.
I may look like a mule, but I'm not a complete ass.
If you want loads of example snippets then try the invaluable code archive at:
http://www.purearea.net/pb/english/index.htm
Most (if not all) of these snippets are for Purebasic 3.94 and so will not run directly under PB 4. Each only requires a couple of alterations though, normally with the OpenWindow() command and a few constants that have changed.
http://www.purearea.net/pb/english/index.htm
Most (if not all) of these snippets are for Purebasic 3.94 and so will not run directly under PB 4. Each only requires a couple of alterations though, normally with the OpenWindow() command and a few constants that have changed.
I may look like a mule, but I'm not a complete ass.
ty for the information. i already did that, i've ready downloaded the samples and yes most of the files was created from the previous version of PB. but i managed to changed some syntax for PB4. actually i've started experimenting and conding since last august 3
and also thx to this site
http://www.xs4all.nl/~bluez/datatalk/pure3.htm#top
for the pure basic guide, it helps a lot..
and also thx to this site
http://www.xs4all.nl/~bluez/datatalk/pure3.htm#top
for the pure basic guide, it helps a lot..