Win32 |
Author |
Message |
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3152 Location: Europe
|
Posted: Tue Jun 27, 2006 1:52 pm Post subject: Tooltips & Other Common Controls |
|
|
Raymond Chen: Coding in-place tooltips
"These are tooltips that appear when the user hovers the mouse over a
string that cannot be displayed in its entirety. The tooltip overlays the
partially-displayed text and provides the remainder of the text that had
been truncated. The keys to this technique are the TTN_SHOW notification
(which lets you adjust the positioning of a tooltip before it is shown) and
the TTM_ADJUSTRECT message which tells you precisely where you need
the tooltip to be." |
|
Back to top |
|
|
XNote Kapetan
Joined: 16 Jun 2006 Posts: 532
|
|
Back to top |
|
|
Night Owl Guest
|
Posted: Thu Jun 29, 2006 7:44 pm Post subject: |
|
|
Look at this: Generating tooltip text dynamically
"Let's make it display something a bit more interesting so it's more
obvious that what we're doing is actually working." |
|
Back to top |
|
|
James Guest
|
Posted: Wed Jul 05, 2006 6:55 pm Post subject: Control Spy 2.0 |
|
|
"Control Spy is a tool to help developers understand common controls,
the application of styles to them, and their response to messages and
notifications.
With Control Spy, you can see instantly how different styles affect the
behavior and appearance of each control, and also how you can change the
state of each control by sending messages.
Two versions of Control Spy are available, one for Comctl32.dll version 5.x
and one for Comctl32.dll version 6.0 and later."
On MSDN: Control Spy 2.0 |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Sun Jul 16, 2006 11:56 am Post subject: |
|
|
Groups: tool tips disappear and will not return
"The single tool tip I've created seems to behave as described in the
Platform SDK documentation, except that when its autopop timer goes off (and
the tip thus disappears), and I move the mouse outside the tool and then
back inside, the tool tip will not reappear. Is this standard behavior?" |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Thu Oct 05, 2006 10:47 am Post subject: |
|
|
CodeGuru: Tab control - Lparam
"One of the approaches would be to assign pointer of a dialog to tab’s
data structure, retrieve it when tab is selected. And yes you can use
LPARAM member to store it."
CBoard: Rebar Band problem
According to the documentation, the WPARAM argument for the RB_SETBANDINFO
message specifies the zero-based index of the band to receive the new settings.
Code: | rbc.hwndRB = CreateWindowEx(WS_EX_TOOLWINDOW, REBARCLASSNAME, NULL,
WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN
| RBS_BANDBORDERS | CCS_NODIVIDER | RBS_VARHEIGHT,
0, 0, 0, 0, hwnd, NULL, hInst, NULL);; |
|
|
Back to top |
|
|
XNote Kapetan
Joined: 16 Jun 2006 Posts: 532
|
Posted: Wed Oct 11, 2006 9:16 pm Post subject: |
|
|
CodeGuru: Animate an Icon on the Taskbar when the Application Is Minimized
"This article will show the technique to animate an application's icon on
the Taskbar when the application is minimized. The main usage of this
implementation is to inform the user about some background tasks that
are still active in the application when it is minimized."
Code: | if (hIconNew != hIconCurr) {
DestroyIcon (hIconCurr);
SetClassLong (m_hWnd, GCL_HICON, (long) hIconNew);
RedrawWindow (NULL, NULL, RDW_ERASE | RDW_FRAME | RDW_INVALIDATE);
}
|
Or SetWindowLong() maybe? |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Wed Dec 13, 2006 7:10 pm Post subject: |
|
|
RC: Displaying infotips for folded and unfolded listview items
"When displaying infotips for listview items, you have to deal with both
the folded and unfolded case. "Folded" is the term used to describe a
listview item in large icon mode whose text has been truncated due to
length. When the user selects the item, the full text is revealed, a process
known as "unfolding"."
And: Computing listview infotips in the background
"When the listview control asks you for an infotip, it sends you then
LVN_GETINFOTIP notification, and when you return, the result is displayed
as the infotip" |
|
Back to top |
|
|
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3152 Location: Europe
|
Posted: Tue Jan 16, 2007 6:32 pm Post subject: |
|
|
RC: EnumChildWindows already enumerates recursively
"The reason is that the EnumChildWindows function already does the recursion.
If a child window has created child windows of its own, EnumChildWindows
enumerates those windows as well. If you add your own recursion, then you
end up counting grandchildren twice, great-grandchildren four times, and so
on. The recursion is already done by EnumChildWindows; just use it." |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Tue Jan 30, 2007 9:57 am Post subject: |
|
|
Raymond: If vertical strips are better, why do toolbars use horizontal strips?
"All this is a long way of saying that source code compatibility between
16-bit code and 32-bit code was very important, not only within the Windows 95
shell team, but throughout the Windows 95 product, so that teams could
port their 16-bit components to 32-bit in a gradual and evolutionary manner." |
|
Back to top |
|
|
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3152 Location: Europe
|
Posted: Wed Jan 31, 2007 5:08 pm Post subject: |
|
|
CodeGuru: Tab Bar Control
"It looks like one question is asked quite frequently (or is it my perception)
on the VC++ forum: How do you create more than one view in a frame
and have all views wired to the same document object, with the ability to
switch views at will, making one as visible and active?" |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Thu Feb 08, 2007 6:41 pm Post subject: |
|
|
RC: Why does my property sheet blink and the immediately disappear?
"This also explains why you might see a property sheet page that disappears
once you click on its tab. The same thing happened: The property sheet
manager tried to create the dialog, but the CreateDialog failed, so it deleted
that page and tried the next page." |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Fri Feb 23, 2007 9:20 pm Post subject: |
|
|
msdn: GUI Control to Major Tom, by John Robbins
Microsoft UI Automation, UISpy, The UIWindow Class: "My goal for this
column is to show you how to get started with GUI automation using the
UI Automation tools and APIs. As with most Bugslayer columns, there's a
large set of code that I provide to make your GUI testing far easier than
using the API directly." |
|
Back to top |
|
|
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3152 Location: Europe
|
Posted: Wed Mar 28, 2007 5:58 pm Post subject: |
|
|
RC: Why are there both TBSTYLE_EX_VERTICAL and CCS_VERT?
"Whoever created the TBSTYLE_EX_VERTICAL extended style didn't realize
that there was already a perfectly good way of specifying a vertical toolbar
(namely, CCS_VERT)." |
|
Back to top |
|
|
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3152 Location: Europe
|
Posted: Thu Apr 05, 2007 8:11 pm Post subject: |
|
|
Why can't I display a tooltip for a disabled window?
"When a window is disabled, it does not receive keyboard or mouse input.
The documentation for EnableWindow says so in so many words, right in
the first sentence." |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Thu Apr 12, 2007 11:31 pm Post subject: |
|
|
RC: What is the default version of the shell common controls?
"If a program wanted to use version 6 of the common controls, it had to say
so explicitly in a manifest. (What we on the shell team informally call a "v6
manifest".) That way, only programs that asked for the new behavior got it." |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Wed May 30, 2007 3:52 pm Post subject: |
|
|
Rebar and ToolBars
"I finish the project with the ToolBar, I've only that insert some Windows
Styles to the ToolBars...", but lots of code... |
|
Back to top |
|
|
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3152 Location: Europe
|
Posted: Fri Jun 01, 2007 8:07 pm Post subject: |
|
|
RC: Visual C++ 2005 will generate manifests for you
"New in Visual C++ 2005 is the ability to specify a manifest dependency
via a #pragma directive. This greatly simplifies using version 6 of the shell
common controls." |
|
Back to top |
|
|
delovski
Joined: 14 Jun 2006 Posts: 3524 Location: Zagreb
|
Posted: Sat Jul 14, 2007 2:16 pm Post subject: |
|
|
CodeGuru: Tree List Control
"The accompanying code is an implementation of a tree view, combined with
a list view, for the Windows API. The view is compatible to the tree control
of the common controls. It allows the user to set colors, text, and icons for
each item separately. An MFC class for the view is also implemented." |
|
Back to top |
|
|
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3152 Location: Europe
|
Posted: Tue Jan 29, 2008 4:27 pm Post subject: |
|
|
RC: The history of the Windows XP common controls
"These controls were originally custom controls written by the shell team
for use in Explorer, but since they seemed to be generally useful, time was
budged to do the extra work to make the controls more suitable for general
use, testing the controls in combinations and scenarios that Explorer itself
didn't use, and putting together formal documentation." |
|
Back to top |
|
|
XNote Kapetan
Joined: 16 Jun 2006 Posts: 532
|
Posted: Fri Nov 07, 2008 5:02 pm Post subject: |
|
|
cboard - XP boot style progress bar
"I know how to make a progress bar just fine. But how do you make the kind
that have a few tickers in the middle scrolling over and over across the screen?" |
|
Back to top |
|
|
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3152 Location: Europe
|
Posted: Tue Nov 28, 2023 4:54 pm Post subject: |
|
|
so - SetWindowTextW in an ANSI project
"SetWindowText()/SetWindowTextA() and SetWindowTextW() are all really
WM_SETTEXT which is one of the few messages subject to code-page
translation when you create a multibyte/Ansi window. This means there is no
W and A versions of the message. All you need to do is intercept the
WM_SETTEXT message in your window and pass the arguments to
DefWindowProcW() instead of the usual DefWindowProcA/DefWindowProc()." |
|
Back to top |
|
|
Ike Kapetan
Joined: 17 Jun 2006 Posts: 3152 Location: Europe
|
Posted: Thu Nov 30, 2023 5:40 pm Post subject: |
|
|
I learned SetWindowTextW() ends up as a WM_SETTEXT call to the windows
procedure and since all of my edit fields have my own custom procedure that
handles a few different things but then for the rest of the messages ends up
with a call to CallWindowProc() on the original procedure and since it was an
ansi project that is CallWindowProcA() and that is the main reason why
SetWindowTextW() failed in the first place.
SetWindowTextW() would have worked without me sublassing the edit box.
So now, I explicitly call CallWindowProcW() for SETTEXT & GETTEXT outside
of that custom procedure and everything works as it should.
This is all very interesting as it occured to me that when I used
SetWindowTextW() and it displayed e instead of -grave it should have
crashed really or displayed some random characters. But no, edit control's
proc detected what is in the buffer (or lParam for WM_SETTEXT message)
and converted it to my local encoding because I was handling that message
with CallWindowProcA().
But how did edit control know what is in the lParam? SetWindowTextW()
should have sent Unicode string, not plain char *. Or maybe not?
What is actually more interesting is that I intercepted that lParam after I
set the breakpoint on the SetWindowTextW() call and then in my custom
edit proc, on the last line where I use CallWindowProcA() and lParam does
not seem to be Unicode string but it's just a plain C string. How
SetWindowTextW() knows I will call CallWindowProcA()? Because I did
before?
If only Raymond Chen wrote something about it. I found these somewhat
related posts but nothing about WM_SETTEXT and how it's handling lParam.
https://devblogs.microsoft.com/oldnewthing/20211210-00/?p=106021
https://devblogs.microsoft.com/oldnewthing/20211210-00/?p=106021
In the end, in my case with sublassed edit proc, the only way to make it
work with unicode is not to use SetWindowTextW() and to explicitly call
edit's proc like this:
Code: | CallWindowProcW (origEditProc, ctlHwnd, WM_SETTEXT, 0L, (long)wcharBuffPtr);
|
.. instead of:
Code: | SetWindowTextW (ctlHwnd, wcharBuffPtr); |
|
|
Back to top |
|
|
|