Windows 7编辑控件,垂直滚动不起作用 [英] Windows 7 edit control, vertical scroll does not work
问题描述
我有一个可以编译ok(mingw)并运行ok的应用程序,但是创建的编辑控件具有滚动条,但是垂直滚动条不执行任何操作.相同的可执行文件在WinXP上可以正常工作.此外,编辑控件同时具有垂直和水平滚动条,水平滚动条很好,但垂直滚动条没有.垂直滚动条可见并且可以单击,但是什么也没发生...
I have an application that compiles ok (mingw) and runs ok, however the edit control that is created has scroll bars but the vertical scroll bar doesn't do anything. The same executable works fine on WinXP. Also, the edit control has both vertical and horizontal scroll bars, the horizontal works just fine, but vertical does not. The vertical scroll bar is visible and clickable, but nothing happens...
在创建编辑控件时使用以下代码:
Following code is used when creating the edit control:
HWND hwndEdit = CreateWindow(TEXT("EDIT"), TEXT("Edit control"),
WS_OVERLAPPED | WS_VISIBLE | WS_HSCROLL | WS_VSCROLL | ES_LEFT | ES_MULTILINE |
ES_AUTOHSCROLL | ES_AUTOVSCROLL | ES_READONLY | WS_SIZEBOX,
1000, 480, 400, 500, NULL, 0, GetModuleHandle(NULL), NULL);
SendMessage(hwndEdit, WM_SETTEXT, 0, (LPARAM) TEXT(""));
SendMessage(hwndEdit, EM_LIMITTEXT, 0, 0);
以下代码重复用于添加文本以编辑控件:
Following code is used repeatedly to add text to edit control:
char test[] = "test";
SendMessage(hWndDbg, EM_SETSEL, 0x7FFFFFFF, 0x7FFFFFFF); // Undo any selection and move to end.
SendMessage(hWndDbg, EM_REPLACESEL, 0, (LPARAM) temp);
推荐答案
使用GetDesktopWindow()作为hWndParent参数.它可以在Win7上运行.
Use GetDesktopWindow() as hWndParent parameter. It works on Win7.
这篇关于Windows 7编辑控件,垂直滚动不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!