Click to See Complete Forum and Search --> : open a file in other application


Federica Pavese
April 5th, 1999, 10:27 AM
Hi !
I want to open the Microsoft Image Composer (with Shell function). And when the Img.Comp. is opened, I want to view an image that I send like parameter from VB code.
Can you help me with this?

Thanks in advance!

Federica Pavese
fedepavese@bolsamza.com.ar

Chris Eastwood
April 6th, 1999, 02:48 AM
Hi

I can think of three ways of doing this (there's probably more), but :

1. Does the Image Composer program accept command line arguments ?

That way you could do a 'shellexecute' api call with the image filename straight after it.

eg.

Public Declare Function ShellExecute Lib "shell32.dll" _
Alias "ShellExecuteA" (ByVal hwnd As Long, _
ByVal lpOperation As String, ByVal lpFile As String, _
ByVal lpParameters As String, ByVal lpDirectory As String, _
ByVal nShowCmd As Long) As Long

Public Function SimpleShell(sFile As String, Optional sCmdLine As String = "", Optional nShowCmd As Long = 1) As Long
SimpleShell = ShellExecute(0, "open", sFile, sCmdLine, "", nShowCmd)
End Function

Then call SimpleShell with the ImageComposer EXE file/pathname, and the sCmdLine parameter
would contain the path to your image.


2. Using DDE

I doubt it very much (as Microsoft don't use it anymore), but the Image Composer program
might use a DDE interface - you'd need to check the help file


3. Using ActiveX/Object Model

The Image Composer program might expose an Object Model which would allow you to create
instances of it (much like Word and Excel) - you'd need to check the help file.


Good Luck

Chris Eastwood

CodeGuru - the website for developers
http://www.codeguru.com/vb