Solid Edge Framework Type Library
GetOpenFileName Method
Solid Edge Framework Type Library > Application Object : GetOpenFileName Method
This option is not supported in this release.
This option is not supported in this release.
Member of the DocumentAccess constant set that specifies the read-write access by which the specified document should be opened.
Member of the NotifyOption constant set that specifies the notification requested by the user on the selected document.
Specifies a variable to receive the document relations automation object, which can be used to enumerate specified linked documents.
Specifies the file filters or translators available to the application. The filter string consists of pairs of file filter strings followed by the MS-DOS wildcard file filter specification, with each part and each pair separated by commas. For example, the following string specifies a text file filter: "Text Files (*.txt),*.txt". To use multiple MS-DOS wildcard expressions for a single file filter type, separate the wildcard expressions with semicolons. For example: "Solid Edge Files (*.asm; *.prt),*.asm;*.prt". If omitted, this argument defaults to "All Files (*.*),*.*".
Specifies the index number in the FileFilter array indicating the default filter to be used. If this argument is omitted or negative or greater than the number of filters present, the first file filter is used.
Specifies the dialog title. If this argument is omitted, the dialog title is "Open".
If the argument is True, the user is not prompted with warning dialog boxes regarding the file availability, and default action is taken. If the argument is False, the warning dialogs are presented to the user. If the argument is omitted, the warning dialogs are presented to the user.
Description
Displays the File Open dialog box.
Syntax
Visual Basic
Public Function GetOpenFileName( _
   ByRef LinksUpdate As LinksUpdateOption, _
   ByRef AltLinkPath As String, _
   ByRef DocAccess As DocumentAccess, _
   ByRef OptNotify As NotifyOption, _
   ByRef DocRelationAutoServer As Object, _
   Optional ByVal FileFilter As Variant, _
   Optional ByVal FilterIndex As Variant, _
   Optional ByVal Title As Variant, _
   Optional ByVal IgnoreWarnings As Variant _
) As Variant
Parameters
LinksUpdate
ValueDescription
igLinksUpdateWithAltPathUpdate links with alternate path
igLinksUpdateWithDefpathUpdate links with default path
igNoLinksUpdateDo not update links
This option is not supported in this release.
AltLinkPath
This option is not supported in this release.
DocAccess
ValueDescription
igReadExclusiveDocument has exclusive read access
igReadOnlyDocument has read-only access
igReadWriteDocument has read-write access
Member of the DocumentAccess constant set that specifies the read-write access by which the specified document should be opened.
OptNotify
ValueDescription
igNoNotifyDo not notify
igNotifyWhenAvailableNotify when the document is available
igNotifyWhenExclusiveNotify when the document is exclusive
igNotifyWhenReadableNotify when the document can be read
igNotifyWhenWriteableNotify when the document can be written
Member of the NotifyOption constant set that specifies the notification requested by the user on the selected document.
DocRelationAutoServer
Specifies a variable to receive the document relations automation object, which can be used to enumerate specified linked documents.
FileFilter
Specifies the file filters or translators available to the application. The filter string consists of pairs of file filter strings followed by the MS-DOS wildcard file filter specification, with each part and each pair separated by commas. For example, the following string specifies a text file filter: "Text Files (*.txt),*.txt". To use multiple MS-DOS wildcard expressions for a single file filter type, separate the wildcard expressions with semicolons. For example: "Solid Edge Files (*.asm; *.prt),*.asm;*.prt". If omitted, this argument defaults to "All Files (*.*),*.*".
FilterIndex
Specifies the index number in the FileFilter array indicating the default filter to be used. If this argument is omitted or negative or greater than the number of filters present, the first file filter is used.
Title
Specifies the dialog title. If this argument is omitted, the dialog title is "Open".
IgnoreWarnings
If the argument is True, the user is not prompted with warning dialog boxes regarding the file availability, and default action is taken. If the argument is False, the warning dialogs are presented to the user. If the argument is omitted, the warning dialogs are presented to the user.
Remarks
This method displays the File Open dialog box. This is the same dialog box that is displayed when the user selects Open from the File menu. This dialog box allows a user to browse files in the file system and to select a file to open. This method returns the file name without actually opening it. The selected filter is not returned, but it can be determined from the file type of the returned file. Displays a preview of a selected document and its state. When available, a thumbnail preview of the currently selected document is provided. An icon that describes the state of the document is also displayed. Provides a way to specify a directory path to override the location of document links. Provides access to the Compound page in which the user can select which linked documents should be activated.
Example
Option Infer On

