add all test dlls into the treeview

svn path=/trunk/; revision=34022
This commit is contained in:
Ged Murphy 2008-06-19 08:36:17 +00:00
parent ab6d5a14d6
commit b790fafdb2
9 changed files with 92 additions and 42 deletions

View file

@ -3,9 +3,9 @@
#include "resource.h" #include "resource.h"
#define REACTOS_STR_FILE_DESCRIPTION "ReactOS Character Map\0" #define REACTOS_STR_FILE_DESCRIPTION "ReactOS API test GUI\0"
#define REACTOS_STR_INTERNAL_NAME "charmap\0" #define REACTOS_STR_INTERNAL_NAME "WinetestsGUI\0"
#define REACTOS_STR_ORIGINAL_FILENAME "charmap.exe\0" #define REACTOS_STR_ORIGINAL_FILENAME "WinetestsGUI.exe\0"
//#include <reactos/version.rc> //#include <reactos/version.rc>
#include "rsrc.rc" #include "rsrc.rc"

View file

@ -1,5 +1,5 @@
/* /*
* PROJECT: ReactOS Character Map * PROJECT: ReactOS API Test GUI
* LICENSE: GPL - See COPYING in the top level directory * LICENSE: GPL - See COPYING in the top level directory
* FILE: * FILE:
* PURPOSE: browse dialog implementation * PURPOSE: browse dialog implementation
@ -10,6 +10,10 @@
#include <precomp.h> #include <precomp.h>
#define DLL_SEARCH_DIR L"\\Debug\\testlibs\\*" #define DLL_SEARCH_DIR L"\\Debug\\testlibs\\*"
#define IL_MAIN 0
#define IL_TEST 1
typedef wchar_t *(__cdecl *DLLNAME)();
static INT static INT
GetNumberOfDllsInFolder(LPWSTR lpFolder) GetNumberOfDllsInFolder(LPWSTR lpFolder)
@ -128,31 +132,67 @@ InsertIntoTreeView(HWND hTreeView,
static VOID static VOID
PopulateTreeView(PMAIN_WND_INFO pInfo) PopulateTreeView(PMAIN_WND_INFO pInfo)
{ {
HWND hTreeView;
HTREEITEM hRoot; HTREEITEM hRoot;
HBITMAP hComp; HIMAGELIST hImgList;
TCHAR ComputerName[MAX_PATH]; DLLNAME GetTestName;
DWORD dwSize = MAX_PATH; HMODULE hDll;
INT RootImage; LPWSTR lpDllPath;
LPWSTR lpTestName;
INT RootImage, i;
hTreeView = GetDlgItem(pInfo->hBrowseDlg, IDC_TREEVIEW); pInfo->hBrowseTV = GetDlgItem(pInfo->hBrowseDlg, IDC_TREEVIEW);
(void)TreeView_DeleteAllItems(hTreeView); (void)TreeView_DeleteAllItems(pInfo->hBrowseTV);
hImgList = InitImageList(IDI_ICON,
IDI_TESTS,
16,
16);
if (!hImgList) return;
(void)TreeView_SetImageList(pInfo->hBrowseTV,
hImgList,
TVSIL_NORMAL);
/* insert the root item into the tree */ /* insert the root item into the tree */
hRoot = InsertIntoTreeView(hTreeView, hRoot = InsertIntoTreeView(pInfo->hBrowseTV,
NULL, NULL,
ComputerName, L"Full",
NULL, NULL,
0);//RootImage); IL_MAIN);
for (i = 0; i < pInfo->numDlls; i++)
{
lpDllPath = pInfo->lpDllList + (MAX_PATH * i);
hDll = LoadLibraryW(lpDllPath);
if (hDll)
{
GetTestName = (DLLNAME)GetProcAddress(hDll, "GetTestName");
if (GetTestName)
{
lpTestName = GetTestName();
InsertIntoTreeView(pInfo->hBrowseTV,
hRoot,
lpTestName,
lpDllPath,
IL_TEST);
// add individual tests as children
}
FreeLibrary(hDll);
}
}
} }
static VOID static VOID
PopulateTestList(PMAIN_WND_INFO pInfo) PopulateTestList(PMAIN_WND_INFO pInfo)
{ {
INT numFiles; pInfo->numDlls = GetListOfTestDlls(pInfo);
if (pInfo->numDlls)
if ((numFiles = GetListOfTestDlls(pInfo)))
{ {
PopulateTreeView(pInfo); PopulateTreeView(pInfo);
} }

View file

@ -1,5 +1,5 @@
/* /*
* PROJECT: ReactOS Character Map * PROJECT: ReactOS API Test GUI
* LICENSE: GPL - See COPYING in the top level directory * LICENSE: GPL - See COPYING in the top level directory
* FILE: * FILE:
* PURPOSE: main dialog implementation * PURPOSE: main dialog implementation

View file

@ -1,5 +1,5 @@
/* /*
* PROJECT: ReactOS Services * PROJECT: ReactOS API Test GUI
* LICENSE: GPL - See COPYING in the top level directory * LICENSE: GPL - See COPYING in the top level directory
* FILE: * FILE:
* PURPOSE: miscallanous functions * PURPOSE: miscallanous functions
@ -221,7 +221,7 @@ InitImageList(UINT StartResource,
UINT Width, UINT Width,
UINT Height) UINT Height)
{ {
HBITMAP hBitmap; HICON hIcon;
HIMAGELIST hImageList; HIMAGELIST hImageList;
UINT i; UINT i;
INT Ret; INT Ret;
@ -229,7 +229,7 @@ InitImageList(UINT StartResource,
/* Create the toolbar icon image list */ /* Create the toolbar icon image list */
hImageList = ImageList_Create(Width, hImageList = ImageList_Create(Width,
Height, Height,
ILC_MASK | ILC_COLOR24, ILC_MASK | ILC_COLOR32,
EndResource - StartResource, EndResource - StartResource,
0); 0);
if (hImageList == NULL) if (hImageList == NULL)
@ -238,23 +238,26 @@ InitImageList(UINT StartResource,
/* Add all icons to the image list */ /* Add all icons to the image list */
for (i = StartResource; i <= EndResource; i++) for (i = StartResource; i <= EndResource; i++)
{ {
hBitmap = (HBITMAP)LoadImage(hInstance, hIcon = (HBITMAP)LoadImage(hInstance,
MAKEINTRESOURCE(i), MAKEINTRESOURCE(i),
IMAGE_BITMAP, IMAGE_ICON,
Width, Width,
Height, Height,
LR_LOADTRANSPARENT); LR_DEFAULTCOLOR);
if (hBitmap == NULL) if (hIcon == NULL)
return NULL; goto fail;
Ret = ImageList_AddMasked(hImageList, Ret = ImageList_AddIcon(hImageList,
hBitmap, hIcon);
RGB(255, 0, 128));
if (Ret == -1) if (Ret == -1)
return NULL; goto fail;
DeleteObject(hBitmap); DestroyIcon(hIcon);
} }
return hImageList; return hImageList;
fail:
ImageList_Destroy(hImageList);
return NULL;
} }

View file

@ -13,6 +13,7 @@ typedef struct _MAIN_WND_INFO
{ {
HWND hMainWnd; HWND hMainWnd;
HWND hBrowseDlg; HWND hBrowseDlg;
HWND hBrowseTV;
HWND hStatus; HWND hStatus;
int nCmdShow; int nCmdShow;
@ -25,14 +26,19 @@ typedef struct _MAIN_WND_INFO
BOOL bIsUserAnAdmin; BOOL bIsUserAnAdmin;
LPWSTR lpDllList; LPWSTR lpDllList;
INT numDlls;
} MAIN_WND_INFO, *PMAIN_WND_INFO; } MAIN_WND_INFO, *PMAIN_WND_INFO;
/* dll exports */
wchar_t *GetTestName();
/* browsewnd.c */ /* browsewnd.c */
BOOL CALLBACK BrowseDlgProc(HWND hDlg, UINT Message, WPARAM wParam, LPARAM lParam); BOOL CALLBACK BrowseDlgProc(HWND hDlg, UINT Message, WPARAM wParam, LPARAM lParam);
/* misc.c */ /* misc.c */
HIMAGELIST InitImageList(UINT StartResource, UINT EndResource, UINT Width, UINT Height);
VOID DisplayString(LPWSTR lpMsg); VOID DisplayString(LPWSTR lpMsg);
VOID DisplayError(INT err); VOID DisplayError(INT err);

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

View file

@ -3,7 +3,7 @@
#define IDM_ABOUT 104 #define IDM_ABOUT 104
#define IDM_EXIT 105 #define IDM_EXIT 105
#define IDI_ICON 107 #define IDI_ICON 107
#define IDI_SMALL 108 #define IDI_TESTS 108
#define IDC_DELETE 109 #define IDC_DELETE 109
#define IDR_MAINFRAME 128 #define IDR_MAINFRAME 128
#define IDC_LIST 1000 #define IDC_LIST 1000

View file

@ -3,7 +3,8 @@
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
IDI_ICON ICON "res/charmap.ico" IDI_ICON ICON "res/main.ico"
IDI_TESTS ICON "res/tests.ico"
//#include "lang/bg-BG.rc" //#include "lang/bg-BG.rc"
//#include "lang/ca-ES.rc" //#include "lang/ca-ES.rc"