Activating ToolWindow under

Docking/MDI for WPF Forum

Posted 9 years ago by Bret Naughton
Version: 10.1.0523
Avatar
I installed version 5.23 (redeployed version) yesterday and had some immediate issues when trying to activate a toolwindow. I get the error message in VS of HRESULT: 0x8007007E FileNotFoundException was unhandled.

I have added the Actipro component DLL's correctly (I am using Ribbon; Docking; and Shared) to my project.

I uninstalled 5.23 and reinstalled 5.22 and the issue resolved itself.. however, after rebooting the machine, the issue has come back. I have now gone back to all my previous development versions/phases of my application and the same issue is occurring. I have uninstalled; rebooted and reinstalled Acipro (and included the Actipro references) but I am still having the issue.

Could you let me know any thoughts on why this could be happening. I am using .Net 3.5 PS1 on an xp machine.

PS I did try to install the original build 5.23 but as I did not have .NET 4.0, it rolled back OK (from what I can see).

Thanks

Comments (9)

Posted 9 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Bret,

We're not aware of any issues such as what you described. If you run your project in Visual Studio debug mode, make sure you set break on all CLR exceptions (from the VS Exceptions dialog), and then repro it. That should help you see the exact exception that is occurring. If that doesn't help you, please post the exception details (name, message, stack trace, etc.) so we can see them. Thanks!

[Modified at 06/29/2010 07:14 AM]


Actipro Software Support

Posted 9 years ago by Bret Naughton
Avatar
Thanks again for your assistance with this,

I have attached the Stack Trace below. The way the system currently works is that I have an Active X Control inside a Windows Forms Host. This is then set as the content of the toolwindow, and then I activate it. As mentioned, this has worked OK, and I have managed to successfully communicate with the activex/axinterop component using the ribbon bar. As mentioned I can go back to any version of my daily backedup development environments, and I have the same issue.




