Link to home
Start Free TrialLog in
Avatar of Brook Braswell
Brook BraswellFlag for United States of America

asked on

vb6 app and IDE locks up on Vista and 7 when font changes

I have several applications that run just fine.
One in particular show my clients a schedule and allows them to change the fonts.
I give them several to choose from ( rather than choosing from their standards )
When I set the objects on the form to Comic Sans MS 10 it locks up even in the IDE.
This occurs at no specific point.  I even put a break at the form activate and it does stop there but the IDE is locked up and I can not even F8 to the next line of code.

This is not a problem for any other size of that font ranging from 7 to 14.
I have not tried other fonts to see if they could lock up also as of yet.
( yes in the lines of it hurts when I do that - just don't do that - I do not want to remove the ability to change the font to this.  I want to understand what would cause the IDE and the EXE to lock up because of a font change )
Avatar of x77
x77
Flag of Spain image

Some time ago, I can see an error like this on a code sample.

The code sample has a User Control with bad code initialization.
Then Ide Hangs (also at design time when I change some properties).

Note that on Vb6, a font name mistake result on a Vb6 error.
Gdi Font API do´nt cause error as it replaces the FontFamily with other.
Avatar of Brook Braswell

ASKER

the font name is fine but the size is causing an error
I am merely setting an objects
font.name = "Comic Sans MS"
font.Size = 10

Locks up when running
ASKER CERTIFIED SOLUTION
Avatar of HooKooDooKu
HooKooDooKu

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I tried your suggestion HooKooDooKu and so far it still locks up.  
There are only 4 objects I am changing and 3 of them are Grids ( Janus Grid )
it seems to lock up there.  Hoping this is not a problem with my control.

I will let you know more tomorrow.

Thanks,
ok !  This morning I replaced all I had to do with fonts and use the StdFont instead.
Now when setting my Grids I use
dim SFnt as new StdFont
SFnt.Name = "Comic Sans MS"
SFnt.Bold = True
SFnt.Size = 10 ' really sets the font to 9.75.  I have tried using both 9.75 and 10 and get same result.
dgMyGrid.Font = SFnt

all of this is done in the FormLoad event
I put a break at the end of the FormLoad and at the beginning of the FormActivate
By stepping through - it locks up the IDE at the Form_Activate
I must end Task VB6 to start over

I will try putting this code in the activate rather than the load to see if that makes a difference
Avatar of HooKooDooKu
HooKooDooKu

Is the problem ONLY with "Comic Sans MS" at a 10pt (9.75pt) size?  Do larger sizes or smaller sizes work?

From what you have described so far, my first though is that something is wrong inside the grid control... that basically if you set the font "wrong" that the control is what is really blowing up.  So assuming the control isn't just simply randomly blowing up, I would think it would be a predictable pattern... say a font that was too big in some way.  If I was correct, then something like 6pt Comic Sans MS would work, while 12pt Comic Sans MS would fail just as easily as your 10pt (9.75pt) does.

BTW, the way Windows works is that it takes all the properties you've entered for a font (name, size, bold, and a host of others) and uses some complex scoring scheme.  It then finds what actual installed font is the best match.  That would be a possible reason for your 10pt font to keep coming back as 9.75.  If this Comic Sans MS font isn't a true-type font and only has limited number of fixed sizes within it, that would be the reason your REQUEST for a 10pt font resulted in a 9.75pt font.
It only seems to "break" on Comic Sans MS size 10 (9.75).
I can go up to 12 or down to 8 or up to 14 and down to 6 and it would work fine.

I change the line above from
dgMyGrid.Font = SFnt
to
Set dgMyGrid.Font = SFnt
and at this time it is not breaking on my Vista box !!

Going to Test on Windows 7 and Window 2008 r2
It now works fine with Vista, 7 and 2008 R2.
Funny how it was only when Comic Sans.
Did some research and found that Comic Bob ( origination of the font )
has caused many problems with other systems and applications.
Regardless - Set obj.Font = F is the Key