Simon Mourier's Avatar
Simon Mourier's blog (1807 answers on StackOverflow) about Microsoft technologies C#, C/C++, .NET, WinRT, WinUI3, AOT, P/Invoke, COM, Interop, DirectX, Direct2D, Windows, ...
  • 🔎︎ Search
  • Categories
  • Archives
  • About Me
  • c#
  • com

How to access method of dynamically loaded com?

May 1, 2014 See the question and my original answer on StackOverflow

You should be able to use the 'dynamic' pseudo-type keyword. It will never fail at compile time, only at runtime (so you have to define calls carefully so they match the underlying definition) like this (I suppose you have 2 methods on the OCX):

dynamic ocx = m_axCtrl.GetOcx();
ocx.DoThis(arg1, arg2);
ocx.DoThat();
  • SmoBlog © 2010-2026 Simon Mourier. All rights reserved.
  • Privacy & Terms