NO

Author Topic: Tooltip mistery  (Read 127 times)

Online Jokaste

  • Member
  • *
  • Posts: 101
  • Never be pleased, always improve.
    • ImgTools
Tooltip mistery
« on: October 09, 2017, 04:12:39 pm »
I have the following code for a tootip from a toolbar. For me all seems to be correct but the tooltip is not displayed. Can anyone help me. Thanks.


Kenavo

Online Jokaste

  • Member
  • *
  • Posts: 101
  • Never be pleased, always improve.
    • ImgTools
Re: Tooltip mistery
« Reply #1 on: October 09, 2017, 04:20:54 pm »
I have found!
Code: [Select]
@GetDispInfos :


                     mov      rdx,[r9].NMTTDISPINFO.hdr.idFrom
                     or      [r9].NMTTDISPINFO.uFlags,TTF_DI_SETITEM or TTF_IDISHWND
                     mov      [r9].NMTTDISPINFO.hinst,0
                     mov      rax,OFFSET hInstance
                     lea      r8,[r9].NMTTDISPINFO.szText
                     mov      rcx,[rax]
                     mov      [r9].NMTTDISPINFO.lpszText,r8
                     mov      r9,80
                     call   LoadStringA

                     xor      rax,rax
                     ret

The problem was caused by this line :

OR [r9].NMTTDISPINFO.uFlags,TTF_DI_SETITEM or TTF_IDISHWND
Quote
TTF_IDISHWNDIf this flag is set, idFrom is the tool's handle. Otherwise, it is the tool's identifier.
« Last Edit: October 09, 2017, 04:24:39 pm by Jokaste »
Kenavo

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 1642
Re: Tooltip mistery
« Reply #2 on: October 09, 2017, 08:14:38 pm »
Toolbar can load string from resource in this way too:
Code: [Select]
void OnNotify(HWND hwnd, int idCtrl, NMHDR* pNMHdr)
{
switch (pNMHdr->code)
{
case TTN_NEEDTEXT:
{
((LPTOOLTIPTEXT)pNMHdr)->hinst = hInst;
((LPTOOLTIPTEXT)pNMHdr)->lpszText = MAKEINTRESOURCE(((LPTOOLTIPTEXT)pNMHdr)->hdr.idFrom);
return;
}
}
}
Code: [Select]
178: void OnNotify(HWND hwnd, int idCtrl, NMHDR* pNMHdr)

OnNotify:
179: {
180: switch (pNMHdr->code)
  [00000000000004F0] 41817810F8FDFFFF             cmp               dword ptr [r8+10],FFFFFDF8
  [00000000000004F8] 7517                         jne               0000000000000511
181: {
182: case TTN_NEEDTEXT:
183: {
184: ((LPTOOLTIPTEXT)pNMHdr)->hinst = hInst;
  [00000000000004FA] 488B0500000000               mov               rax,qword ptr [hInst]
  [0000000000000501] 49894070                     mov               qword ptr [r8+70],rax
185:
186: ((LPTOOLTIPTEXT)pNMHdr)->lpszText = MAKEINTRESOURCE(((LPTOOLTIPTEXT)pNMHdr)->hdr.idFrom);
  [0000000000000505] 418B4008                     mov               eax,dword ptr [r8+8]
  [0000000000000509] 480FB7C0                     movzx             rax,ax
  [000000000000050D] 49894018                     mov               qword ptr [r8+18],rax
187: return;
  [0000000000000511] C3                           ret
May the source be with you

Online Jokaste

  • Member
  • *
  • Posts: 101
  • Never be pleased, always improve.
    • ImgTools
Re: Tooltip mistery
« Reply #3 on: October 10, 2017, 12:58:57 pm »
TTN_GETDISPINFO = TTN_NEEDTEXT
Kenavo