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"
#define REACTOS_STR_FILE_DESCRIPTION "ReactOS Character Map\0"
#define REACTOS_STR_INTERNAL_NAME "charmap\0"
#define REACTOS_STR_ORIGINAL_FILENAME "charmap.exe\0"
#define REACTOS_STR_FILE_DESCRIPTION "ReactOS API test GUI\0"
#define REACTOS_STR_INTERNAL_NAME "WinetestsGUI\0"
#define REACTOS_STR_ORIGINAL_FILENAME "WinetestsGUI.exe\0"
//#include <reactos/version.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
* FILE:
* PURPOSE: browse dialog implementation
@ -10,6 +10,10 @@
#include <precomp.h>
#define DLL_SEARCH_DIR L"\\Debug\\testlibs\\*"
#define IL_MAIN 0
#define IL_TEST 1
typedef wchar_t *(__cdecl *DLLNAME)();
static INT
GetNumberOfDllsInFolder(LPWSTR lpFolder)
@ -128,31 +132,67 @@ InsertIntoTreeView(HWND hTreeView,
static VOID
PopulateTreeView(PMAIN_WND_INFO pInfo)
{
HWND hTreeView;
HTREEITEM hRoot;
HBITMAP hComp;
TCHAR ComputerName[MAX_PATH];
DWORD dwSize = MAX_PATH;
INT RootImage;
HIMAGELIST hImgList;
DLLNAME GetTestName;
HMODULE hDll;
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);
/* insert the root item into the tree */
hRoot = InsertIntoTreeView(hTreeView,
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 */
hRoot = InsertIntoTreeView(pInfo->hBrowseTV,
NULL,
ComputerName,
L"Full",
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
PopulateTestList(PMAIN_WND_INFO pInfo)
{
INT numFiles;
if ((numFiles = GetListOfTestDlls(pInfo)))
pInfo->numDlls = GetListOfTestDlls(pInfo);
if (pInfo->numDlls)
{
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
* FILE:
* 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
* FILE:
* PURPOSE: miscallanous functions
@ -221,15 +221,15 @@ InitImageList(UINT StartResource,
UINT Width,
UINT Height)
{
HBITMAP hBitmap;
HICON hIcon;
HIMAGELIST hImageList;
UINT i;
INT Ret;
INT Ret;
/* Create the toolbar icon image list */
hImageList = ImageList_Create(Width,
Height,
ILC_MASK | ILC_COLOR24,
ILC_MASK | ILC_COLOR32,
EndResource - StartResource,
0);
if (hImageList == NULL)
@ -238,23 +238,26 @@ InitImageList(UINT StartResource,
/* Add all icons to the image list */
for (i = StartResource; i <= EndResource; i++)
{
hBitmap = (HBITMAP)LoadImage(hInstance,
MAKEINTRESOURCE(i),
IMAGE_BITMAP,
Width,
Height,
LR_LOADTRANSPARENT);
if (hBitmap == NULL)
return NULL;
hIcon = (HBITMAP)LoadImage(hInstance,
MAKEINTRESOURCE(i),
IMAGE_ICON,
Width,
Height,
LR_DEFAULTCOLOR);
if (hIcon == NULL)
goto fail;
Ret = ImageList_AddMasked(hImageList,
hBitmap,
RGB(255, 0, 128));
Ret = ImageList_AddIcon(hImageList,
hIcon);
if (Ret == -1)
return NULL;
goto fail;
DeleteObject(hBitmap);
DestroyIcon(hIcon);
}
return hImageList;
fail:
ImageList_Destroy(hImageList);
return NULL;
}

View file

@ -11,10 +11,11 @@ extern HINSTANCE hInstance;
typedef struct _MAIN_WND_INFO
{
HWND hMainWnd;
HWND hBrowseDlg;
HWND hStatus;
int nCmdShow;
HWND hMainWnd;
HWND hBrowseDlg;
HWND hBrowseTV;
HWND hStatus;
int nCmdShow;
HICON hSmIcon;
HICON hBgIcon;
@ -25,14 +26,19 @@ typedef struct _MAIN_WND_INFO
BOOL bIsUserAnAdmin;
LPWSTR lpDllList;
INT numDlls;
} MAIN_WND_INFO, *PMAIN_WND_INFO;
/* dll exports */
wchar_t *GetTestName();
/* browsewnd.c */
BOOL CALLBACK BrowseDlgProc(HWND hDlg, UINT Message, WPARAM wParam, LPARAM lParam);
/* misc.c */
HIMAGELIST InitImageList(UINT StartResource, UINT EndResource, UINT Width, UINT Height);
VOID DisplayString(LPWSTR lpMsg);
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_EXIT 105
#define IDI_ICON 107
#define IDI_SMALL 108
#define IDI_TESTS 108
#define IDC_DELETE 109
#define IDR_MAINFRAME 128
#define IDC_LIST 1000

View file

@ -3,7 +3,8 @@
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/ca-ES.rc"