<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic LoadMxFile not loading in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/loadmxfile-not-loading/m-p/239379#M6186</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have a method wrapping the Map Control's LoadMxFile method. It returns OK but no map loads. Any ideas why this might happen? I'm working in C++/MFC:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;BSTR CBGMapCtrl::LoadMxFile(LPCTSTR lpszPath, LPCTSTR lpszName, LPCTSTR lpszPassword)
{
 CString strResult;

 if( m_pMapControl )
 {
&amp;nbsp; COleVariant varName(vtMissing), varPassword(vtMissing);

&amp;nbsp; if( lpszName &amp;amp;&amp;amp; *lpszName )
&amp;nbsp;&amp;nbsp; varName = COleVariant( lpszName );
&amp;nbsp; if( lpszPassword &amp;amp;&amp;amp; *lpszPassword )
&amp;nbsp;&amp;nbsp; varPassword = COleVariant( lpszPassword );

&amp;nbsp; CComBSTR strPath( lpszPath );
&amp;nbsp; VARIANT_BOOL bOk = FALSE;
&amp;nbsp; if( SUCCEEDED(m_pMapControl-&amp;gt;CheckMxFile(strPath, &amp;amp;bOk)) &amp;amp;&amp;amp; bOk )
&amp;nbsp; {
&amp;nbsp;&amp;nbsp; HRESULT hr = m_pMapControl-&amp;gt;LoadMxFile( CComBSTR(lpszPath), varName, varPassword );
&amp;nbsp;&amp;nbsp; if( SUCCEEDED(hr) )
&amp;nbsp;&amp;nbsp;&amp;nbsp; strResult = _T("1");
&amp;nbsp;&amp;nbsp; else
&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp; switch( hr )
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; case 0x800a03fa: strResult = _T("The specified filename is invalid, the contents are corrupt or invalid."); break;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; case 0x800a03fb: strResult = _T("The specified filename cannot be found."); break;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; case 0x800a03fc: strResult = _T("The specified filename is invalid, the file cannot be opened."); break;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; case 0x800a03fd: strResult = _T("The specified document has timed out."); break;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; case 0x800a0400: strResult = _T("The specified map or index parameter is not a valid type."); break;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; case 0x800a0407: strResult = _T("Password required to read this map document."); break;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; case 0x800a0408: strResult = _T("The specified password is incorrect."); break;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; case 0x800a0409: strResult = _T("The password parameter does not contain a valid string."); break;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; case 0x800a0413: strResult = _T("The version of the specified document cannot be read by this software."); break;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; case 0x800a0414: strResult = _T("The specified document can only be opened in the ArcReader application."); break;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; case 0x800a0415: strResult = _T("The specified document does not allow access to internal objects."); break;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; case 0x800a0429: strResult = _T("The specified Published Map File contains a Globe and cannot be open."); break;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; default: strResult.Format( _T("0x%x"), hr );
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp; }
&amp;nbsp; }
&amp;nbsp; else
&amp;nbsp;&amp;nbsp; strResult = _T("Invalid MXD file.");
 }
 else
&amp;nbsp; strResult = _T("Map control has not been initialized.");

 return strResult.AllocSysString();
}&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 09 Jun 2010 21:39:14 GMT</pubDate>
    <dc:creator>KevinFournier</dc:creator>
    <dc:date>2010-06-09T21:39:14Z</dc:date>
    <item>
      <title>LoadMxFile not loading</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/loadmxfile-not-loading/m-p/239379#M6186</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have a method wrapping the Map Control's LoadMxFile method. It returns OK but no map loads. Any ideas why this might happen? I'm working in C++/MFC:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;BSTR CBGMapCtrl::LoadMxFile(LPCTSTR lpszPath, LPCTSTR lpszName, LPCTSTR lpszPassword)
{
 CString strResult;

 if( m_pMapControl )
 {
&amp;nbsp; COleVariant varName(vtMissing), varPassword(vtMissing);

&amp;nbsp; if( lpszName &amp;amp;&amp;amp; *lpszName )
&amp;nbsp;&amp;nbsp; varName = COleVariant( lpszName );
&amp;nbsp; if( lpszPassword &amp;amp;&amp;amp; *lpszPassword )
&amp;nbsp;&amp;nbsp; varPassword = COleVariant( lpszPassword );

&amp;nbsp; CComBSTR strPath( lpszPath );
&amp;nbsp; VARIANT_BOOL bOk = FALSE;
&amp;nbsp; if( SUCCEEDED(m_pMapControl-&amp;gt;CheckMxFile(strPath, &amp;amp;bOk)) &amp;amp;&amp;amp; bOk )
&amp;nbsp; {
&amp;nbsp;&amp;nbsp; HRESULT hr = m_pMapControl-&amp;gt;LoadMxFile( CComBSTR(lpszPath), varName, varPassword );
&amp;nbsp;&amp;nbsp; if( SUCCEEDED(hr) )
&amp;nbsp;&amp;nbsp;&amp;nbsp; strResult = _T("1");
&amp;nbsp;&amp;nbsp; else
&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp; switch( hr )
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; case 0x800a03fa: strResult = _T("The specified filename is invalid, the contents are corrupt or invalid."); break;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; case 0x800a03fb: strResult = _T("The specified filename cannot be found."); break;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; case 0x800a03fc: strResult = _T("The specified filename is invalid, the file cannot be opened."); break;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; case 0x800a03fd: strResult = _T("The specified document has timed out."); break;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; case 0x800a0400: strResult = _T("The specified map or index parameter is not a valid type."); break;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; case 0x800a0407: strResult = _T("Password required to read this map document."); break;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; case 0x800a0408: strResult = _T("The specified password is incorrect."); break;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; case 0x800a0409: strResult = _T("The password parameter does not contain a valid string."); break;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; case 0x800a0413: strResult = _T("The version of the specified document cannot be read by this software."); break;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; case 0x800a0414: strResult = _T("The specified document can only be opened in the ArcReader application."); break;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; case 0x800a0415: strResult = _T("The specified document does not allow access to internal objects."); break;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; case 0x800a0429: strResult = _T("The specified Published Map File contains a Globe and cannot be open."); break;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; default: strResult.Format( _T("0x%x"), hr );
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp; }
&amp;nbsp; }
&amp;nbsp; else
&amp;nbsp;&amp;nbsp; strResult = _T("Invalid MXD file.");
 }
 else
&amp;nbsp; strResult = _T("Map control has not been initialized.");

 return strResult.AllocSysString();
}&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Jun 2010 21:39:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/loadmxfile-not-loading/m-p/239379#M6186</guid>
      <dc:creator>KevinFournier</dc:creator>
      <dc:date>2010-06-09T21:39:14Z</dc:date>
    </item>
  </channel>
</rss>

