- Timestamp:
- Apr 3, 2009 1:37:55 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/NetworkServices/DHCP/VBoxNetDHCP.cpp
r18510 r18691 2057 2057 2058 2058 # ifdef RT_OS_WINDOWS 2059 2060 static LRESULT CALLBACK WindowProc(HWND hwnd, 2061 UINT uMsg, 2062 WPARAM wParam, 2063 LPARAM lParam 2064 ) 2065 { 2066 if(uMsg == WM_DESTROY) 2067 { 2068 PostQuitMessage(0); 2069 return 0; 2070 } 2071 return DefWindowProc (hwnd, uMsg, wParam, lParam); 2072 } 2073 2074 static LPCSTR g_WndClassName = "VBoxNetDHCPClass"; 2075 2076 static DWORD WINAPI MsgThreadProc(__in LPVOID lpParameter) 2077 { 2078 HWND hwnd = 0; 2079 HINSTANCE hInstance = (HINSTANCE)GetModuleHandle (NULL); 2080 bool bExit = false; 2081 2082 /* Register the Window Class. */ 2083 WNDCLASS wc; 2084 wc.style = 0; 2085 wc.lpfnWndProc = WindowProc; 2086 wc.cbClsExtra = 0; 2087 wc.cbWndExtra = sizeof(void *); 2088 wc.hInstance = hInstance; 2089 wc.hIcon = NULL; 2090 wc.hCursor = NULL; 2091 wc.hbrBackground = (HBRUSH)(COLOR_BACKGROUND + 1); 2092 wc.lpszMenuName = NULL; 2093 wc.lpszClassName = g_WndClassName; 2094 2095 ATOM atomWindowClass = RegisterClass(&wc); 2096 2097 if (atomWindowClass != 0) 2098 { 2099 /* Create the window. */ 2100 hwnd = CreateWindowEx (WS_EX_TOOLWINDOW | WS_EX_TRANSPARENT | WS_EX_TOPMOST, 2101 g_WndClassName, g_WndClassName, 2102 WS_POPUPWINDOW, 2103 -200, -200, 100, 100, NULL, NULL, hInstance, NULL); 2104 2105 if (hwnd) 2106 { 2107 SetWindowPos(hwnd, HWND_TOPMOST, -200, -200, 0, 0, 2108 SWP_NOACTIVATE | SWP_HIDEWINDOW | SWP_NOCOPYBITS | SWP_NOREDRAW | SWP_NOSIZE); 2109 2110 MSG msg; 2111 while (GetMessage(&msg, NULL, 0, 0)) 2112 { 2113 TranslateMessage(&msg); 2114 DispatchMessage(&msg); 2115 } 2116 2117 DestroyWindow (hwnd); 2118 2119 bExit = true; 2120 } 2121 2122 UnregisterClass (g_WndClassName, hInstance); 2123 } 2124 2125 if(bExit) 2126 { 2127 /* no need any accuracy here, in anyway the DHCP server usually gets terminated with TerminateProcess */ 2128 exit(0); 2129 } 2130 2131 return 0; 2132 } 2133 2134 2059 2135 /** (We don't want a console usually.) */ 2060 2136 int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) 2061 2137 { 2062 2138 NOREF(hInstance); NOREF(hPrevInstance); NOREF(lpCmdLine); NOREF(nCmdShow); 2139 2140 HANDLE hThread = CreateThread( 2141 NULL, /*__in_opt LPSECURITY_ATTRIBUTES lpThreadAttributes, */ 2142 0, /*__in SIZE_T dwStackSize, */ 2143 MsgThreadProc, /*__in LPTHREAD_START_ROUTINE lpStartAddress,*/ 2144 NULL, /*__in_opt LPVOID lpParameter,*/ 2145 0, /*__in DWORD dwCreationFlags,*/ 2146 NULL /*__out_opt LPDWORD lpThreadId*/ 2147 ); 2148 2149 if(hThread != NULL) 2150 CloseHandle(hThread); 2151 2063 2152 return main(__argc, __argv, environ); 2064 2153 }
Note:
See TracChangeset
for help on using the changeset viewer.