Changeset 3102 in vbox
- Timestamp:
- Jun 13, 2007 4:15:06 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
r2981 r3102 111 111 void updateAppearanceOf (int element); 112 112 113 #ifdef Q_WS_WIN 114 void storeHwndDescriptor(); 115 void cleanHwndDescriptor(); 116 HANDLE mMapFile; 117 LPCTSTR mBuf; 118 #endif 119 113 120 private slots: 114 121 -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleWnd.cpp
r3006 r3102 699 699 csession = session; 700 700 701 #ifdef Q_WS_WIN 702 /* Store HWND descriptor into named virtual shared memory segment. */ 703 storeHwndDescriptor(); 704 #endif 705 701 706 if (!centralWidget()) 702 707 { … … 996 1001 return; 997 1002 } 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 998 1008 999 1009 idle_timer->stop(); … … 1727 1737 } 1728 1738 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 1729 1789 // 1730 1790 // Private slots
Note:
See TracChangeset
for help on using the changeset viewer.