RE: VNC & Win2K multiple monitors

From: Mao, Crusoe (crusoe.mao@intel.com)
Date: 2024 - 22:52:49 EDT

  • Next message: Tim Nicholson: "Re: jVNC Server for Java demo over the Internet"

    Yes, I posted similar subject couple weeks ago, no reply. For now, I think I have figured out the way, to do it, you have to modify the code in vncDesktop.cpp and rebuild WinVNC project. Basically, Win32 supports multiple monitor programming with a set of specialized API, three of them are most important: EnumDisplayMonitors, GetMonitorInfo, CreateDC. With formal two, you can enumerate all monitors in system and then get the information for an arbitrary monitoir, while the latter one can create a display device context handle for arbitrary monitor with giving monitor internal name. You may find detail information in MSDN. Notes: when you hook to different monitors with same vncClient, you also need to solve the prolbem of different resolution among monitors and the placement of monitors, basically they imact the mouse movement(move mouse traveling across monitors). Here is the secret to upgrade winVNC:

    >>vnCDesktop.cpp,
    typedef std::vector<HMONITOR> MONITOR_LIST;
    RECT grectDisplay;
    BOOL CALLBACK MonitorEnumCallback(HMONITOR hMonitor, HDC hdc, LPRECT prc, LPARAM lParam)
    {
            MONITOR_LIST* pmonitors = (MONITOR_LIST*)lParam;
            pmonitors->push_back(hMonitor);
                return TRUE;
    }

    /**
     * Insert following codes at the begining of vncDesktop::InitBitmap()
     * Here I hook up the secondary monitor.
     **/
    BOOL vncDesktop::InitBitmap()
    {
            // Get the device context for the whole screen and find it's size
            MONITOR_LIST monitors;
            /**
                    * Enumerate information for all monitors into a array. MonitorEnumCallBack is the callback funtion which fills the array.
                    **/
            EnumDisplayMonitors(NULL, NULL, MonitorEnumCallback, LPARAM(&monitors));
            HMONITOR hMon = monitors[1]; //you may change the array index to arbitrary to hook up a monitor you want.
            MONITORINFOEX monitorInfo;
            monitorInfo.cbSize = sizeof(MONITORINFOEX);
            if(GetMonitorInfo(hMon, &monitorInfo))
            {
                    m_hrootdc = ::CreateDC("DISPLAY", monitorInfo.szDevice, NULL, NULL);
                    memcpy(&grectDisplay, &(monitorInfo.rcMonitor), sizeof(RECT));
            }
            .............
    }

    >>In vncClient.cpp
    extern RECT grectDisplay;

    /**
     * You may solve the mouse movement conflict when hooking up to multiple monitors at the same time.
     * Obviously, the code I've given is too simple to handle the issue, I just demonstrate the idea and issue,
    * you may have to work out in practical. Topics I haven't been able touch are: (Sorry, I'm too busy on others)
    * 1. Revise vncDesktop.cpp to manage multiple monitors.
    * 2. Revise vncServer to let it manage multiple desktops each handling one monitors.
    * 3. Revise vncClient to let it handle client ---> monitor mapping.
    * 4. application domain for multiple monitors.
     **/
    void vncClientThread::run(void *arg)
    {
    //................as usual
            case rfbPointerEvent:
            // Generate coordinate values
            unsigned long x = ((msg.pe.x + grectDisplay.left) * 65535) / (m_client->m_fullscreen.right);
            unsigned long y = ((msg.pe.y + grectDisplay.top) * 65535) / (m_client->m_fullscreen.bottom);
    //...............as usual
    }

    Thanks,
    Crusoe

    -----Original Message-----
    From: Malencia, Ken [mailto:KMalencia@AlleghenyLudlum.com]
    Sent: 2000?8?23? 1:42
    To: vnc-list@uk.research.att.com
    Subject: VNC & Win2K multiple monitors

    Dear List,

    Has anyone bee successful in getting VNC to work with Windows 2000 running
    with multiple monitors? I have it running well with the primary monitor but
    are unable to see the secondary monitor when remoting in. I thought I saw
    something about this come across the list but now I cannot find it.

    Thanks in advance :-)

    Ken Malencia
    Allegheny Ludlum
    ---------------------------------------------------------------------
    To unsubscribe, send a message with the line: unsubscribe vnc-list
    to majordomo@uk.research.att.com
    See also: http://www.uk.research.att.com/vnc/intouch.html
    ---------------------------------------------------------------------
    ---------------------------------------------------------------------
    To unsubscribe, send a message with the line: unsubscribe vnc-list
    to majordomo@uk.research.att.com
    See also: http://www.uk.research.att.com/vnc/intouch.html
    ---------------------------------------------------------------------

    -----------------------------------------
    TridiaVNC - http://www.tridiavnc.com/



    This archive was generated by hypermail 2b29 : 2024 - 23:07:57 EDT