Userform controls' balloon tooltips not showing in Excel 64-bit

rplazzotta

New Member
Joined
Oct 28, 2021
Messages
41
Office Version
  1. 2019
  2. 2010
Platform
  1. Windows
Can anyone help with my BalloonToolTips class? It works in Excel 32-bit (W7 and W10) but not in Windows 10 Excel 64-bit, even though it compiles without errors.
It's old VB6 code that I've adapted for VBA (VBA only exposes hWnds for Frames and Listboxes).
So I put any controls other than the above that require a multiline "ControlTipText" in a caption-less Frame with the Userform's bordercolor and I put the control's ControlTipText in that of the Frame.
It's the only way I've found to provide multiline tooltips for such controls.

But they just don't show in Excel 64-bit. Any help would be greatly appreciated.

http://www.wot.fr/BalloonToolTipDemo.zip

Richard
 
Dan, forget what I just said in my previous post, Excel 64-bit does expose hWnds, as the listbox in my userform proves.
So something must be missing in my BalloonToolTips class code (Sendmessage something? Or other API calls?)

Richard
Oh. Sorry - I should've replied sooner. ?
But yes, I agree - my sense is that something is slightly amiss here. If it works perfectly in 32bit, but not at all in 64bit, it's got to be somewhere in the API call - maybe the wrong data type of a variable? Or the UDT type? I'll need to look at it properly, but if you've already looked over Jaafar's working examples, and you didn't see anything...
 
Upvote 0

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
Curiosity got the better of me, so I tried going through your code again to see if anything jumped out at me again. It didn't, unfortunately, save for the fact the hWnd values being returned from the getFocus API call for each of the Frame controls was different to that which was being returned at the same time from the hidden Hwnd property. A basic swapping out the values in your code for these ones doesn't get it to work, but I thought it was worth noting for now.
 
Upvote 0
I'm not sure what you mean by this. It's been a while since I've used 32-bit Excel, but I don't recall either the Userform or the Frames/Listbox having an 'obvious' hwnd property - is that what you mean? The hWnds are certainly accessible through using APIs - I think from when I looked at your code, you've also used the FindWindow API (or example), no? 64-bit Excel is no different.

Recently, I've been trying to get on top of GDI/GDIP graphics API calls, so being able to get the hWnd and hDC has been pretty important - they are definitely there, but just not for all userform controls. In delving into this area, I've had to convert a lot of VB6 projects, and the lack of a Picturebox control (with a hwnd, etc) was painful. So I've been developing a class to reproduce the same properties and methods of a picturebox by superimposing them over a frame control because it has a hWnd! But what I have only just learnt as of a few months ago is that the frame control does have a hidden hwnd property:

VBA Code:
hWnd  = Frame1.[_getHwnd]

So definitely they definitely exist. I know the InkEdit control has a hWnd property, as does ListView, I think.
Yes, as I've said in my code, it's an undocumented fact that VBA does expose hWnd for at least Frame and Listbox.
The trick I use in BalloonToolTip.cls is Ctrl.SetFocus (Ctrl being either a Frame or a Listbox) then FindWindow.
As I said in my first post, I put all other controls that need a multiline tooltip in an "invisible" Frame.
So that may be the way to go for you (just create an "invisible" Frame and put your Image in it).

To return to my original problem, does anyone else in the forum have any thoughts on why a Balloon tooltip in a Userform with an hWnd shows in Excel 32-bit but not in Excel 64-bit?
That's the crux of the matter. Because for the application I'm current developing, I can hardly ask my users to install Office 32-bit just for balloon tooltips!

In the meantime, I'll delve further into Jaafar's Inputbox code and try and understand it!
 
Upvote 0
Curiosity got the better of me, so I tried going through your code again to see if anything jumped out at me again. It didn't, unfortunately, save for the fact the hWnd values being returned from the getFocus API call for each of the Frame controls was different to that which was being returned at the same time from the hidden Hwnd property. A basic swapping out the values in your code for these ones doesn't get it to work, but I thought it was worth noting for now.
Sorry, our messages are crossing.

