| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | scrollbars in mle |
jl>> How can I get the hwnd of scrollbars in an MLE control?
> Perhaps WinBeginEnumWindows(hwndMle)?
Thanks for a tip. Actually I had a sample source code lurking on my PMSRC
directory. It does exactly what I wanted but I found it only when you gave
me a right keyword :-)
Here it is. queryMLEScroll is from EDMI vol.2 issue 1 and originally
written by Larry Salomon, Jr. It was for ownerdrawn listboxes but it can be
used for MLE, too.
The other function is my subclassed MLE wndproc which allows you to create
e.g. a browser (readonly style MLE). It responds to arrow and pgup/pgdn
keys and forwards them to the scrollbars of the MLE.
// This function returns the specified scrollbar for an MLE.
//
// Input: hwndMLE - handle of the MLE window to query
// bWantVert - TRUE if the vertical scrollbar is desired, FALSE if
// horizontal
// Returns: handle of the scrollbar window if successful, NULLHANDLE
// otherwise
HWND queryMLEScroll (HWND hwndMLE, ULONG ulWantStyle)
{
HENUM heEnum;
HWND hwndScroll;
CHAR achClass[256];
ATOM aClass;
ULONG ulStyle;
// Enumerate all children of the MLE
heEnum = WinBeginEnumWindows (hwndMLE);
while (NULLHANDLE != (hwndScroll = WinGetNextWindow (heEnum)))
{
// Query the class name. Public window classes have class names
// which although they are in the for "#dddd" are really atoms.
// Thus, we need to check the system atom table and compare the
// result against the low word of the WC_* constant.
//
// Oh. Why, you ask? Because the numerical form of an integer
// atom contains the number in the low word and 0xFFFF in the high
// word. Since all of the WC_* constants have 0xFFFF in the high
// word, they are all integer atoms.
WinQueryClassName (hwndScroll, sizeof (achClass), achClass);
aClass = WinFindAtom (WinQuerySystemAtomTable(), achClass);
if (aClass == LOUSHORT (WC_SCROLLBAR))
{
// We found a scrollbar; now check to see if it is the right type.
ulStyle = WinQueryWindowULong (hwndScroll, QWL_STYLE);
if ((ulStyle & SBS_VERT) == ulWantStyle)
break;
}
}
WinEndEnumWindows (heEnum);
return hwndScroll;
} // queryMLEScroll
// subclassed MLE window procedure
MRESULT EXPENTRY wpSubMLE (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
{
if (msg == WM_CHAR)
{
USHORT flags = SHORT1FROMMP (mp1);
if ( flags & KC_VIRTUALKEY &&
!(flags & KC_KEYUP ||
flags & KC_CTRL ||
flags & KC_SHIFT ||
flags & KC_ALT)
)
{
HWND hVscroll, hHscroll;
switch (SHORT2FROMMP (mp2))
{
case VK_UP:
case VK_DOWN:
case VK_PAGEUP:
case VK_PAGEDOWN:
hVscroll = queryMLEScroll (hwnd, SBS_VERT);
// send message to scroll bar
return WinSendMsg (hVscroll, msg, mp1, mp2);
case VK_LEFT:
case VK_RIGHT:
hHscroll = queryMLEScroll (hwnd, SBS_HORZ);
return WinSendMsg (hHscroll, msg, mp1, mp2);
default:
break;
}
}
}
return pfnwpMLE (hwnd, msg, mp1, mp2);
} // wpSubMLE
// Albert
---
* Origin: Albert's Point/2 in Finland, Europe (2:221/319.20)SEEN-BY: 54/54 620/243 632/348 640/820 690/660 711/409 413 430 807 808 809 SEEN-BY: 711/934 712/353 623 713/888 800/1 2442/0 @PATH: 221/319 0 220/841 201/2104 109/347 2 1 3615/50 229/2 @PATH: 2442/0 711/409 54/54 711/808 809 934 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.