Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What can Subclassing do? 1

Status
Not open for further replies.

clapper62

Programmer
Apr 17, 2003
113
US
Before I try to figure out how to "Subclass" or is "hook" the proper term, I'd like to know if it can do what I would like to do. I want to get a handle to a window (any window)
not necessarily my program. Then I can get a handle to all the controls in that window .. command buttons, textboxes combo boxes etc. Can I then read the value in say the textbox from my vb app using subclassing or hooking?
Can I set value?

Not sure if I'm making sense here from what I've read about
WndProc SendMessage and GetMessage

am I on the right track, can I accomplish the above?

Thanks


"There is no pleasure in having nothing to do; the fun is having lots to do and not doing it.
." - Andrew Jackson
 
You don't need subclassing or hooking to achieve your described goals. Mostly you'd probably just need EnumWindow (or FindWindow) and SendMessage
 
Thanks for the reply

I have spent the interim period googling SendMessage and from what I've read this will allow me to fill a textbox
(I'll work out actually how to do it later)

Is there a similar way to get values from a textbox?

Thanks again

"There is no pleasure in having nothing to do; the fun is having lots to do and not doing it.
." - Andrew Jackson
 
See thread222-701611 for some discussion on subclassing and its applications.
 
Thank You Hypetia

if I decide to go the subclassing route I am sure that thread will help me.

But back to the question.
Does this mean that if I want to set the value of a textbox in another app I must subclass?



"There is no pleasure in having nothing to do; the fun is having lots to do and not doing it.
." - Andrew Jackson
 
oops sorry set in the last post should be get

"There is no pleasure in having nothing to do; the fun is having lots to do and not doing it.
." - Andrew Jackson
 
>>Does this mean that if I want to (get/)set the value of a textbox in another app I must subclass?

No. As I said, your requirements look like they can be met with SendMessage:

>from what I've read this will allow me to fill a textbox
WM_SETTEXT

>Is there a similar way to get values from a textbox?
WM_GETTEXT



 
First off thank you both for your responses.

strongm as usual you were right.
I didn't need subclassing to accomplish what I wanted.

I have managed to send and get text from an instance of
notepad with the API calls you mentioned.

Thanks again.


"There is no pleasure in having nothing to do; the fun is having lots to do and not doing it.
." - Andrew Jackson
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top