VirtualBox

Changeset 3121 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
Jun 15, 2007 12:24:02 PM (18 years ago)
Author:
vboxsync
Message:

FE/Qt: Rolled back r21969 (not necessary since there is IMachine::pid and it's very easy to get a HWND from a PID on Win32).

Location:
trunk/src/VBox/Frontends/VirtualBox
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/include/VBoxConsoleWnd.h

    r3102 r3121  
    111111    void updateAppearanceOf (int element);
    112112
    113 #ifdef Q_WS_WIN
    114     void storeHwndDescriptor();
    115     void cleanHwndDescriptor();
    116     HANDLE mMapFile;
    117     LPCTSTR mBuf;
    118 #endif
    119 
    120113private slots:
    121114
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleWnd.cpp

    r3102 r3121  
    699699    csession = session;
    700700
    701 #ifdef Q_WS_WIN
    702     /* Store HWND descriptor into named virtual shared memory segment. */
    703     storeHwndDescriptor();
    704 #endif
    705 
    706701    if (!centralWidget())
    707702    {
     
    1001996        return;
    1002997    }
    1003 
    1004 #ifdef Q_WS_WIN
    1005     /* Closes the handlers to the stored NVSM segment to let the system free it. */
    1006     cleanHwndDescriptor();
    1007 #endif
    1008998
    1009999    idle_timer->stop();
     
    17371727}
    17381728
    1739 #ifdef Q_WS_WIN
    1740 /* This function stores the current VM console window HWND handler to the
    1741  * named virtual shared memory segment with VBoxQt-{machine-uuid} name
    1742  * allowing other application get accessing this VM console window. */
    1743 void VBoxConsoleWnd::storeHwndDescriptor()
    1744 {
    1745     QString machineId = csession.GetMachine().GetId().toString();
    1746     QString segmentName = QString ("VBoxQt-%1").arg (machineId);
    1747 
    1748     /* Structure for storing HWND information */
    1749     struct VBoxQtInfo
    1750     {
    1751         VBoxQtInfo (uint32_t aVersion, HWND aHwnd)
    1752             : version (aVersion), hwndWin (aHwnd) {}
    1753         uint32_t version; /* Version of the structure, currently 1 */
    1754         HWND     hwndWin; /* HWND Descriptor */
    1755     } info (1, winId());
    1756 
    1757     /* Open NVSM handle */
    1758     mMapFile = CreateFileMapping (INVALID_HANDLE_VALUE,   // use paging file
    1759                                   NULL,                   // default security
    1760                                   PAGE_READWRITE,         // read/write access
    1761                                   0,                      // max. object size
    1762                                   sizeof (info),          // buffer size
    1763                          (LPCWSTR)segmentName.unicode()); // name of mapping object
    1764     if (mMapFile == NULL) return;
    1765 
    1766     mBuf = (LPTSTR) MapViewOfFile (mMapFile,              // handle to map object
    1767                                    FILE_MAP_ALL_ACCESS,   // read/write permission
    1768                                    0,
    1769                                    0,
    1770                                    sizeof (info));
    1771     if (mBuf == NULL) return;
    1772 
    1773     CopyMemory ((PVOID)mBuf, (void*)&info, sizeof (info));
    1774 }
    1775 
    1776 /* This function closes any handlers pointed to allocated named virtual
    1777  * shared memory segment with this dialog's HWND handler. */
    1778 void VBoxConsoleWnd::cleanHwndDescriptor()
    1779 {
    1780     /* Freeing resources */
    1781     if (mBuf != NULL)
    1782         UnmapViewOfFile (mBuf);
    1783     if (mMapFile != NULL)
    1784         CloseHandle (mMapFile);
    1785 }
    1786 #endif
    1787 
    1788 
    17891729//
    17901730// Private slots
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette