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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using Win32 to capture events

Status
Not open for further replies.

yumbelie

Programmer
Dec 31, 2002
96
GB
Hi,

Basically, let me set the scene, got a form with an embedded frame - now it has a textbox embedded into it - and I want to prevent the user being able to edit the contents without using textbox.disabled = true. Now, I understand *basically* how Win32 API works, and have implemented a Subclassing procedure (which I understand - mostly ;)) and which is invoked when the form is loaded, and terminated when the form is unloaded.

I have added constants to define WM_KEYDOWN etc, but I notice when I do a debug.print lParam & uMsg that the subclassing procedure is only called for form events, i.e. if I move the mouse about, or click on the form etc, a message is printed, but when I click in one of the embedded text boxes - nothing, when I type text, nothing. Now, I'm sure I'm missing something, would I be better using a hook as opposed to subclassing to capture the messages?

Secondly, when I've got the messages, how do I know which form object they are assoicated with ? There must be some unique ID I can capture to determine which object the message is destined for, and therefore elimitate any WM_KEYDOWN, WM_LEFTMOUSESOMETHING events before they are processed by the forms main processor.

Btw, I'm sure there is a dead easy VB way to solve this problem - but I wanna avoid that - the power of win32 api n all ;)

Thanks

Yum.
 
Have you set the KeyPreview property of the form to True?


- Andy
___________________________________________________________________
If you think nobody cares you're alive, try missing a couple of mortgage payments
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top