CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 1999
    Posts
    29

    open a file in other application

    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
    [email protected]




  2. #2
    Join Date
    May 1999
    Location
    Oxford UK
    Posts
    1,459

    Re: open a file in other application

    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



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured