Author Topic: Syslink control  (Read 818 times)

jj2007

  • Member
  • *****
  • Posts: 11526
  • Assembler is fun ;-)
    • MasmBasic
Syslink control
« on: March 08, 2021, 12:41:13 AM »
Has anybody found a method to get the index of an item in a syslink control with more than one embedded URL without clicking on it? I want to set a tooltip.

I've wasted a lot of time with LM_HITTEST, LHITTESTINFO, LITEM, EM_CHARFROMPOS, LIS_HOTTRACK and the like, but it seems impossible. The control itself produces hardly any messages when subclassed. Inter alia, I can see a NM_KEYDOWN notification when no key is being pressed... it's a mess :cool:

José has a page on SysLink_HitTest but it covers the clicked, not the hover case.

Biterider

  • Member
  • ****
  • Posts: 709
  • ObjAsm Developer
    • ObjAsm
Re: Syslink control
« Reply #1 on: March 08, 2021, 01:02:06 AM »
Hi
I haven't tried it myself, but I think the way to go is by sending LM_GETITEM messages in which the LITEM.iLink value is incremented one by one.
https://docs.microsoft.com/en-us/windows/win32/controls/lm-getitem
Then check the returned LITEM structure until you get the link you are looking for.
If you have a match, you have the index.

Biterider

jj2007

  • Member
  • *****
  • Posts: 11526
  • Assembler is fun ;-)
    • MasmBasic
Re: Syslink control
« Reply #2 on: March 08, 2021, 01:11:39 AM »
Thanks, biterider, but that would require to know the link I am looking for. This is not the case... I may know where my cursor is when receiving the TTN_SHOW notification, but the syslink control doesn't work with EM_CHARFROMPOS, unfortunately.

Clicking on the link is not the problem, the URL is easy to find:
Code: [Select]
mov rax, lParam
lea rax, [rax.NMLINK.item.szUrl]

But you don't want to click to set the tooltip :sad:

TouEnMasm

  • Member
  • *****
  • Posts: 1733
    • EditMasm
Re: Syslink control
« Reply #3 on: March 08, 2021, 01:54:05 AM »
The attachment show a modeless with syslink to ..... the windows common controls ,control spy version 2.
This one show all the mesages and the event,answer is here.
Fa is a musical note to play with CL

jj2007

  • Member
  • *****
  • Posts: 11526
  • Assembler is fun ;-)
    • MasmBasic
Re: Syslink control
« Reply #4 on: March 08, 2021, 02:20:14 AM »
Did you read and understand the question, Yves?

In the meantime, I found a working solution:
Code: [Select]
  .if NotifyCode==TTN_SHOW
invoke GetCursorPos, addr pointL
invoke ScreenToClient, hSyslink, addr pointL
mov eax, pointL.x
mov edx, pointL.y
shl edx, 16
or eax, edx
push eax
or hoverFlag, -1
invoke SendMessage, hSyslink, WM_LBUTTONDOWN, MK_LBUTTON, eax
pop eax
invoke SendMessage, hSyslink, WM_LBUTTONUP, MK_LBUTTON, eax

TouEnMasm

  • Member
  • *****
  • Posts: 1733
    • EditMasm
Re: Syslink control
« Reply #5 on: March 08, 2021, 04:09:56 AM »
Did you see what is it ?
It's for everyone and it's a prime source of informations.

Fa is a musical note to play with CL

jj2007

  • Member
  • *****
  • Posts: 11526
  • Assembler is fun ;-)
    • MasmBasic
Re: Syslink control
« Reply #6 on: March 08, 2021, 04:50:15 AM »
Did you see what is it ?
It's for everyone and it's a prime source of informations.

Yves, a simple deb shows me all Windows messages - much more convenient than an extra window:
Code: [Select]
WndProc proc uses esi edi ebx hWnd, uMsg, wParam:WPARAM, lParam:LPARAM
  inc msgCount
  deb 4, "msg", chg:msgCount