Imports System
Imports System.Runtime.InteropServices

Namespace Examples
    Friend Class Program
        <STAThread>
        Shared Sub Main(ByVal args() As String)
            Dim application As SolidEdgeFramework.Application = Nothing

            Try
                ' See "Handling 'Application is Busy' and 'Call was Rejected By Callee' errors" topic.
                OleMessageFilter.Register()

                ' Attempt to connect to a running instance of Solid Edge.
                application = DirectCast(Marshal.GetActiveObject("SolidEdge.Application"), SolidEdgeFramework.Application)

                Dim linksUpdateOptions = SolidEdgeFramework.LinksUpdateOption.igNoLinksUpdate
                Dim strAltLinkPath = String.Empty
                Dim documentAccess = SolidEdgeFramework.DocumentAccess.igReadOnly
                Dim notifyOption = SolidEdgeFramework.NotifyOption.igNoNotify

                Dim strFilter = "Solid Edge Files (*.asm; *.par; *.dft; *.psm; *.pwd), *.asm; *.par; *.dft; *.psm; *.pwd"
                strFilter &= ", Assembly Files (*.asm), *.asm"
                strFilter &= ", Part Files (*.par), *.par"
                strFilter &= ", Draft Files (*.dft), *.dft"
                strFilter &= ", Sheet Metal Files (*.psm), *.psm"
                strFilter &= ", Weldement Files (*.pwd), *.pwd"

                Dim docRelationAutoServer As Object = Nothing

                Dim strFilePath = application.GetOpenFileName(linksUpdateOptions, strAltLinkPath, documentAccess, notifyOption, docRelationAutoServer, strFilter)
                Console.WriteLine(strFilePath)
            Catch ex As System.Exception
                Console.WriteLine(ex)
            Finally
                OleMessageFilter.Unregister()
            End Try
        End Sub
    End Class
End Namespace
using System;
using System.Runtime.InteropServices;

namespace Examples
{
    class Program
    {
        [STAThread]
        static void Main(string[] args)
        {
            SolidEdgeFramework.Application application = null;

            try
            {
                // See "Handling 'Application is Busy' and 'Call was Rejected By Callee' errors" topic.
                OleMessageFilter.Register();

                // Attempt to connect to a running instance of Solid Edge.
                application = (SolidEdgeFramework.Application)Marshal.GetActiveObject("SolidEdge.Application");

                var linksUpdateOptions = SolidEdgeFramework.LinksUpdateOption.igNoLinksUpdate;
                var strAltLinkPath = String.Empty;
                var documentAccess = SolidEdgeFramework.DocumentAccess.igReadOnly;
                var notifyOption = SolidEdgeFramework.NotifyOption.igNoNotify;

                var strFilter = "Solid Edge Files (*.asm; *.par; *.dft; *.psm; *.pwd), *.asm; *.par; *.dft; *.psm; *.pwd";
                strFilter += ", Assembly Files (*.asm), *.asm";
                strFilter += ", Part Files (*.par), *.par";
                strFilter += ", Draft Files (*.dft), *.dft";
                strFilter += ", Sheet Metal Files (*.psm), *.psm";
                strFilter += ", Weldement Files (*.pwd), *.pwd";

                object docRelationAutoServer = null;

                var strFilePath = application.GetOpenFileName(out linksUpdateOptions, out strAltLinkPath, out documentAccess, out notifyOption, out docRelationAutoServer, strFilter);
                Console.WriteLine(strFilePath);
            }
            catch (System.Exception ex)
            {
                Console.WriteLine(ex);
            }
            finally
            {
                OleMessageFilter.Unregister();
            }
        }
    }
}
See Also

Application Object  | Application Members