Help: Launching aplications without Shell 
Author Message
 Help: Launching aplications without Shell

Hi,

In Windows 95, when you double click a filename the associated
application is launched and the document is loaded and displayed.

The same if you use the RUN menu option and select a document (*.doc,
*.xls, *.html, etc...).

For some applications (Word, Excel, Netscape...), if you use either of
the methods to open a document, and the associated application is
already running then the new document is loaded, but not onother copy
of the application, ONLY one copy of the application runs! This is
fine!

I'm trying to launch documents (programmatically), and I need the same
behaviour. I experimented with SHELL, but for every document (of the
same type) a copy of the associated program is launched!

I also tried the WinExec API and the result is the same, I end up with
multiple copies of the programs.

This is where YOU come in...

Does anyone know how one can launch multiple documents (but not at the
same time), without causing more than one copy of the associated
application to run?

And what aplication runs when you select the Win95 RUN menu option?

Any input welcomed!

Thank's,

Emanuel



Fri, 23 Feb 2001 03:00:00 GMT  
 Help: Launching aplications without Shell
Hello Emauel

Essentially it works the same way as Excel, that is, if Excel is
invoked directly from the run box you will get multiple copies of
Excel in memory.
If you invoke Excel by double-clicking on a .xls file in explorer
you will get a single copy in ram reinvoked (or loaded if it's the
first one).  The mechanism to use is the same as Excels, DDE.

The VB program is considered to be the 'Source', the Explorer
association is considered to be the 'Destination'.

How to:
1)  For the file extension you want to use .xxx go into explorer,
view, options, filetypes and create an association for the filetype.
The action you want is 'Open'.

Enter the path to your launcher.
Click on the DDE checkbox
for DDE Message enter open("%1")  ' this %1 can be changed as needed,
as it is set it will pass the .jpf file name.
for Application enter the name of your VB project (exe) I.e.
'Launcher'
for Topic enter what you want.  You will have to match this name
to a link field on your VB form later.

2) Visual Basic
a)
On your form properties set:
LinkMode to 1 source
linkTopic to the same Topic name you entered above.
b)
establish events to handle invocations.
the events for the form are:
LinkClose, LinkOpen, LinkExecute.  The only one of interest
at the moment is LinkOpen. Here you can use the Command$
to parse the command line, once for each invocation.

And that's it!!

Best wishes, Murray



Fri, 23 Feb 2001 03:00:00 GMT  
 Help: Launching aplications without Shell
Try this it worked for me opening five Excel Workbooks at the same time with
only one Excel in memory.    Good luck and don't forget to set the objects to
nothing IE set  xlApp = Nothing

        'Create an instance of the Excel Application
        'And Open two workbooks ImpFile.xls and Tester.xls
        Set xlApp = CreateObject("excel.application")
        Set ImpFile = xlApp.Workbooks.Open(filename:="C:\QBTimeQ\ImpFile.xls")
        Set tstr = xlApp.Workbooks.Open(filename:="C:\QBTimeQ\Tester.xls")



Sat, 24 Feb 2001 03:00:00 GMT  
 Help: Launching aplications without Shell

Quote:

>Hello Emauel

>Essentially it works the same way as Excel, that is, if Excel is
>invoked directly from the run box you will get multiple copies of
>Excel in memory.
>If you invoke Excel by double-clicking on a .xls file in explorer
>you will get a single copy in ram reinvoked (or loaded if it's the
>first one).  The mechanism to use is the same as Excels, DDE.

>The VB program is considered to be the 'Source', the Explorer
>association is considered to be the 'Destination'.

>...
>Best wishes, Murray

Thanks Murray,

I suspected it could be acomplished with DDE, but I still find DDE a
bit complicated.

Anyway, I managed to implement the code to call the applications
through DDE, but I found that when the server application is
terminated (Excel, etc), it does not send a DDE close message. From
the server side I could not find a practical way to detect if the
application was closed.

I also looked for Windows API's, and found that by calling the
ShellExecute API call I could do what I needed in the first place!

But I find it strange that a client application involved in a DDE
session should close without notifying the server!!!

I'm probably doing something wrong, can you help?

Best wishes,
Emanuel



Fri, 02 Mar 2001 03:00:00 GMT  
 Help: Launching aplications without Shell
Have you looked at the TExcel DDE components available on the Delphi
Super Page?
They have some good examples on using DDE with Excel (and the components
are great)
I only remember the first names of the two authors - Tibot & Erik
Quote:


> >Hello Emauel

> >Essentially it works the same way as Excel, that is, if Excel is
> >invoked directly from the run box you will get multiple copies of
> >Excel in memory.
> >If you invoke Excel by double-clicking on a .xls file in explorer
> >you will get a single copy in ram reinvoked (or loaded if it's the
> >first one).  The mechanism to use is the same as Excels, DDE.

> >The VB program is considered to be the 'Source', the Explorer
> >association is considered to be the 'Destination'.

> >...

> >Best wishes, Murray

> Thanks Murray,

> I suspected it could be acomplished with DDE, but I still find DDE a
> bit complicated.

> Anyway, I managed to implement the code to call the applications
> through DDE, but I found that when the server application is
> terminated (Excel, etc), it does not send a DDE close message. From
> the server side I could not find a practical way to detect if the
> application was closed.

> I also looked for Windows API's, and found that by calling the
> ShellExecute API call I could do what I needed in the first place!

> But I find it strange that a client application involved in a DDE
> session should close without notifying the server!!!

> I'm probably doing something wrong, can you help?

> Best wishes,
> Emanuel



Mon, 12 Mar 2001 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. testing vb5.0 aplications or other windows based aplications

2. HELP: Extraction OLE Image without launching server???

3. How Do I launch cc:Mail with shell()?

4. Wait for shelled application to launch???

5. Launch, then close a SHELL'd app?

6. launching a program using its registry entry NOT Shell()

7. Problem launching app from VB w/SHELL

8. Shell launched application? Wata

9. Getting handle to window launched with Shell

10. launching Win95 shell from VB app

11. shell program launch with file?

12. VB3 shell() launches another copy same program...

 

 
Powered by phpBB® Forum Software