
Call-backs - AAARGGHHH! HELP please please please!
Thanks for the tips Ray,
For your information, this is what we're doing.
We are converting a mainframe application to a client/server multi-tier
system. This new system is Unix, Microfocus COBOL on the back end, with an
Oracle 8 database. There are some C programs that serve as driver programs
interacting between the host and the front end and the front end is the
system we're talking about, written in VB.
The 1103 DLLs I'm referring to are ActiveX VB DLLs and are automatically
generated by a program I wrote. What we do is extract the information from
the mainframe screen definitions and stick it in an Access database. This
includes the X & Y location, field names, attributes and a few others. The
generator grabs all this information and creates VB code - a CLS, FRM, BAS
and VBP file, as well as copying a default FRX file for icons. All of this
information is dynamically generated. I love it when you do something like
this - Write a VB generator in VB.
The main EXE doesn't have any inbuilt references to these DLLs in it. It
defines an object as type Object and then uses
CreateObject(Screenname.screennameclass) to get the thing and populate the
data.
This is much faster than making the screens individually (it takes about 30
minutes to create all 1103 screens including default attributes, positioning
and class functions). Then we have a batch file that builds all 1103 DLLs
from their VBP files and registers them.
This is all going to run on a Hydra server, so the individual clients
shouldn't need the DLLs registered on their own Workstations, since they
will be running the application on Hydra.
I didn't think I wanted to use the WithEvents option, but that's probably a
sign that I misunderstood the documentation that came with VB. Is there a
good book on all this stuff?
Cheers
Andrew
Quote:
> Andrew,
> > Can someone help me PLEASE! I AM GOING INSANE trying to work out how to
do
> > this
> > I am at my wit's end trying to work out how to implement call-backs and
> the
> > sample programs supplied with VB and associated documentation are only
> > confusing the issue.
> Forgive me if I'm off here, but nobody has responded so I will take a
shot.
> It sounds like you are using VB-created activeX dlls???
> If so, then you want to use the term "Events" rather than "Callbacks",
> otherwise you will see a lot of confused looks.
> You really have 1103(!) dlls??? And all of these are referenced from the
> main exe project? I can't imagine a scenario where you would need that
many
> dlls. Just for curiosity's sake - *what* are you doing? ;-)
> A couple of things it sounds like you might not be clear on are as
follows:
> 1. To raise events back to a container (exe) you Dim the object using the
> "WithEvents" keyword.
> e.g.,
> [in form's General Declarations section]
> Private WithEvents oObj as IMyInterface
> As soon as you do this you will see the oOBj object appear in the form's
> left property drop-down listbox and any events which are specified in the
> Interface will appear in the right. You can directly handle raised events
> in the form's code.
> [later]
> Set oObj = whatever
> 2.Interfaces generally do not contain code, they are normally just "empty
> classes" the code must be implemented in the class which Implements the
> interface and/or the container.
> Again, if I'm off please forgive me , but maybe this will help you at
least
> rephrase your question. Also, if you are *not* using activeX dlls, but
> really need to catch callback messages, you might want to take a look at
the
> Callback Routing tutorial on my website. The final sample shows how to
> Implement an interface to route messages (although not for quite so many
> dlls ;-))
> Hope this helps,
> --
> Ray Mercer
> MS-MVP Visual Basic
> www.shrinkwrapvb.com