System.IO.FileNotFoundException was unhandled
Message="The specified module could not be found. (Exception from HRESULT: 0x8007007E)"
Source="System.Windows.Forms"
StackTrace:
at System.Windows.Forms.UnsafeNativeMethods.CoCreateInstance(Guid& clsid, Object punkOuter, Int32 context, Guid& iid)
at System.Windows.Forms.AxHost.CreateWithoutLicense(Guid clsid)
at System.Windows.Forms.AxHost.CreateWithLicense(String license, Guid clsid)
at System.Windows.Forms.AxHost.CreateInstanceCore(Guid clsid)
at System.Windows.Forms.AxHost.CreateInstance()
at System.Windows.Forms.AxHost.GetOcxCreate()
at System.Windows.Forms.AxHost.TransitionUpTo(Int32 state)
at System.Windows.Forms.AxHost.CreateHandle()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ContainerControl.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.IntCreateWindowEx(Int32 dwExStyle, String lpszClassName, String lpszWindowName, Int32 style, Int32 x, Int32 y, Int32 width, Int32 height, HandleRef hWndParent, HandleRef hMenu, HandleRef hInst, Object pvParam)
at System.Windows.Forms.UnsafeNativeMethods.CreateWindowEx(Int32 dwExStyle, String lpszClassName, String lpszWindowName, Int32 style, Int32 x, Int32 y, Int32 width, Int32 height, HandleRef hWndParent, HandleRef hMenu, HandleRef hInst, Object pvParam)
at System.Windows.Forms.NativeWindow.CreateHandle(CreateParams cp)
at System.Windows.Forms.Control.CreateHandle()
at System.Windows.Forms.Control.get_Handle()
at System.Windows.Forms.Integration.WindowsFormsHost.BuildWindowCore(HandleRef hwndParent)
at System.Windows.Interop.HwndHost.BuildWindow(HandleRef hwndParent)
at System.Windows.Interop.HwndHost.BuildOrReparentWindow()
at System.Windows.Interop.HwndHost.OnSourceChanged(Object sender, SourceChangedEventArgs e)
at System.Windows.SourceChangedEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
at System.Windows.UIElement.RaiseEvent(RoutedEventArgs e)
at System.Windows.PresentationSource.UpdateSourceOfElement(DependencyObject doTarget, DependencyObject doAncestor, DependencyObject doOldParent)
at System.Windows.PresentationSource.OnVisualAncestorChanged(DependencyObject uie, AncestorChangedEventArgs e)
at System.Windows.UIElement.OnVisualAncestorChanged(Object sender, AncestorChangedEventArgs e)
at System.Windows.Media.Visual.ProcessAncestorChangedNotificationRecursive(DependencyObject e, AncestorChangedEventArgs args)
at System.Windows.Media.Visual.FireOnVisualParentChanged(DependencyObject oldParent)
at System.Windows.Media.Visual.AddVisualChild(Visual child)
at System.Windows.FrameworkElement.set_TemplateChild(UIElement value)
at System.Windows.StyleHelper.AddCustomTemplateRoot(FrameworkElement container, UIElement child, Boolean checkVisualParent, Boolean mustCacheTreeStateOnChild)
at System.Windows.Controls.ContentPresenter.UseContentTemplate.BuildVisualTree(FrameworkElement container)
at System.Windows.StyleHelper.ApplyTemplateContent(UncommonField`1 dataField, DependencyObject container, FrameworkElementFactory templateRoot, Int32 lastChildIndex, HybridDictionary childIndexFromChildID, FrameworkTemplate frameworkTemplate)
at System.Windows.FrameworkTemplate.ApplyTemplateContent(UncommonField`1 templateDataField, FrameworkElement container)
at System.Windows.FrameworkElement.ApplyTemplate()
at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
at System.Windows.UIElement.Measure(Size availableSize)
at System.Windows.Controls.Border.MeasureOverride(Size constraint)
at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
at System.Windows.UIElement.Measure(Size availableSize)
at System.Windows.Controls.Border.MeasureOverride(Size constraint)
at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
at System.Windows.UIElement.Measure(Size availableSize)
at System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV)
at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV)
at System.Windows.Controls.Grid.MeasureOverride(Size constraint)
at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
at System.Windows.UIElement.Measure(Size availableSize)
at System.Windows.Controls.Control.MeasureOverride(Size constraint)
at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
at System.Windows.UIElement.Measure(Size availableSize)
at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)
at System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint)
at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
at System.Windows.UIElement.Measure(Size availableSize)
at System.Windows.ContextLayoutManager.UpdateLayout()
at System.Windows.UIElement.UpdateLayout()
at ActiproSoftware.Windows.Controls.Docking.DockingWindowContainer.f(Boolean A_0)
at ActiproSoftware.Windows.Controls.Docking.DockingWindowContainer.FocusSelectedWindow()
at ActiproSoftware.Windows.Controls.Docking.DockSite.b(DockingWindow A_0, Boolean A_1)
at ActiproSoftware.Windows.Controls.Docking.DockSite.a(DockingWindow A_0, Boolean A_1, Boolean A_2)
at ActiproSoftware.Windows.Controls.Docking.DockingWindow.Activate(Boolean focus)
at ActiproSoftware.Windows.Controls.Docking.DockingWindow.Activate()
at Mosaic.Window.AnalyserInitialise(Object AnalyserFileNamePath) in C:\Documents and Settings\ME\Desktop\mosaic Desktop\Copy (50) of mosaic\mosaic\mosaic.xaml.vb:line 1728
at Mosaic.Window.AnalyserCreate(Object fileName) in C:\Documents and Settings\ME\Desktop\mosaic Desktop\Copy (50) of mosaic\mosaic\mosaic.xaml.vb:line 1704
at Mosaic.Window.appFileNewCommand_Execute(Object sender, ExecutedRoutedEventArgs e) in C:\Documents and Settings\ME\Desktop\mosaic Desktop\Copy (50) of mosaic\mosaic\mosaic.xaml.vb:line 1150
at System.Windows.Input.CommandBinding.OnExecuted(Object sender, ExecutedRoutedEventArgs e)
at System.Windows.Input.CommandManager.ExecuteCommandBinding(Object sender, ExecutedRoutedEventArgs e, CommandBinding commandBinding)
at System.Windows.Input.CommandManager.FindCommandBinding(CommandBindingCollection commandBindings, Object sender, RoutedEventArgs e, ICommand command, Boolean execute)
at System.Windows.Input.CommandManager.FindCommandBinding(Object sender, RoutedEventArgs e, ICommand command, Boolean execute)
at System.Windows.Input.CommandManager.OnExecuted(Object sender, ExecutedRoutedEventArgs e)
at System.Windows.UIElement.OnExecutedThunk(Object sender, ExecutedRoutedEventArgs e)
at System.Windows.Input.ExecutedRoutedEventArgs.InvokeEventHandler(Delegate genericHandler, Object target)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
at System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted)
at System.Windows.Input.RoutedCommand.ExecuteImpl(Object parameter, IInputElement target, Boolean userInitiated)
at System.Windows.Input.RoutedCommand.Execute(Object parameter, IInputElement target)
at ActiproSoftware.Windows.Controls.Ribbon.Input.RibbonCommand.a(ICommandSource A_0)
at ActiproSoftware.Windows.Controls.Ribbon.Controls.Primitives.ControlBase.OnClick(ExecuteRoutedEventArgs e)
at ActiproSoftware.Windows.Controls.Ribbon.Controls.Primitives.ButtonBase.OnClick(ExecuteRoutedEventArgs e)
at ActiproSoftware.Windows.Controls.Ribbon.Controls.Primitives.ControlBase.<>c__DisplayClass1.a(Object A_0)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
at System.Windows.Threading.Dispatcher.WrappedInvoke(Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
at System.Windows.Threading.DispatcherOperation.InvokeImpl()
at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)
at System.Threading.ExecutionContext.runTryCode(Object userData)
at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Windows.Threading.DispatcherOperation.Invoke()
at System.Windows.Threading.Dispatcher.ProcessQueue()
at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
at System.Windows.Threading.Dispatcher.WrappedInvoke(Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Boolean isSingleParameter)
at System.Windows.Threading.Dispatcher.Invoke(DispatcherPriority priority, Delegate method, Object arg)
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
at System.Windows.Threading.Dispatcher.Run()
at System.Windows.Application.RunDispatcher(Object ignore)
at System.Windows.Application.RunInternal(Window window)
at System.Windows.Application.Run(Window window)
at System.Windows.Application.Run()
at Mosaic.Application.Main() in C:\Documents and Settings\ME\Desktop\mosaic Desktop\Copy (50) of mosaic\mosaic\obj\Debug\Application.g.vb:line 63
at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
at System.Runtime.Hosting.ManifestRunner.Run(Boolean checkAptModel)
at System.Runtime.Hosting.ManifestRunner.ExecuteAsAssembly()
at System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext, String[] activationCustomData)
at System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext)
at System.Activator.CreateInstance(ActivationContext activationContext)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssemblyDebugInZone()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:
Posted 9 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Bret,

