Why does this window subclassing code crash?

后端 未结 4 1240
小蘑菇
小蘑菇 2021-01-15 20:30

I am trying to subclass the window that currently has focus. I do this by monitoring for HCBT_ACTIVATE events using a CBT hook, and set and unset the WndP

4条回答
  •  南方客
    南方客 (楼主)
    2021-01-15 21:21

    lpfnOldWndProc and hWndSubclass are global pointers. Seems like you've got only one per process. What if a process creates more than one window?

    Then you will unsubclass only the last one.

    EDIT: Also, why do you tear down in Process DETACH?

提交回复
热议问题