Hi to all!

I create a list box with
invoke CreateWindowEx, WS_EX_CLIENTEDGE, CStr("LISTBOX"), NULL,
It works but some records are too long and it is visible only
one half of the string. How can I make some tips that will
show those long strings when mouse cursor is over the record?

Posted on 2003-03-25 10:19:54 by Mike
Sounds like you need a tooltip control.
Posted on 2003-03-25 12:32:31 by Odyssey
Hmmm, is your reply the answer to question "How to" or not?
Posted on 2003-03-26 06:35:10 by Mike
How to.
Posted on 2003-03-26 06:41:29 by Odyssey
you need to get the handle to the tooltip for the listbox. then use the following api:

invoke SetWindowPos,hTip,HWND_TOPMOST,0,0,0,0, SWP_SHOWWINDOW

this should do what your asking
Posted on 2003-03-26 09:25:24 by smurf
I would use LB_ITEMFROMPOINT to find the item index number and LB_GETITEMRECT to get the rectangle of the item then draw a static directly over it with the full text. This gives you the advantage of being able to place the text directly over the item and use the same font/colour as is used in the listbox. The static uses a WS_BORDER and WS_CHILD style and in this case a white (SS_WHITERECT) background but you can use any one you want. Track the mouse movement with a mousehook and destroy the static when the cusor moves outside of the static. If you want to get fancy you can process the scroll messages and move the static with the item when the user scrolls.

The meat of the code would be like this (untested but it should give you an idea)
; mouse is detected to have moved to a new item

invoke GetCursorPos, ADDR pt
invoke ScreenToClient, hListBox, ADDR pt
invoke SendMessage, hListBox, LB_ITEMFROMPOINT, 0, ADDR pt
mov iItem, eax
invoke SendMessage,hListBox, LB_GETITEMRECT, iItem, ADDR rct
invoke CreateWindowEx, NULL, ADDR szStatic, NULL, WS_BORDER or WS_BORDER or SS_WHITERECT \
rct.left, rct.top, rct.right, rct.bottom, hListBox, hInstance, NULL
mov hStatic, eax
; Set the font if necessary here
invoke SendMessage, hListBox, LB_GETTEXT, iItem, ADDR szTEXT
invoke SendMessage, hStatic, WM_SETTEXT, 0, ADDR szTEXT
; wait for the mouse to move outside of the static then use DestroyWindow

If you used an edit control instead of a static you could double this to allow direct editing of lisbox items as well.
Posted on 2003-03-26 09:51:18 by donkey
Thanks, smurf!
As I understand I must create tooltip window
invoke CreateWindowEx,NULL,ADDR ToolTipsClassName,NULL,\ TTS_ALWAYSTIP,CW_USEDEFAULT,\

then detect the mouse position
mov ebx,
.IF dword ptr == TTN_NEEDTEXT
mov eax,dword ptr
mov dword ptr , offset szTipX ; or reset tip window position

Clearly. But how to detect what text is now under mouse?

Posted on 2003-03-26 09:56:41 by Mike
To get the text under the cursor :

invoke GetCursorPos, ADDR pt
invoke ScreenToClient, hListBox, ADDR pt
invoke SendMessage, hListBox, LB_ITEMFROMPOINT, 0, ADDR pt
invoke SendMessage, hListBox, LB_GETTEXT, eax, ADDR szTEXT
Posted on 2003-03-26 10:04:02 by donkey
Thanks, donkey! It is right that donkey is symbol of the wisdom!

Posted on 2003-03-26 10:44:54 by Mike
Mmmm... Never thought of it being a symbol of wisdom, that could look good on me. Wouldn't fool anybody though :)
Posted on 2003-03-26 16:14:37 by donkey
I read in one book (seriously!), that the basic american parties have the following symbols. Democratic party's symbol is donkey (as) and republicans party's symbol is elephant. The elephant is a symbol of force, and donkey is a symbol of wisdom.

Posted on 2003-03-27 07:49:21 by Mike
Actually the Democratic Donkey was used by a political cartoonist to take a jab at Andrew Jackson in 1837 by playing on the Republicans calling him a Jackass for his "let the people rule" campaign slogan. The cartoon was pretty popular and by the late 1800's it became the standard of the Democratic party.
Posted on 2003-03-27 07:58:43 by donkey
i know a donkey, concrete one and it's a symbol of how a good game can be fu**ed.
Posted on 2003-04-02 09:28:05 by AceEmbler