专门用于消息回调窗口的窗口标识

HWND_MESSAGE
Message-Only Windows

A message-only window enables you to send and receive messages. It is
not visible, has no z-order, cannot be enumerated, and does not
receive broadcast messages. The window simply dispatches messages. To
create a message-only window, specify the HWND_MESSAGE constant or a
handle to an existing message-only window in the hWndParent parameter
of the CreateWindowEx function. You can also change an existing window
to a message-only window by specifying HWND_MESSAGE in the
hWndNewParent parameter of the SetParent function. To find
message-only windows, specify HWND_MESSAGE in the hwndParent parameter
of the FindWindowEx function. In addition, FindWindowEx searches
message-only windows as well as top-level windows if both the
hwndParent and hwndChildAfter parameters are NULL.
see: https://msdn.microsoft.com/en-us/library/windows/desktop/ms632599(v=vs.85).aspx

示例:
HWND hWnd = CWindowImpl::Create(HWND_MESSAGE, CWindow::rcDefault, NULL, WS_POPUP, 0, (UINT)0);

bool CNetProxy::CreateProxyWindow()
{
    WNDCLASSEXW wc = { 0 };
    wc.cbSize = sizeof(wc);
    wc.lpfnWndProc = (WNDPROC)ProxyWndProc;
    wc.hInstance = ::GetModuleHandle(0);
    wc.lpszClassName = PROXY_WND_CLASS;
    ATOM ret = ::RegisterClassExW(&wc);
    if (ret == NULL || ::GetLastError() == ERROR_CLASS_ALREADY_EXISTS)
        return FALSE;

    m_hProxyWnd = ::CreateWindowW(PROXY_WND_CLASS, _T("GBProxyWnd"), 0, 0, 0, 0, 0, HWND_MESSAGE, 0, GetModuleHandle(NULL), 0);
    if (!::IsWindow(m_hProxyWnd))
        return false;

    return true;
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值