How to trap a container event within an ActiveX Control 
Author Message
 How to trap a container event within an ActiveX Control

I am developing an ActiveX Control in VC5. I need to trap container events
like WM_SIZE(Form_Resize) within my control.

Is there any way to do this?

Thanks for any help!

Regards,
Jack



Mon, 16 Apr 2001 03:00:00 GMT  
 How to trap a container event within an ActiveX Control
You can subclass the container's window and handle those messages.
--
Girish Bharadwaj [VC++/MVP].
Dont send email queries to me directly.Please put
them on the newsgroups.
Thank you
Quote:

>I am developing an ActiveX Control in VC5. I need to trap container events
>like WM_SIZE(Form_Resize) within my control.

>Is there any way to do this?

>Thanks for any help!

>Regards,
>Jack



Mon, 16 Apr 2001 03:00:00 GMT  
 How to trap a container event within an ActiveX Control
I tried subclassing the container from VB's UserControl. It simply hangs!
I tried subclassing after Form_Load event.

Please tell me, what is wrong with this code.

Is there any other method other than subclassing?

The code is..

In UserContol module.
~~~~~~~~~~~~~~~~~~~~~~~~
SubClass:
mWndProcOrg = SetWindowLong(Parent.hWnd, GWL_WNDPROC, AddressOf SubWndProc)

UnSubclass:
Call SetWindowLong(Parent.hWnd, GWL_WNDPROC, mWndProcOrg)

In BAS module:
~~~~~~~~~~~~~~~~
Public Const WM_SIZE = &H5
Public Const GWL_WNDPROC = (-4)
Public mWndProcOrg As Long

Public Function SubWndProc( _
   ByVal hWnd As Long, _
   ByVal Msg As Long, _
   ByVal wParam As Long, _
   ByVal lParam As Long) As Long

   On Error Resume Next

   If uMsg = WM_SIZE Then
      Debug.Print "Form Resize ..."
    End If
      SubWndProc= CallWindowProc(mWndProcOrg, hWnd, _
                    uMsg, wParam, lParam)
End Sub

Thank you!

Regards,
Jack

Quote:

>You can subclass the container's window and handle those messages.
>--
>Girish Bharadwaj [VC++/MVP].
>Dont send email queries to me directly.Please put
>them on the newsgroups.
>Thank you


>>I am developing an ActiveX Control in VC5. I need to trap container events
>>like WM_SIZE(Form_Resize) within my control.

>>Is there any way to do this?

>>Thanks for any help!

>>Regards,
>>Jack



Tue, 17 Apr 2001 03:00:00 GMT  
 How to trap a container event within an ActiveX Control
I might have passed some invalid params. I tried again; it worked!

Thanks a lot.

Quote:

>I tried subclassing the container from VB's UserControl. It simply hangs!
>I tried subclassing after Form_Load event.

>Please tell me, what is wrong with this code.

>Is there any other method other than subclassing?

>The code is..

>In UserContol module.
>~~~~~~~~~~~~~~~~~~~~~~~~
>SubClass:
>mWndProcOrg = SetWindowLong(Parent.hWnd, GWL_WNDPROC, AddressOf SubWndProc)

>UnSubclass:
>Call SetWindowLong(Parent.hWnd, GWL_WNDPROC, mWndProcOrg)

>In BAS module:
>~~~~~~~~~~~~~~~~
>Public Const WM_SIZE = &H5
>Public Const GWL_WNDPROC = (-4)
>Public mWndProcOrg As Long

>Public Function SubWndProc( _
>   ByVal hWnd As Long, _
>   ByVal Msg As Long, _
>   ByVal wParam As Long, _
>   ByVal lParam As Long) As Long

>   On Error Resume Next

>   If uMsg = WM_SIZE Then
>      Debug.Print "Form Resize ..."
>    End If
>      SubWndProc= CallWindowProc(mWndProcOrg, hWnd, _
>                    uMsg, wParam, lParam)
>End Sub

>Thank you!

>Regards,
>Jack


>>You can subclass the container's window and handle those messages.
>>--
>>Girish Bharadwaj [VC++/MVP].
>>Dont send email queries to me directly.Please put
>>them on the newsgroups.
>>Thank you


>>>I am developing an ActiveX Control in VC5. I need to trap container
events
>>>like WM_SIZE(Form_Resize) within my control.

>>>Is there any way to do this?

>>>Thanks for any help!

>>>Regards,
>>>Jack



Fri, 20 Apr 2001 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Handling ActiveX control events without an ActiveX container

2. retrieve handle of the control from within the control when the container is vb

3. add Activex control to Activex container daynamically

4. cannot trap the enter key using atl control that is hosted in a container

5. ActiveX "control-container" control

6. ActiveX events, without a container.

7. Passing ActiveX Event to containers parent

8. How to receive ActiveX events in the test container

9. Trap RETURN in an EDIT Control within an AppBar

10. Controls within ActiveX controls

11. VB ActiveX Control encapsulated within a VC Control

12. How to trap a Right-Click Mouse Event on a WebBrowser2 control

 

 
Powered by phpBB® Forum Software