Changeset 3121 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Jun 15, 2007 12:24:02 PM (18 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/include/VBoxConsoleWnd.h
r3102 r3121 111 111 void updateAppearanceOf (int element); 112 112 113 #ifdef Q_WS_WIN114 void storeHwndDescriptor();115 void cleanHwndDescriptor();116 HANDLE mMapFile;117 LPCTSTR mBuf;118 #endif119 120 113 private slots: 121 114 -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleWnd.cpp
r3102 r3121 699 699 csession = session; 700 700 701 #ifdef Q_WS_WIN702 /* Store HWND descriptor into named virtual shared memory segment. */703 storeHwndDescriptor();704 #endif705 706 701 if (!centralWidget()) 707 702 { … … 1001 996 return; 1002 997 } 1003 1004 #ifdef Q_WS_WIN1005 /* Closes the handlers to the stored NVSM segment to let the system free it. */1006 cleanHwndDescriptor();1007 #endif1008 998 1009 999 idle_timer->stop(); … … 1737 1727 } 1738 1728 1739 #ifdef Q_WS_WIN1740 /* This function stores the current VM console window HWND handler to the1741 * named virtual shared memory segment with VBoxQt-{machine-uuid} name1742 * 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 VBoxQtInfo1750 {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 file1759 NULL, // default security1760 PAGE_READWRITE, // read/write access1761 0, // max. object size1762 sizeof (info), // buffer size1763 (LPCWSTR)segmentName.unicode()); // name of mapping object1764 if (mMapFile == NULL) return;1765 1766 mBuf = (LPTSTR) MapViewOfFile (mMapFile, // handle to map object1767 FILE_MAP_ALL_ACCESS, // read/write permission1768 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 virtual1777 * 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 #endif1787 1788 1789 1729 // 1790 1730 // Private slots
Note:
See TracChangeset
for help on using the changeset viewer.