|
-
Mar 21st, 2020, 03:04 AM
#1
Fanatic Member
-
Mar 21st, 2020, 08:48 AM
#2
Re: LabelW caption text is truncated under WinXP
 Originally Posted by Mith
VBCCR v1.6.72 (Side-by-side)
VB6sp6 (win7x64 developing machine)
The caption text of some LabelW-Controls is truncated when using the app under WinXP (SP3).
Many other Label-Controls at my app are not truncated.
Nobody can test, when you just attach an exe file (which is NOT allowed) and no source code (Project1.vbp)
Please re-do.
 Originally Posted by Mith
Does anyone have a clue why you can use 32-bit icons with Win7 and Win10 but the app crashes using WinXP, Vista and Win8!
First i thought WinXP and Vista are too old but Win7 is older than Win8, i dont get it...
for example:
Windows XP supports 32-bit icons, which are 24-bit images with an 8-bit alpha channel.
is it vb6 that not support 32bit icons on some OS version?
or maybe you use a icon/image api that is not supported by some older OS?
The problem is here OleAut32.lib and it's various OleLoadPicture API's. So it's MS fault, as so often. And it also doesn't matter if creating the IPicture by an byte stream or by an Path.
What surprises me now is that Win8 also encounter the issue? (I can't test Win8)
Can you try to to make the following quick and dirty test and try to load a 32-bit icon via VB's LoadPicture ?
Code:
Set Pic = LoadPicture("YourPath\test.ico")
Your "run-time error 0" comes by following:
You load and persist successfully the 32-bit icon in a "good" OS.
The error comes then on an "bad" OS when you let VB creating the IPicture from the property bag. (design time usage in ImageList)
When you would do it only at run-time you would receive the "invalid picture" error.
I still don't know how to circumvent the issue, because since years the same question over and over re-appears.
Last edited by Krool; Mar 21st, 2020 at 09:08 AM.
-
Mar 21st, 2020, 09:49 AM
#3
Fanatic Member
Re: LabelW caption text is truncated under WinXP
VB example project for testing the LabelW caption text bug:
Label-Test-WinXP-sourcecode.zip
I've done a 32bit icon test with the following code under Win8.1 x64:
Code:
Dim pic As Variant
Set pic = LoadPicture(App.Path & "\32bit.ico")
Error message:
-
Mar 21st, 2020, 10:13 AM
#4
Re: LabelW caption text is truncated under WinXP
 Originally Posted by Mith
VB example project for testing the LabelW caption text bug:
Label-Test-WinXP-sourcecode.zip
I've done a 32bit icon test with the following code under Win8.1 x64:
Code:
Dim pic As Variant
Set pic = LoadPicture(App.Path & "\32bit.ico")
Error message:

For me the LabelW I see no bug. It's behaving the same as VB.Label.
Somehow your Win7 gives for the same font (Arial, Bold, 11pt) a width of 1500 twips and on your WinXP 1560. (Caption "Dateivergleich")
For me it returns both 1560 on Win7 and WinXP.
Anyhow, the safest approach is to make an "LabelW1.AutoSize = True" at run-time. (even if already True, re-applying with True will trigger a re-calculation)
Concerning your icon test. How to avoid this dilemma? Maybe a warning sign when defining 32-bit color depth for an image list at design time. Because that would explain some users up front of an potential "run time error 0". (?)
-
Mar 21st, 2020, 11:25 AM
#5
Fanatic Member
Re: LabelW caption text is truncated under WinXP
 Originally Posted by Krool
For me the LabelW I see no bug. It's behaving the same as VB.Label.
Somehow your Win7 gives for the same font (Arial, Bold, 11pt) a width of 1500 twips and on your WinXP 1560. (Caption "Dateivergleich")
For me it returns both 1560 on Win7 and WinXP.
Are you sure you tested the compiled exe (SxS) or just the test project inside the IDE?
I did another test with the compiled exe using a fresh installed WinXP 64bit and the caption text is here truncated too:

Concerning your icon test. How to avoid this dilemma? Maybe a warning sign when defining 32-bit color depth for an image list at design time. Because that would explain some users up front of an potential "run time error 0". (?)
I had a lot of command buttons with 32-bit icons at the picture property.
It was a pain in the ass to find all these controls with 32-bit icons...
i guess a warning would be very nice to avoid such problems in the future.
If someone develops a app that must also run with WinXP, Vista or Win8 he cannot use 32bit icons anywhere at the VBCCR controls.
Im not sure how & where to implement such a warning if the dev adds somewhere a 32bit icon....
-
Mar 21st, 2020, 11:48 AM
#6
Fanatic Member
Re: LabelW caption text is truncated under WinXP
Some news about the caption text bug:
1. the labels use the font "Segoe UI" and this font is not installed under WinXP!
2. i added some MS-Labels with the same text, font, font size and background color to the test project
1&3. row is VBCCR and 2&4. row is MS:

As you can see the autosize works correct with the MS-Labels.
Only the autosize of the background color is not correct.
Maybe the font fallback causes the problem with the incorrect autosizing?
New test project: Label-Test-WinXP-sourcecode.zip
Last edited by Mith; Mar 21st, 2020 at 11:52 AM.
Reason: added a new test project
-
Mar 21st, 2020, 11:49 AM
#7
Re: LabelW caption text is truncated under WinXP
 Originally Posted by Mith
Are you sure you tested the compiled exe (SxS) or just the test project inside the IDE?
I did another test with the compiled exe using a fresh installed WinXP 64bit and the caption text is here truncated too:
I don't test ever a compiled exe. Did you read my suggestion to put a LabelW.AutoSize = True at run-time, e.g. at Form_Load.
The VB.Label behaves the same, means no automatic autosizing.
The VB.Label and LabelW will for example also do autosizing when you change the .Caption property.
-
Mar 21st, 2020, 12:02 PM
#8
Fanatic Member
Re: LabelW caption text is truncated under WinXP
 Originally Posted by Krool
I don't test ever a compiled exe.
Why not? A compiled exe reacts different than a vb project inside the IDE!
Did you read my suggestion to put a LabelW.AutoSize = True at run-time, e.g. at Form_Load.
Yes, but is impractical for large projects...
The VB.Label behaves the same, means no automatic autosizing.
At my test with compiled exe the VB-Label does a correct autosizing of the the caption and the LabelW-control not!
The VB-Label shows the complete text and the LabelW-Control truncates the text at the end...
Look at the last screenshot again...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|