Author: gedmurphy
Date: Wed Oct 18 19:50:05 2006
New Revision: 24562
URL:
http://svn.reactos.org/svn/reactos?rev=24562&view=rev
Log:
To stop the app hanging when enumerating, use a separate thread for enumerating
exclusively
Modified:
trunk/reactos/base/applications/devmgmt/mainwnd.c
trunk/reactos/base/applications/devmgmt/misc.c
trunk/reactos/base/applications/devmgmt/precomp.h
Modified: trunk/reactos/base/applications/devmgmt/mainwnd.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/devmgmt/…
==============================================================================
--- trunk/reactos/base/applications/devmgmt/mainwnd.c (original)
+++ trunk/reactos/base/applications/devmgmt/mainwnd.c Wed Oct 18 19:50:05 2006
@@ -206,6 +206,9 @@
hTreeView = (HWND *)lpParameter;
+ if (*hTreeView)
+ FreeDeviceStrings(*hTreeView);
+
hRoot = InitTreeView(*hTreeView);
if (hRoot)
{
@@ -411,13 +414,7 @@
case IDC_REFRESH:
{
- HTREEITEM hRoot;
-
- FreeDeviceStrings(Info->hTreeView);
-
- hRoot = InitTreeView(Info->hTreeView);
- if (hRoot)
- ListDevicesByType(Info->hTreeView, hRoot);
+ HANDLE DevEnumThread;
SendMessage(Info->hTool,
TB_SETSTATE,
@@ -426,6 +423,21 @@
EnableMenuItem(GetMenu(Info->hMainWnd), IDC_PROP, MF_GRAYED);
EnableMenuItem(Info->hShortcutMenu, IDC_PROP, MF_GRAYED);
+
+ /* create seperate thread to emum devices */
+ DevEnumThread = CreateThread(NULL,
+ 0,
+ DeviceEnumThread,
+ &Info->hTreeView,
+ 0,
+ NULL);
+ if (!DevEnumThread)
+ {
+ DisplayString(_T("Failed to enumerate devices"));
+ break;
+ }
+
+ CloseHandle(DevEnumThread);
}
break;
Modified: trunk/reactos/base/applications/devmgmt/misc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/devmgmt/…
==============================================================================
--- trunk/reactos/base/applications/devmgmt/misc.c (original)
+++ trunk/reactos/base/applications/devmgmt/misc.c Wed Oct 18 19:50:05 2006
@@ -248,7 +248,7 @@
0,
NULL );
- MessageBox(NULL, (LPTSTR)lpMsgBuf, _T("Error!"), MB_OK | MB_ICONERROR);
+ MessageBox(NULL, lpMsgBuf, _T("Error!"), MB_OK | MB_ICONERROR);
LocalFree(lpMsgBuf);
}
Modified: trunk/reactos/base/applications/devmgmt/precomp.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/devmgmt/…
==============================================================================
--- trunk/reactos/base/applications/devmgmt/precomp.h (original)
+++ trunk/reactos/base/applications/devmgmt/precomp.h Wed Oct 18 19:50:05 2006
@@ -111,10 +111,6 @@
UINT Height);
VOID GetError(VOID);
-
-VOID DisplayString(PTCHAR);
-
-VOID TimerInfo(LPTSTR);
-
+VOID DisplayString(LPTSTR);
#endif /* __DEVMGMT_PRECOMP_H */