How to prevent "appstarting" cursor when calling IContextMenu::QueryContextMenu?
See the question and my original answer on StackOverflowThis is not officially documented but you can implement the IWaitCursorManager interface, here is its definition (in C#):
[Guid("fc992f1f-debb-4596-b355-50c7a6dd1222")]
public interface IWaitCursorManager
{
HRESULT Start(CURSORID id);
HRESULT Restore();
HRESULT Stop(CURSORID id);
}
public enum CURSORID
{
CID_WAIT = 0,
CID_APPSTARTING = 1,
}
To implement it you must pass a "site" to the IContextMenu implementation. For that just QueryInterface it for the IObjectWithSite interface, something like this (again in C#)
var ows = (IObjectWithSite)contextMenu;
and then pass a COM object of yours that must implement IServiceProvider:
var mySite = new MySite();
ows.SetSite(mySite);
Your COM object will be called on QueryService for a IWaitCursorManager's IID (among other IIDs). Pass an implementation of it that does nothing, like this:
public class MySite : IServiceProvider, IWaitCursorManager
{
HRESULT QueryService(Guid siid, Guid iid, out object obj)
{
if (iid == typeof(IWaitCursorManager).Guid)
{
obj = this;
return 0;
}
...
}
HRESULT Start(CURSORID id)
{
return 0;
}
HRESULT Restore()
{
return 0;
}
HRESULT Stop(CURSORID id)
{
return 0;
}
}