Re: The memory could not be "read". Application Crash??

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Pásztor, Zoltán (pasNOSzPAMtAPor_at_multiXXXlogic.com)
Date: 10/07/04


Date: Thu, 7 Oct 2004 12:44:23 +0200

YYZ wrote:
> "Ken Halter" <Ken_Halter@Use_Sparingly_Hotmail.com> wrote in message
> news:#1B97S7qEHA.2816@TK2MSFTNGP10.phx.gbl...

   [snip]

>>
>> I've never tried the SoftCircuits control. The feature I wanted most
>> is to be able to set up multiple hooks on the same window (like
>> several instances of a usercontrol trapping messages on their single
>> parent form). The SSubTmr component's the only one I found that
>> specifically supported this feature "out of the box".
>
> I honestly don't know about that feature. I've always gone the other
> way -- added a bunch of subclass controls to subclass all different
> windows. I can't think of a reason that you couldn't subclass the
> same window multiple times...but I just don't know. I lied - just
> tested it. I had 3 instances of the subclass control all subclass
> the hwnd of a form, looking for WM_GETMINMAXINFO. 3 WndProc events,
> all printing debug output of the message and the control name...only
> the last instance of the subclass control got fired.

The reason (from inspecting the source code of the SoftCircuit control) is
that it identifies its clients by the hWnd of the window being subclassed,
and takes great care of ensuring its uniqueness - the first step in
preparing a new hook by any instance (when assigning a new value to the hWnd
property of the instance) is freeing all previous hooks for that window in
the central data structure shared by all instances.

This perhaps could be modified, but the simplicity of the design would
suffer...

-- 
PZ


Relevant Pages

  • Re: Reading the .Tag property of a control
    ... The demo shows how to subclass controls, and as you say, is dependant ... Set windows system hook to monitor all messages sent to ... so capture the style word for the window which is about to be created ... + Get name of control from C.lpszName ...
    (microsoft.public.vb.general.discussion)
  • Re: The memory could not be "read". Application Crash??
    ... >> is to be able to set up multiple hooks on the same window (like ... I can't think of a reason that you couldn't subclass the ... I had 3 instances of the subclass control all subclass ... that it identifies its clients by the hWnd of the window being subclassed, ...
    (microsoft.public.vb.enterprise)
  • Re: The memory could not be "read". Application Crash??
    ... >> is to be able to set up multiple hooks on the same window (like ... I can't think of a reason that you couldn't subclass the ... I had 3 instances of the subclass control all subclass ... that it identifies its clients by the hWnd of the window being subclassed, ...
    (microsoft.public.vb.general.discussion)
  • Re: The memory could not be "read". Application Crash??
    ... >> is to be able to set up multiple hooks on the same window (like ... I can't think of a reason that you couldn't subclass the ... I had 3 instances of the subclass control all subclass ... that it identifies its clients by the hWnd of the window being subclassed, ...
    (microsoft.public.vb.winapi)
  • Re: ? Create Not Called in Dialog for Subclassed Control
    ... So a control which does not will cause an assertion ... you could ideally have PreSublcassWindow PostMessage a notice to the window that ... It is created before it is bound to a subclass, and the behavior cannot be monitored until ... kernel object represented by an HWND, ...
    (microsoft.public.vc.mfc)