Re-using a VB5 program already in memory / cmd line parameter passing 
Author Message
 Re-using a VB5 program already in memory / cmd line parameter passing

I am writing a VB5 program that requires INMEDIATE response when I call it.
 The program requieres a propietary ActiveX control that I have placed in a
form.  The control have all the functionality I need, but unfortunatelly I
do not have the source code for it, so I have to use it as is.  The program
takes ethernal 1.5 seconds to load from disk to memory before it starts
doing the required job (I believe due to the size of the loading of the
form required to place the ActiveX control, even as hidden as I have set
it).

I need this VB5 to have an inmediate ( < 0.2 seconds response).  Once the
program is loaded, if I click a button that runs the ActiveX control it
will do the job instantaneously, but I need it to run inmediately without
any click and after that, to have it ready to process a different type of
job call.

If somehow I could find a way to call that VB5 program with a specific
parameter (argument) the first time, so I could load the program in memory
just once, and after that if I call it once again with a different
argument,  somehow make the VB5 program QUICKLY find out that it has a copy
of it already loaded in memory, so it will just have to do the job
requested by the new argument without reloading a new copy of itself...

So basically I have to solve two problems:

1. Leaving the VB5 program loaded in memory and re-using it without
creating another instance of it.
2. Passing a string parameter to a VB5 from the command line, like C's
main(int argc,  char **argv)...

Does anyone knows any sample VB5 code or tips on how to acomplish both
tasks?

Any help will be truly apppreciated.

Best regards,
  Hermann


/*-------------------------------------------------------------+

 |       http://www.*-*-*.com/ ;        |
 | Tel/Fax:(507)269-9256  Tel:(507)223-2103  Cel:(507)613-5987 |
 +-------------------------------------------------------------*/



Wed, 01 Nov 2000 03:00:00 GMT  
 Re-using a VB5 program already in memory / cmd line parameter passing

hi

from where is the program run ?

if it is run from another vb program, you could create your program as an
activeX server with on public class set to 5-Multiuse

inside that class you could have a procedure that accepts a string and then
creates an instance of your form (with your activeX component)

something like

public sub somethinghappend (strString as string)

    dim frmForm as MySpecialControlForm

    set frmForm = new MySpecialControlForm

    frmForm.MySpecialControl.SomePropertyOrMethod (=) strString

    frmForm.Show

end sub

This should be very quick




Thu, 02 Nov 2000 03:00:00 GMT  
 Re-using a VB5 program already in memory / cmd line parameter passing

Dear Fred, thanks for answering!

I am trying to run the program doing a:

        Shell "VB5PRG.EXE param1 param2 ..."

From another non-VB5 program (an Emulator called Reflection for UNIX/VMS
wich has very limited VBA programming capabilities, i.e. I cannot run DCOM
from inside Reflection).  This is the only way that I have found to
communicate the messages that are comming from the VMS host application to
command the client Win95 PC that runs the Shell "VB5PRG.EXE" to perform the
tasks provided by the ActiveX control inside of it.  These messages will
come one after another at different times from the VAX host to the
emulating Win95 PC that should run inmediately the ActiveX control each
time with a different type of message (this is why I was thinking of
command line param1 param2 ... passing).

I want to avoid the time consuming re-loading of the program, and somehow
just send the param1 param2 ... strings to a VB5PRG.EXE program already in
memory.

It can be said that the VB5PPRG.EXE will be an ActiveX server for the
parameters received.




Thu, 02 Nov 2000 03:00:00 GMT  
 Re-using a VB5 program already in memory / cmd line parameter passing

Here are some of my thoughts...

How about setting up a DDE conversation between the two apps?  I'm not
familiar with DDE, but it seems like a possibility.

You could also write a file from your client app to a shared directory, say
a file for each message, and poll this shared directory from your server
app using Dir(), or better yet, use FindFirstChangeNotification() API
(there's good code for this on VBNet -
http://home.sprynet.com/sprynet/rasanen/vbnet/default.htm
Using the API would be fairly instantaneous.  If your client supports it,
you could possibly use a shared database instead.

If your client supports API functionality, then you could use Named Pipes
(or anonymouse pipes in Win95 - I think) to communicate.  Dan Appleman
(Desaware) covers this in 'The VB Programmers Guide to the Win32 API'.

If you've got Desaware's Spyworks then you can possible send a message to
another process.  I've never tried this, but I think Spyworks has examples
of doing this.  I don't know how this would work on your client end though.

I would thing the shared directory approach the easiest.
FindFirstChangeNotification() would offer better results than Dir().  Dir()
may work OK but it incurrs a lot of disk activity, especially over
networks. I would think it fairly instantaneous depending on how you poll
the directory.  The quickest response would probably be through the Named
Pipes, or DDE approach.

Hope this helps



Quote:
> Dear Fred, thanks for answering!

> I am trying to run the program doing a:

>    Shell "VB5PRG.EXE param1 param2 ..."

> From another non-VB5 program (an Emulator called Reflection for UNIX/VMS
> wich has very limited VBA programming capabilities, i.e. I cannot run
DCOM
> from inside Reflection).  This is the only way that I have found to
> communicate the messages that are comming from the VMS host application
to
> command the client Win95 PC that runs the Shell "VB5PRG.EXE" to perform
the
> tasks provided by the ActiveX control inside of it.  These messages will
> come one after another at different times from the VAX host to the
> emulating Win95 PC that should run inmediately the ActiveX control each
> time with a different type of message (this is why I was thinking of
> command line param1 param2 ... passing).

> I want to avoid the time consuming re-loading of the program, and somehow
> just send the param1 param2 ... strings to a VB5PRG.EXE program already
in
> memory.

> It can be said that the VB5PPRG.EXE will be an ActiveX server for the
> parameters received.





Mon, 06 Nov 2000 03:00:00 GMT  
 Re-using a VB5 program already in memory / cmd line parameter passing

This is just a thought to consider.

I've read somewhere in optimization tips that to speed
up program execution, you can have a small application
pre-loaded that does nothing but references and loads
your program's references so that when you start your
program the ActiveX components are already loaded.

Good luck,

Tim Kessler
Fax Cards
"Printing America's Business Cards"
http://www.kih.net/faxcards



Mon, 06 Nov 2000 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Re-using a VB5 program already in memory / cmd line parameter passing

2. Passing a command line parameter to a QBASIC 4.5 program

3. Passing Command line parameters to a shelled program

4. Passing command line parameters to VB program (how???)

5. passing command-line parameters to vb5 exe ?

6. Starting automacros with parameters from cmd-line

7. pass cmd line parms to exe

8. VB5 OOPS Reuse-Passing Variables 2

9. executing vb programs using command line parameters

10. Passing a parameter to MS Word using VB5

11. Using CreateProcessA (with CREATE_FORCEDOS) to run PVCS cmd-line app

12. How do I transfer control and parameters to my ALREADY running program

 

 
Powered by phpBB® Forum Software