I have a multi-monitor problem to which I cannot find the solution. What I'm trying to do is to launch applications on specific monitors on Windows 2000. I've been trying to use ShellExecuteEx with a proper hMonitor in the SHELLEXECUTEINFO structure, but it seems to be impossible to make it work properly. The application always opens on the primary monitor. Using the multi-monitor API, I am able to move it to any screen after it has been lauched but I'm not able to make it directly open into the monitor of my choice.
Here's the code I use:
// build the shelexecute structure
info.cbSize = sizeof(SHELLEXECUTEINFO);
info.fMask = SEE_MASK_HMONITOR;
info.hwnd = NULL;
info.lpVerb = NULL;
info.lpFile = "test.txt"; // file to be "executed"
info.lpParameters = NULL;
info.lpDirectory = NULL;
info.nShow = SW_SHOWNORMAL;
// show the file on each monitor - DOESN'T WORK: all are shown on same monitor
for (int i = 0; i < m_nbMon; i++)
info.hMonitor = m_hMon[i];
m_hMon was populated correctly by a callback function called by EnumDisplayMonitors.
Is that hmonitor feature in ShellExecuteEx really working?
Any help would be appreciated! Any code that does it even better!