This document is archived and information here might be outdated. Recommended version. |
Open the map document in preparation for the contents to be retrieve or updated.
[Visual Basic .NET] Public Sub Open ( _ ByVal sDocument As String, _ [ByVal bsPassword As String] _ )
[C#] public void Open ( string sDocument, string bsPassword );
[C++]
HRESULT Open(
BSTR sDocument,
BSTR bsPassword
);
[C++]
Parameters sDocument [in]
sDocument is a parameter of type BSTR bsPassword [in, optional, defaultvalue()]
bsPassword is a parameter of type BSTR
Opens the specified MapDocument in preparation for reading it. The MapDocument can be an an ArcMap document (*.mxd), ArcMap template (*.mxt), Published Map File (*.pmf) or Layer File (*.lyr). The MapDocument will be cached so no other users will be able to access the MapDocument until it has been closed.
Before using the Open methods check whether the specified document IsPresent, IsRestricted, IsMapDocument and IsPasswordProtected. If the MapDocument is password protected, specify the password in the Open method.
If a Layer File (*.lyr) is opened a portriat PageLayout containing one Map with the layer added to it is created.
When opening or creating a map document with the IMapDocument Open() or New() methods, you should always make subsequent calls to IActiveView::Activate() in order to properly initialize the display of the PageLayout and Map objects. Call Activate() once for the PageLayout and once for each Map you will be working with. If your application has a user interface, you should call Activate() with the hWnd of the application's client area. If your application runs in the background and has no windows, you can always get a valid hWnd from the GDI GetDesktopWindow() function, part of the Win32 API.