Teamviewers QuickConnect的按钮是如何实现的? [英] How is Teamviewers Quickconnect button accomplished?

查看:302
本文介绍了Teamviewers QuickConnect的按钮是如何实现的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于那些你们谁不知道我在说什么:
<一href=\"http://www.teamviewer.com/images/$p$psse/quickconnect_en.jpg\">http://www.teamviewer.com/images/$p$psse/quickconnect_en.jpg

For those of you who do not know what I am talking about: http://www.teamviewer.com/images/presse/quickconnect_en.jpg

Teamviewer覆盖所有的窗户,按钮,让您快速与别人共用一个窗口。我想关于实施类似的东西任何想法 - 如果你有例如code,甚至更好(特别是按钮 - 而不是共享)。我感兴趣的是C ++和Qt ......但如果​​有任何我有兴趣用不同的语言/库好的解决办法。

Teamviewer overlays that button on all windows to allow you to quickly share a window with someone else. I would like any ideas on implementing something similar -- if you have example code, even better (specifically, the button -- not the sharing). I am interested in C++ and QT... but I would be interested in good solutions in other languages/libraries if there are any.

感谢。

推荐答案

要画按钮或在国外的窗户其他的东西,你需要注入code到国外的过程。
检查 SetWindowsHookEx函数该方法:

To draw buttons or other stuff in foreign windows, you need to inject code into the foreign processes. Check the SetWindowsHookEx method for that:

您最想安装一个WH_CALLWNDPROCRET钩和提防的 WM_NCPAINT 消息。这将是绘制按钮正确的地方。
不过,我真的不知道,如果你可以将非客户区域内的窗口,因此在最坏的情况下,你必须画的按钮,手动。

You most probably want to install a hook for WH_CALLWNDPROCRET and watch out for the WM_NCPAINT message. This would be the right place to draw your button. However, I'm not really sure, if you can place a window within a Non-Client-Area, so in the worst case, you'd have to paint the button "manually".

刚刚从主应用程序调用这个(或从一个DLL中)

Just call this from your main application (or from within a DLL)

SetWindowsHookEx函数(WH_CALLWNDPROCRET,myCallWndRetProc,HMODULE,0);

注意myCallWndRetProc必须驻留在DLL中和HMODULE是模块句柄此DLL。

Note that myCallWndRetProc must reside within a DLL and hModule is the Module-HANDLE for this DLL.

您myCallWndRetProc可能看起来像:

Your myCallWndRetProc could look like:

LRESULT CALLBACK myCallWndRetProc(int nCode, WPARAM wParam, LPARAM lParam)
{
    if (nCode == HT_ACTION) {
        CWPRETSTRUCT* cwpret = (CWPRETSTRUCT*)lParam;
        if (cwpret->message == WM_NCPAINT) {
            // The non-client area has just been painted.
            // Now it's your turn to draw your buttons or whatever you like
        }
    }
    return CallNextHookEx(0, nCode, wParam, lParam);
}

当你起执行,我建议,你只需创建一个简单的对话框的应用程序和钩自己的过程只:

When starting with your implementation, I'd suggest, you just create a simple dialog application and hook your own process only:

SetWindowsHookEx(WH_CALLWNDPROCRET, myCallWndRetProc, NULL, GetCurrentThreadId());

安装全局钩子注入DLL的到所有进程,这使得调试pretty辛苦,您的DLL可能被写保护,而它在使用中。

Installing a global hook injects the DLL into all processes, which makes debugging pretty hard, and your DLL may be write-protected while it's in use.

这篇关于Teamviewers QuickConnect的按钮是如何实现的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