laptop and a wrench

Bug

ArcMap dataview does not rendered correctly if it is opened from the ArcObject sample application “DesktopAutomation.”

Last Published: August 19, 2020 ArcGIS for Desktop
Bug ID Number NIM088363
SubmittedJanuary 24, 2013
Last ModifiedJune 5, 2024
Applies toArcGIS for Desktop
Version found10.1
Program languageC#
Operating SystemWindows OS
Operating System Version7 64 Bit
StatusWill Not Be Addressed

Additional Information

We apologize that we were unable to address this issue within the current product support cycle.  If the issue continues to affect your work in a supported release, please contact Technical Support.

Workaround

Currently the sample starts the application using the MxDocument class where they can get the application reference from the MxDocument that was just started. The workaround involves starting the process using the standard .NET Process class then utilizes the AppROT AppAdded event handler to obtain the application reference. //import user32.dll to call GetWindowThreadProcessId[System.Runtime.InteropServices.DllImport("user32")]static extern int GetWindowThreadProcessId(IntPtr hWnd, out int processId); private void btnStartApp_Click(object sender, EventArgs e){ m_appROTEvent = new AppROTClass(); m_appROTEvent.AppAdded += new IAppROTEvents_AppAddedEventHandler(m_appROTEvent_AppAdded); m_appROTEvent.AppRemoved += new IAppROTEvents_AppRemovedEventHandler(m_appROTEvent_AppRemoved); System.Diagnostics.Debug.WriteLine("Starting process " + DateTime.Now); Process arcMapProcess = Process.Start(@"<a href="file:C:/Program" target="_blank">C:\Program</a> Files (x86)\ArcGIS\Desktop10.1\bin\ArcMap.exe"); //get the ID of the process that was just started arcMapProcessId = <a href="http://arcMapProcess.Id" target="_blank">arcMapProcess.Id</a>; while (!m_appStarted) Application.DoEvents(); ////Enable/disable controls accordingly txtShapeFilePath.Enabled = true; btnShutdown.Enabled = true; btnDrive.Enabled = ShouldEnableAddLayer; cboApps.Enabled = btnStartApp.Enabled = false;}void m_appROTEvent_AppAdded(AppRef pApp){ //get the ID of the app that was just added GetWindowThreadProcessId((IntPtr)pApp.hWnd, out appAddedProcessId); // compare the IDs to know that you have the correct application instance if (appAddedProcessId == arcMapProcessId) { //Get a reference of the application and make it visible m_application = pApp; m_application.Visible = true; m_appHWnd = m_application.hWnd; System.Diagnostics.Debug.WriteLine("HWND from AppAdded " + m_appHWnd.ToString() + " " + DateTime.Now); m_appStarted = true; }}

Steps to Reproduce

Bug ID: NIM088363

Software:

  • ArcGIS for Desktop

Get notified when the status of a bug changes

Download the Esri Support App

Discover more on this topic

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options