Based on all that information I really don't think it's anything we're doing. From your stack trace, all we do is call the UIElement.UpdateLayout method and deep in that stack of calls, Microsoft ActiveX code is throwing the exception.

The fact that it used to work but now even when you restore to old versions it doesn't work leads me to believe it's something else on your system that is causing this.

Maybe try googling items in that stack trace (near where the exception is thrown) to see if there is any information on the web related to this, such as:
"axhost The specified module could not be found"


Actipro Software Support

Posted 9 years ago by Bret Naughton
Avatar
I have created a fresh virtual machine and have installed Actipro 522. Then I ran my application and it works fine. Uninstalled 522 and installed 523. I then replaced/inserted new references into my app for 523 versions of ribbon/docking & shared. When I run I get the same problem as I previously described. Tracking it down, it looks like the toolwindow is not able to activate due to the contents of the toolwindow (the windowsformshost + the child activex), although this works fine in 522.

What I have then done is to remove 523 and reinstall 522 - the application again works fine.

Bit concerned, because it looks like I will be unable to apply new upgrades to my application, which is going to be implemented across a few companies in the next few weeks.

Thanks
Posted 9 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Bret,

Ok if this is the case (that it is only occurring in 523 and not in previous builds), can you make a simple sample project (as small as possible) that shows the issue and email it to us to debug? Please make sure you rename the ZIP file extension so that it doesn't get blocked. We can take that and figure out what change is causing the problem.


