How to attach Messages from a Form shown with ShowDialog to Application2?

前端 未结 2 2021
无人共我
无人共我 2021-01-06 10:06

I am trying to use the code in this article that lets you know when your app is idle..

This code works great if your application has only one form. You call A

2条回答
  •  渐次进展
    2021-01-06 10:23

    Pardon me for asking, but why are you going through all this insane amount of trouble for something this simple? Looking at the article you linked, all it does is start a timer and reset it every WM_KEYUP, WM_MOUSEMOVE or WM_LBUTTONUP event.

    You can achieve the same thing by overriding WndProc or PreProcessMessage in your form and letting it do the timer reset thing. You can even make a base form (*) that does the timer/resetting thing and derive all your forms from it. And for a real global solution, make the timer static.

    (*) Don't mark it as abstract or the forms designer will throw a hissy fit.

提交回复
热议问题