- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
所以我创建了这个带有自定义 move 和调整大小的弹出窗口,按住 ctrl 键并单击客户端中的任意位置以 move 和 alt 调整边界大小。问题是,现在我正在为这个窗口内部创建子窗口,这里它“出错”了。我找不到如何将消息发送到父窗口。这是我试过的。
我在父窗口的wndproc中处理这些消息
case WM_NCHITTEST:
//determines if the window should be moving, sizing or don't do a thing
return DoHitTest(pWnd, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) );
case WM_NCLBUTTONDOWN:
//just set the cursor for visual notice
if (GetAsyncKeyState(VK_CONTROL) & 0x8000)
SetCursor(LoadCursor(NULL, IDC_SIZEALL));
break;
这是 doHitTest 方法
int WindowGnaq::DoHitTest(WindowBase* pWnd, int x, int y)
{
if( GetAsyncKeyState( VK_CONTROL ) & 0x8000 )
return HTCAPTION;
if( m_bAdjustable && GetAsyncKeyState( VK_MENU ) & 0x8000 )
{
short spare = 5;
RECT r;
pWnd->GetRect(r);
r.right -= 1;
r.bottom -= 1;
if (x < (r.left + spare) && y < (r.top + spare))
return HTTOPLEFT;
else if (x < (r.left + spare) && y > (r.bottom - spare))
return HTBOTTOMLEFT;
else if (x < (r.left + spare))
return HTLEFT;
else if (x > (r.right - spare) && y < (r.top + spare))
return HTTOPRIGHT;
else if (x > (r.right - spare) && y > (r.bottom - spare))
return HTBOTTOMRIGHT;
else if (x > (r.right - spare))
return HTRIGHT;
else if (y < (r.top + spare))
return HTTOP;
else if (y > (r.bottom - spare))
return HTBOTTOM;
}
return HTCLIENT;
}
这就是我在子窗口过程中尝试的
case WM_NCHITTEST:
//this just moves the mouse to the border i don't have but doesn't make me able to move
return SendMessage( m_pParent->GetHandle(), WM_SYSCOMMAND, SC_MOVE, -1);
//this doesn't to anything
return PostMessage( m_pParent->GetHandle(), msg, wParam, lParam);
//this makes the childwindow move instead of the parent
return SendMessage( m_pParent->GetHandle(), msg, wParam, lParam);
最佳答案
子窗口过程应该返回 HTTRANSPARENT
以响应 WM_NCHITTEST
,并且(引用 MSDN)“消息将被发送到相同的底层窗口线程直到其中一个返回不是 HTTRANSPARENT 的代码”
。
关于c++ - 如何使用 WM_NCHITTEST 从子窗口 move 无边框的父窗口,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8969852/
我注意到当光标位于标题栏内(不在边框上)时,消息 WM_NCHitTest 不会发送到表单。 我尝试使用以下任一方法拦截它 procedure WMNCHitTest(var Message: TWM
所描述的第 2 个显示器位于主显示器左侧的设置导致 WM_NCHITTEST 发送负值,根据 this 显然不支持该负值发布。 我有一个用 win32 编写的自定义控件,它类似于组控件。它有一个小的可
我正在玩 Windows API 试图了解它的行为方式,我意识到我可以完全删除 WNDPROC 并使用裸事件循环处理事情,如下所示: #include static struct { HWN
我正在通过指定边框样式 NONE 和 WM_NCHITTEST 的自定义处理来创建自定义绘制窗口。我已将某些区域定义为“我的窗口标题”,并在该区域中返回 WM_NCHITTEST 的 HTCAPTIO
case WM_NCHITTEST: { LRESULT hit = DefWindowProc( hWnd, uMsg, wParam, lParam ); if ( h
我正在尝试允许用户移动/调整 CEF 无边界窗口(使用 WS_POPUP 标志创建)。 鼠标位置在 CEF 浏览器中捕获(使用 Javascript)并调用 C++ 回调。然后,我通过 IPC 从 C
我在 Visual C++ 2010 中使用 wxWidgets。 我的目标之一是能够 move 我用窗口的任何部分(客户端或其他)创建的框架。为此,我过去曾使用 WM_NCHITTEST 让 Win
如何在 C# 代码中获取 WM_NCHITTEST 消息的坐标? 我希望获得最快的方式,因为性能是一项要求。 最佳答案 直到今天早上,我都会 100% 同意 Thomas Levesques 的回答,
我正在使用本文的代码http://melander.dk/articles/alphasplash/在表单中显示 32 位位图,但是当我尝试使用纯色位图而不是图像时,未收到 WM_NCHITTEST
我正在使用 win32 创建一个带有自定义标题栏和边框的窗口。我的问题是,当我使用 WM_NCHITTEST WM_LBUTTONDOWN 时,点击事件不会被触发。当我没有使用 WM_NCHITTES
我正在制作一个应用程序,它将自身挂接到目标应用程序,并且在被用户激活时,阻止所有键盘和鼠标窗口消息到达目标应用程序的窗口进程。我的应用程序通过将传入的输入消息(例如 WM_MOUSEMOVE)转换为
我创建了一个无边界窗口,它使用一个 wndProc() 函数强制 WM_NCHITTEST case 返回 HTCAPTION;,它允许用户拖动窗口,无论光标位于何处。 问题是我已经设置了自定义光标,
所以我创建了这个带有自定义 move 和调整大小的弹出窗口,按住 ctrl 键并单击客户端中的任意位置以 move 和 alt 调整边界大小。问题是,现在我正在为这个窗口内部创建子窗口,这里它“出错”
我用 C++ 创建了一个小型 MFC 文档 View 应用程序,但在从 CStatic 继承的类中接收消息时遇到了一些问题。我已经设法创建了 CStatic 派生,它在我的 View 中可见,但是我的
在什么情况下,消息WM_NCHITTEST 的lParam 会是一个不适合32 位整数的值? 由于我们的 WPF 应用程序中存在未处理的异常,我们的一位客户在他的 64 位计算机上遇到了崩溃,我很难找
我遇到了 WM_NCHITTEST 的奇怪行为消息。 总而言之,一旦我将鼠标悬停在目标(即:Hooked)控件上并保持鼠标静止(或空闲),我就会收到 无休止地百位 WM_NCHITTEST每秒消息。无
我是一名优秀的程序员,十分优秀!