In any case, your contribution has nothing to do with the question asked here. You are spamming my threads, mon cher ami :badgrin:

TouEnMasm

  • Member
  • *****
  • Posts: 1733
    • EditMasm
Re: Syslink control
« Reply #7 on: March 08, 2021, 05:49:18 PM »
I see,the one who have wrote:
Quote
I've wasted a lot of time with LM_HITTEST, LHITTESTINFO, LITEM, EM_CHARFROMPOS, LIS_HOTTRACK and the like, but it seems impossible. The control itself produces hardly any messages when subclassed. Inter alia, I can see a NM_KEYDOWN notification when no key is being pressed... it's a mess :cool:

is to smart to use the windows tools who give it the answer and all is needed to solve the problem without a line of code.
continue to make me laugh  :thumbsup:

Fa is a musical note to play with CL

jj2007

  • Member
  • *****
  • Posts: 11526
  • Assembler is fun ;-)
    • MasmBasic
Re: Syslink control
« Reply #8 on: March 08, 2021, 07:48:30 PM »
I see,the one who have wrote:
Quote
I've wasted a lot of time with LM_HITTEST, LHITTESTINFO, LITEM, EM_CHARFROMPOS, LIS_HOTTRACK and the like, but it seems impossible. The control itself produces hardly any messages when subclassed. Inter alia, I can see a NM_KEYDOWN notification when no key is being pressed... it's a mess :cool:

is to smart to use the windows tools who give it the answer and all is needed to solve the problem without a line of code.
continue to make me laugh  :thumbsup:

Nonsense, Yves. The spy tool is very old and very limited. Spy does not "give it the answer". You don't understand the question, but you keep trolling. Are you French, by accident?

My deb macro is much more powerful. It shows me that the SysLink control receives a few messages: WM_NCHITTEST, WM_SETCURSOR, WM_ERASEBKGND, WM_PAINT, WM_NCPAINT, WM_GETTEXT and WM_MOUSEMOVE. None of them reveals the index of the URL inside the control. The main window receives WM_NOTIFY: NM_KEYDOWN, without pressing any key. That is, ehm, undocumented :cool:
Code: [Select]
notify  5       WM_NOTIFY: NM_KEYDOWN
SysLink 104     WM_PAINT
SysLink 105     WM_GETTEXTLENGTH
SysLink 106     WM_GETTEXT
notify  108     WM_NOTIFY: TTN_NEEDTEXTW
notify  109     WM_NOTIFY: NM_KEYDOWN
notify  110     WM_NOTIFY: TTN_SHOW
SysLink 111     WM_GETTEXT
SysLink 112     WM_NCPAINT
notify  113     WM_NOTIFY: NM_KEYDOWN
SysLink 117     WM_ERASEBKGND
notify  118     WM_NOTIFY: NM_KEYDOWN
notify  121     WM_NOTIFY: TTN_POP
SysLink 125     WM_PAINT
SysLink 126     WM_NCPAINT
SysLink 130     WM_ERASEBKGND
notify  131     WM_NOTIFY: NM_KEYDOWN
notify  522     WM_NOTIFY: NM_KEYDOWN
notify  523     WM_NOTIFY: TTN_SHOW
SysLink 524     WM_PAINT
SysLink 525     WM_NCPAINT
notify  526     WM_NOTIFY: NM_KEYDOWN
SysLink 530     WM_ERASEBKGND
notify  531     WM_NOTIFY: NM_KEYDOWN
notify  580     WM_NOTIFY: TTN_POP
SysLink 639     WM_PAINT
SysLink 640     WM_NCPAINT
SysLink 644     WM_ERASEBKGND
notify  645     WM_NOTIFY: NM_KEYDOWN

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 8434
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: Syslink control
« Reply #9 on: March 08, 2021, 08:06:46 PM »
Guys, can you keep the bickering down, I don't want to have to keep track of this stuff or edit it. To put it in terms of archaic Australian folklore, it sounds like a pair of old molls at a christening.  :tongue:
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :skrewy: