Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Windows 'Open With....' application/process  (Read 2955 times)

0 Members and 1 Guest are viewing this topic.

vidal

    Topic Starter


    Rookie

    Windows 'Open With....' application/process
    « on: May 18, 2009, 05:39:59 AM »
    I want to open the above application/process using a shell function within MS Access.  Can anyone help what type of application file name it is? Is it an .exe file or a .dll or something else.

    I'd be grateful for any help on this

    Spoiler



      Specialist

      Thanked: 50
    • Experience: Beginner
    • OS: Windows XP
    Re: Windows 'Open With....' application/process
    « Reply #1 on: May 18, 2009, 06:29:11 AM »
    I am not sure what you are trying to do. Can you give us some more information? Do you want to add access to the open with list?

    Whenever I watch TV and I see those poor starving kids all over the world, I can't help but cry. I mean I would love to be skinny like that, but not with all those flies and death and stuff." - Mariah Carey, Pop Singer

    vidal

      Topic Starter


      Rookie

      Re: Windows 'Open With....' application/process
      « Reply #2 on: May 18, 2009, 06:51:54 AM »
      No I'm not trying to add Access to the Open With.... list.  I want to be able to open the 'Open With...' function from whilst the MS Access.  I have managed to get Access to open a file contained within the database and it opens with the associated program eg. Word doc automatically opens with MS Word.

      However sometimes it is necessary to open the file with an alternative application if it can't recognise the default setting.  So I want to be able to call the Open With... facility to do that.

      Hope this is clearer?


      patio

      • Moderator


      • Genius
      • Maud' Dib
      • Thanked: 1769
        • Yes
      • Experience: Beginner
      • OS: Windows 7
      Re: Windows 'Open With....' application/process
      « Reply #3 on: May 18, 2009, 07:22:33 AM »
      Unfortunately these settings are Global....you cannot change it for a specific file.
      " Anyone who goes to a psychiatrist should have his head examined. "

      vidal

        Topic Starter


        Rookie

        Re: Windows 'Open With....' application/process
        « Reply #4 on: May 18, 2009, 08:15:37 AM »
        Ok thx for your help

        patio

        • Moderator


        • Genius
        • Maud' Dib
        • Thanked: 1769
          • Yes
        • Experience: Beginner
        • OS: Windows 7
        Re: Windows 'Open With....' application/process
        « Reply #5 on: May 18, 2009, 08:23:17 AM »
        No Problem...
        Stop by anytime and Welcome Aboard ! !
        " Anyone who goes to a psychiatrist should have his head examined. "

        BC_Programmer


          Mastermind
        • Typing is no substitute for thinking.
        • Thanked: 1140
          • Yes
          • Yes
          • BC-Programming.com
        • Certifications: List
        • Computer: Specs
        • Experience: Beginner
        • OS: Windows 11
        Re: Windows 'Open With....' application/process
        « Reply #6 on: May 18, 2009, 01:51:33 PM »
        IF your trying to display open with, you can probably insert this procedure into your Access VBA code:





        Code: [Select]

        Private Type SHELLEXECUTEINFOA
        cbSize As Long
        fMask As Long
        hwnd As Long
        lpVerb As String
        lpFile As String
        lpParameters As String
        lpDirectory As String
        nShow As Long
        hInstApp As Long
        ' fields
        lpIDList As Long
        lpClass As String
        hkeyClass As Long
        dwHotKey As Long
        hIcon As Long
        hProcess As Long
        End Type

        Private Declare Function GetCurrentProcess Lib "kernel32.dll" () As Long


        Private Declare Function ShellExecuteEx Lib "shell32.dll" (ByRef lpExecInfo As SHELLEXECUTEINFOA) As Long



        Public Function OpenWith(ByVal FilePath As String, optional ByVal HwndOwner As Long=0,Optional ByVal Icon As Long = 0) As Long

            Dim sei As SHELLEXECUTEINFOA
            Dim verba As String
            verba = "openas"
            sei.hIcon = Icon
            sei.hProcess = GetCurrentProcess()
            sei.hInstApp = App.hInstance
           
            sei.lpVerb = verba
            sei.lpFile = FilePath
            sei.nShow = vbNormalFocus
            sei.cbSize = Len(sei)
           
            OpenWith = ShellExecuteEx(sei)


            'Stop

        End Function

        to call the function, pass in the filename, and optionally a hwnd (from a access form, for example) as well as an icon, if desired. the default icon is usually sufficient.

        Additionally, I'm not sure if the "App" object in VB6 is available or the same as it would be in an Access application; I'm certain there is an alternative, however.
        I was trying to dereference Null Pointers before it was cool.

        vidal

          Topic Starter


          Rookie

          Re: Windows 'Open With....' application/process
          « Reply #7 on: May 21, 2009, 07:30:03 AM »
          To BC_Programmer.

          Thank you very much indeed. It did the trick - top man

          BC_Programmer


            Mastermind
          • Typing is no substitute for thinking.
          • Thanked: 1140
            • Yes
            • Yes
            • BC-Programming.com
          • Certifications: List
          • Computer: Specs
          • Experience: Beginner
          • OS: Windows 11
          Re: Windows 'Open With....' application/process
          « Reply #8 on: May 21, 2009, 09:46:44 AM »
          Excellent! glad to be of help! I believe, because this was in the "Windows" rather then programming section, other members concluded that you wanted to change the association for a specific file, when in fact you wanted to display the dialog in your program. Thankfully, I have eagle-eyes for programming problems  ;D

          I was trying to dereference Null Pointers before it was cool.