Actipro Software Support

Posted 9 years ago by Bret Naughton
Avatar
Hi,

Will do - I will have to talk to get clearance first from my company, as the active x component is something that they have developed - once I get permission I will send the example on. Thanks again for your assistance on this.
Posted 9 years ago by Bret Naughton
Avatar
Hi, Just to let you know that I think I have tracked down the issue... at least using my active x user control. (I am still looking to get permission to release the activeX usercontrol)

I have tested under 5.22 the following code.

'
Class Window
Public Sub New()
InitializeComponent()
End Sub

'
Private Sub OBJECT_NEW()
'
Dim UC = New USERCONTROL

Dim WINDOWSFORMSHOST = New Forms.Integration.WindowsFormsHost
WINDOWSFORMSHOST.Child = UC

Dim TOOLWINDOW As New ToolWindow(dockSite)
TOOLWINDOW.Title = TOOLWINDOW.UniqueId.ToString
TOOLWINDOW.Content = WINDOWSFORMSHOST
TOOLWINDOW.Activate()

MsgBox(dockSite.ActiveWindow.UniqueId.ToString)
End Sub
End Class

This works OK under 5.22, but under 5.23, I get an error at the point where the msgbox tries to display the value of dockSite.ActiveWindow.UniqueId. When I try this code without setting the contents of the toolwindow, all is OK under 5.23. This may be just specific to my usercontrol, but wanted to pass on just in case. For now, I am going to not reference ActiveWindow and then run my app in 5.23.


Another point related to this (why I have not started another thread), using this code as an example, I find that the ActiveWindow under 5.22 displays the correct ActiveWindow uniqueid for the first 2 activations of the ToolWindow, but then seems out of step (i.e when displaying the active window unique id for the 3rd instance of the toolwindow, it is showing the unique id for the previous 2nd toolwindow). I understand that this may be related to something referenced in the Actipro troubleshooting documentation where usercontrols can cause ActiveWindow to be incorrect. In this case, I have also programatically added the usercontrol to a panel before adding to the windowsformshost, but the same issue still applies. For 5.23, I noticed that one of the fixes is 'Fixed issue with passing focus to Interop controls when selecting document/tool tabs' - is this the resolution to the windowsactive issue?

Also, I have buttons in the ribbon bar with associated 'canexecuted' events that have their 'if' conditions based on properties from the user control. I am using the 'ActiveWindow' to determine the current toolwindow & therefore usercontrol that is selected so that the 'if' conditions in the 'canexecuted' are set to the relevant user control. But what I am finding under 5.22 is that I have to click in the usercontrol, then click on the toolwindow title (and sometimes back and forth between toolwindows) to reflect the correct 'canexecute' state. I think this again may have to do with the 'ActiveWindow' issue - could you suggest another method for detecting the selected window based on selecting either the toolwindow title or usercontrol. PS I have tried using the Preview event/handler, but I find that I can only determine the toolwindowcontainer uniqueId (e.Source) and not the actual toolwindow uniqueId.

Thanks,
Bret
Posted 9 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Bret,

For scenario-based questions like these, we really need you to provide a simple sample project that shows the issue so that we can debug what is going on.

The focus changes in 523 were done to deal with passing focus down to interop controls. Basically we see if the child element implements IKeyboardInputSink. If it does we call IKeyboardInputSink.TabInto.

ActiveWindow should be tracking the currently focused docking window properly. It probably could be null in scenarios where focus is not in a docking window. For your command issue, perhaps the commands are being queried before/after the ActiveWindow property has been updated. It's hard to say without seeing it.


Actipro Software Support

Posted 9 years ago by Bret Naughton
Avatar
Thanks, I have resolved the issue concerning the ActiveWindow issue in 522, of not tracking the correct current window. There is a refresh method for the activex usercontrol for updating the activex display, that I trigger as part of custom code from the WindowActivate event. When called it causes the ActiveWindow property to still store the previous current window. I have taken the activex refresh command out of the window activate event code and I now call it after the event has triggered - works OK now.

As for the 5.2.3 issue, will send code as soon as possible.

Thanks again,
Bret
The latest build of this product (v2019.1 build 0683) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.