Re: various objects in my VB6 project - Calling IUnknown
From: Ken Halter (Ken_Halter_at_Use_Sparingly_Hotmail.com)
Date: 06/30/04
- Next message: George G.: "Cannot initialize data bindings - NOT "futiure posted""
- Previous message: Kjell: "VB appl vs Service on W2K server"
- In reply to: Mark G. Meyers: "Re: various objects in my VB6 project - Calling IUnknown"
- Next in thread: Mark G. Meyers: "Re: various objects in my VB6 project - Calling IUnknown"
- Reply: Mark G. Meyers: "Re: various objects in my VB6 project - Calling IUnknown"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 30 Jun 2004 12:48:37 -0700
Mark G. Meyers wrote:
>
> Hello. Regarding the above, didn't know about the IDE setting (thanks!) -
> I'm just an amateur, but, really, is this setting not turned on because of
> legacy support? Old EXEs don't break, right? And on that matter, what made
> XP or .NET or whatever something that could break old things in the IDE, and
That's what we've been asking (and ranting about) since .Net's release
<g> and there's at least one "groupie" around here that says "XPs not
done until VB won't run".
Language Stability
http://www.mvps.org/vb/index2.html?tips/stability.htm
Visual Fred
http://www.mvps.org/vb/index2.html?rants/vfred.htm
> not this? Really, it's not like we're talking about a massive migration hit
> for this example. Amidst it's sheer simplicity, I don't think this scales
> well against developments in structured programming practices over the
> years.
Developers expected to be able to load just about any code that can be
considered "MS Basic" and run it largely unchanged.. which is why the
End statement (and others like it) were preserved even though it's never
recommended that you use End.
There should be an option to add Option Explicit to existing modules
automatically but it doesn't look like it was a priority. I assume, this
was mostly because VB programs were considered "throw away" by quite a
few people in high places.
> Frankly, I never coded a module without Option Explicit, but, I've had at
> least one programmer do it because of forgetting or not really understanding
You'll find quite a few sample projects on the web that don't have
Option Explicit. I ran into so many that, instead of adding it and
fixing the missing declarations, I just toss the sample in the bit bucket.
> the need. I've seen another make the mistake of modifying the caller's
> primitive (default ByRef). It kind of freaked him out. Frankly, I would
> have guessed the basic types to default to ByVal, but I don't really care
> much about it. I just as a matter of habit don't modify the caller's vars,
> except with object refs, as they are coded to protect themselves. My only
When I started with VB, I got into the habit of creating a local copy of
arguments myself.. even if ByVal is in place. A few wasted clock cycles
vs knowing for sure I'm not messing up the callers variables. Knowing
for sure wins <g> I still do it in most cases but not always.
> exceptions are quite rare, and well documented as to their
> passing-pointers-like behavior where they happen.
Same here. Pass an X/Y/Z or whatever and have them 'ready for use' when
the sub returns. VB6 has "other" ways though so I don't do that as much
either. In general, now-a-days, I'll pass an array or class to be
manipulated.
>
> Right! Unresolved problems within - that's the crux of it.
About 95% of the time, I'll add a few Debug.Prints to each form or
classes Initialize/Terminate event handlers and if they don't show when
I expect them to, I go hunting for the cause. Most of the time it's not
too hard to find.
If there are circular refs (I use them very rarely), I'll add a
"ReleaseRefs" (or similar) method that releases all circulars. After
that, setting the object = Nothing should show a Debug.Print in the
terminate event handler.
fwiw, VB won't allow circular refs between projects in a group but
doesn't check for circulars between compiled components... and VB6 is
harder to shutdown cleanly than VB5 was (and VB5's harder than VB3). The
newer the version, the more cleanup you need <g>
Leaving things like timers running (etc) in VB6 will send you to the
task managers 'End Task' button more often than it would've in VB5 (if
the timer event's currently running that is)
Keep popping in for answers. Most of the regulars (there are quite a
few) aren't hard to find.
> -Mark
-- Ken Halter - MS-MVP-VB - http://www.vbsight.com Please keep all discussions in the groups..
- Next message: George G.: "Cannot initialize data bindings - NOT "futiure posted""
- Previous message: Kjell: "VB appl vs Service on W2K server"
- In reply to: Mark G. Meyers: "Re: various objects in my VB6 project - Calling IUnknown"
- Next in thread: Mark G. Meyers: "Re: various objects in my VB6 project - Calling IUnknown"
- Reply: Mark G. Meyers: "Re: various objects in my VB6 project - Calling IUnknown"
- Messages sorted by: [ date ] [ thread ]