But I'm intrigued by "the hWnd values being returned from the getFocus API call for each of the Frame controls was different to that which was being returned at the same time from the hidden Hwnd property". What do you mean by "hidden Hwnd property" as opposed to the value returned by getFocus, and how do you access the former?
 
Upvote 0
Sorry, I do need to keep reminding myself that not everyone can read mind and so I ought to explain myself properly. By hidden hWnd property, I am referring to this:
VBA Code:
hWnd = Frame1.[_getHwnd]
I've seen in your code (which I honestly have just skimmed) that the approach you've taken to get the hWnd of the user controls is to SetFocus and the GetFocus (which returns the hWnd). Have you checked on Spy++, etc., that the hWnd values are correct? I only did a basic check by printing out the hWnd values obtained through the 'hidden property' method and checking them against the values that your code produced, noting that they were different, but I would want to double check that when Iget home later tonight. I'll ask around, but if no one else pipes up here, perhaps other sites to check would be VBForums.com (in the OFfice Development area) or Reddit? Though the people I'm thinking of asking are the ones likely to be reading those forums anyway!
 
Upvote 0
Sorry, I do need to keep reminding myself that not everyone can read mind and so I ought to explain myself properly. By hidden hWnd property, I am referring to this:
VBA Code:
hWnd = Frame1.[_getHwnd]
I've seen in your code (which I honestly have just skimmed) that the approach you've taken to get the hWnd of the user controls is to SetFocus and the GetFocus (which returns the hWnd). Have you checked on Spy++, etc., that the hWnd values are correct? I only did a basic check by printing out the hWnd values obtained through the 'hidden property' method and checking them against the values that your code produced, noting that they were different, but I would want to double check that when Iget home later tonight. I'll ask around, but if no one else pipes up here, perhaps other sites to check would be VBForums.com (in the OFfice Development area) or Reddit? Though the people I'm thinking of asking are the ones likely to be reading those forums anyway!

Thanks Dan, that hadn't occured to me! I'll see if that makes any difference in Excel 64-bit.
I now list both the value returned by GetFocus AND the control's [.getHwnd] in my listbox and I'll test it on my 3 PCs.
 
Upvote 0
Hi, I didn't get a chance to read the code last night, but I hope to at some point later today/this weekend.
I was thinking about it, though, and I still don't see why it couldn't work for usercontrols. In the InputBox example, the solution required the creation of an new Edit control (CreateWindowEx) -hNewEdit, and this is what was later used in UpdateTooltip procedure with SendMessage. So it should just be a matter of working out what's tripping up your code.
 
Upvote 0
So I put another listbox on your UserForm, and added the hWnd property for each of the frames and the listbox, as obtained through the [_GethWnd] method. The results were entirely different to yours, as per the screen capture below:

1636740487987.png


I'm not sure why this would happen though - especially seeing as the approach taken in the code works in 32 bit...
 
Upvote 0
Sorry, just realised that the hWnd's listed are for the actual tooltips and not the actual controls, no?
One thing I noticed is that you've assigned Application.hInstance to tooltip.hInstance for creation of the Tooltip window, but shouldn't you perhaps be using Application.hInstancePtr (epecially seeing as API requires longptr)?
 
Upvote 0
Sorry, just realised that the hWnd's listed are for the actual tooltips and not the actual controls, no?
One thing I noticed is that you've assigned Application.hInstance to tooltip.hInstance for creation of the Tooltip window, but shouldn't you perhaps be using Application.hInstancePtr (epecially seeing as API requires longptr)?
Yes I've done the same as you. To clarify, the Tooltip's hWnd is the value returned by BalloonTip's Create() function,
and is obviously different from the control's hidden hWnd:
hWnds.jpg

I'll test the Application.hInstance thing (Longptr), thanks for the tip
Richard
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,337
Members
452,636
Latest member
laura12345

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top