Post Reply

Forums -> UltraMon™ SDK -> what may cause pIndDisp->DetachMonitors(mons) returning 0x80010105
Von.Tao   2005-04-20 23:11
as topic, thanks

Christian Studer   2005-04-21 04:28
Looks like an exception was raised when calling the method, if possible please post a short code sample which reproduces the problem.

Christian Studer -
Von.Tao   2005-04-21 14:56
I just used your sample code as following. I found that it works fine when i reboot my system.Then I comments the "detach" line and enable the "attach" line to attach,however, the attach try fails.The variable "result" is 0x800??? like the topic. I hava try enabling and disabling the secondry by windows display setting, but it does nothing.
Addtionally, I suspects a bug of ultramon.When I success to detach the secondary monitor one time,the "Enable Secondary" appears in the popmenu all the time.

IUltraMonIndDisp* pIndDisp = 0;
CoCreateInstance(CLSID_UltraMonIndDisp, 0, CLSCTX_ALL, IID_IUltraMonIndDisp,reinterpret_cast(&pIndDisp));

mons.vt = VT_ARRAY;

// create a one-element safearray
SAFEARRAY* psa = SafeArrayCreateVector(VT_VARIANT, 0, 1);

// get a pointer to the safearray data and set the first element. we want to detach monitor 2
VARIANT* pMons = 0;
SafeArrayAccessData(psa, reinterpret_cast(&pMons));

pMons[0].vt = VT_I4;
pMons[0].lVal = 1;

// detach monitor 2
mons.parray = psa;
HRESULT result = pIndDisp->AttachMonitors();
// HRESULT result = pIndDisp->DetachMonitors(mons);

Christian Studer   2005-04-22 08:33
You'll need to use the same IndDisp object to detach and attach the monitor, the monitor only stays detached as long as the IndDisp object is around.

UltraMon treats detached monitors as disabled, that's why you'll get Enable Secondary on the UltraMon menu when all monitors except one are detached.

Christian Studer -
Von.Tao   2005-04-23 01:38
Thanks! you are correct.I got it.

Forums -> UltraMon™ SDK -> what may cause pIndDisp->DetachMonitors(mons) returning 0x80010105

Post Reply