简体   繁体   English

检测在MFC / OLE中的鼠标单击

[英]Detect mouse click in mfc/ole

I am trying to implement a mouse click using mfc in an existant software. 我正在尝试在现有软件中使用mfc实现鼠标单击。 The client is a mfc application that is connected to a server through OLE automation. 客户端是通过OLE自动化连接到服务器的mfc应用程序。 The client display the output of a server that is connect to through OLE. 客户端显示通过OLE连接到的服务器的输出。 I used the wizared to implement the detection of the mouse click by the client: 我使用了奇怪的方法来实现客户端对鼠标单击的检测:

    void CChildView::OnLButtonDown(UINT nFlags, CPoint point)
    {
        CDC* pDC1 = GetDC();
        pDC1->SelectStockObject(WHITE_BRUSH);
        pDC1->Ellipse(0,0,20,20);
    }

I was expecting that when I click, a small circle will appear. 我期望单击时会出现一个小圆圈。 But it doesn't work, I can see only the output of the server! 但这不起作用,我只能看到服务器的输出! When I implement this in a simple independent project, it works. 当我在一个简单的独立项目中实现此功能时,它就可以工作。 I would appreciate your help to solve this. 感谢您为解决此问题所提供的帮助。 Thanks! 谢谢! L. L.

If the video is being painted directly on CChildView then it will overwrite and erase the circle very quickly. 如果视频直接在CChildView上绘制,则它将很快覆盖并擦除圆圈。 If the video is being painted by a child control of some kind on the CChildView then the mouse click message goes to that control, not to CChildView. 如果视频是由CChildView上的某种子控件绘制的,则鼠标单击消息将转到该控件,而不是CChildView。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM