mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
added a test app to test some (currently unimplemented) dialog functions
svn path=/trunk/; revision=6713
This commit is contained in:
parent
96d89d4dfa
commit
7c0860d405
6 changed files with 160 additions and 1 deletions
|
@ -15,7 +15,7 @@ mktime mstest multiwin mutex nptest patblt pipe primitives pteb regtest \
|
|||
sectest sertest shaptest shm statst statst2 stretchblt suspend \
|
||||
tcpsvr terminate txtscale thread thread_msg tokentest vmtest \
|
||||
winhello winhello2 wm_erasebkgnd wm_paint eventpair threadwait \
|
||||
map_dup_inherit p_dup_handle apc2 enhmetafile
|
||||
map_dup_inherit p_dup_handle apc2 enhmetafile dirdlg guithreadinfo
|
||||
|
||||
TEST_MISC =
|
||||
|
||||
|
|
6
reactos/apps/tests/dirdlg/.cvsignore
Normal file
6
reactos/apps/tests/dirdlg/.cvsignore
Normal file
|
@ -0,0 +1,6 @@
|
|||
*.o
|
||||
*.d
|
||||
*.exe
|
||||
*.coff
|
||||
*.sym
|
||||
*.map
|
112
reactos/apps/tests/dirdlg/dirdlg.c
Normal file
112
reactos/apps/tests/dirdlg/dirdlg.c
Normal file
|
@ -0,0 +1,112 @@
|
|||
#include <windows.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <io.h>
|
||||
#include "resource.h"
|
||||
|
||||
static char selected[MAX_PATH + 1];
|
||||
|
||||
BOOL
|
||||
CALLBACK
|
||||
DlgMainProc(
|
||||
HWND hwndDlg,
|
||||
UINT uMsg,
|
||||
WPARAM wParam,
|
||||
LPARAM lParam
|
||||
)
|
||||
{
|
||||
char dir[MAX_PATH + 1];
|
||||
|
||||
switch(uMsg)
|
||||
{
|
||||
case WM_COMMAND:
|
||||
{
|
||||
switch(HIWORD(wParam))
|
||||
{
|
||||
case LBN_DBLCLK:
|
||||
{
|
||||
switch(LOWORD(wParam))
|
||||
{
|
||||
case IDC_DIRS:
|
||||
{
|
||||
if(DlgDirSelectEx(hwndDlg, dir, MAX_PATH, IDC_DIRS))
|
||||
{
|
||||
chdir(dir);
|
||||
GetCurrentDirectory(MAX_PATH, dir);
|
||||
DlgDirList(hwndDlg, dir, IDC_DIRS, IDC_DIREDIT, DDL_DIRECTORY | DDL_DRIVES);
|
||||
}
|
||||
else
|
||||
{
|
||||
SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_OK, 0), 0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
switch(LOWORD(wParam))
|
||||
{
|
||||
case IDC_OK:
|
||||
{
|
||||
char file[MAX_PATH + 1];
|
||||
int len;
|
||||
|
||||
if(!DlgDirSelectEx(hwndDlg, file, MAX_PATH, IDC_DIRS))
|
||||
{
|
||||
GetCurrentDirectory(MAX_PATH, selected);
|
||||
len = strlen(selected);
|
||||
if(selected[len - 1] != '\\')
|
||||
{
|
||||
lstrcat(selected, "\\");
|
||||
}
|
||||
lstrcat(selected, file);
|
||||
EndDialog(hwndDlg, IDC_OK);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case IDC_CANCEL:
|
||||
{
|
||||
EndDialog(hwndDlg, IDC_CANCEL);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case WM_INITDIALOG:
|
||||
{
|
||||
SendDlgItemMessage(hwndDlg, IDC_DIRS, LB_SETCOLUMNWIDTH, 150, 0);
|
||||
GetCurrentDirectory(MAX_PATH, dir);
|
||||
DlgDirList(hwndDlg, dir, IDC_DIRS, IDC_DIREDIT, DDL_DIRECTORY | DDL_DRIVES);
|
||||
SetFocus(GetDlgItem(hwndDlg, IDC_DIRS));
|
||||
break;
|
||||
}
|
||||
case WM_CLOSE:
|
||||
{
|
||||
EndDialog(hwndDlg, IDC_CANCEL);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
int WINAPI
|
||||
WinMain(
|
||||
HINSTANCE hInstance,
|
||||
HINSTANCE hPrevInstance,
|
||||
LPSTR lpszCmdLine,
|
||||
int nCmdShow)
|
||||
{
|
||||
char str[MAX_PATH + 32];
|
||||
if(DialogBox(hInstance, MAKEINTRESOURCE(IDD_MAIN), 0, DlgMainProc) == IDC_OK)
|
||||
{
|
||||
sprintf(str, "You selected \"%s\"", selected);
|
||||
MessageBox(0, str, "Selected file", MB_ICONINFORMATION);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
14
reactos/apps/tests/dirdlg/dirdlg.rc
Normal file
14
reactos/apps/tests/dirdlg/dirdlg.rc
Normal file
|
@ -0,0 +1,14 @@
|
|||
#include <defines.h>
|
||||
#include <reactos/resource.h>
|
||||
#include "resource.h"
|
||||
|
||||
IDD_MAIN DIALOG DISCARDABLE 20, 20, 220, 140
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
|
||||
FONT 8, "MS Sans Serif"
|
||||
CAPTION "Select a file"
|
||||
BEGIN
|
||||
EDITTEXT IDC_DIREDIT, 5, 5, 210, 13, ES_READONLY | ES_LEFT | WS_CHILD | WS_VISIBLE | WS_TABSTOP
|
||||
LISTBOX IDC_DIRS, 5, 23, 210, 92, LBS_NOTIFY | LBS_NOINTEGRALHEIGHT | LBS_MULTICOLUMN | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_VSCROLL | WS_HSCROLL
|
||||
PUSHBUTTON "&OK", IDC_OK, 60, 120, 40, 15, BS_DEFPUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP
|
||||
PUSHBUTTON "&Cancel", IDC_CANCEL, 120, 120, 40, 15, WS_CHILD | WS_VISIBLE | WS_TABSTOP
|
||||
END
|
21
reactos/apps/tests/dirdlg/makefile
Normal file
21
reactos/apps/tests/dirdlg/makefile
Normal file
|
@ -0,0 +1,21 @@
|
|||
PATH_TO_TOP = ../../..
|
||||
|
||||
TARGET_NORC = no
|
||||
|
||||
TARGET_TYPE = program
|
||||
|
||||
TARGET_APPTYPE = windows
|
||||
|
||||
TARGET_NAME = dirdlg
|
||||
|
||||
TARGET_SDKLIBS = ntdll.a kernel32.a gdi32.a
|
||||
|
||||
TARGET_OBJECTS = $(TARGET_NAME).o
|
||||
|
||||
TARGET_CFLAGS = -Wall -Werror
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
include $(TOOLS_PATH)/helper.mk
|
||||
|
||||
# EOF
|
6
reactos/apps/tests/dirdlg/resource.h
Normal file
6
reactos/apps/tests/dirdlg/resource.h
Normal file
|
@ -0,0 +1,6 @@
|
|||
#define IDD_MAIN 101
|
||||
|
||||
#define IDC_OK 1
|
||||
#define IDC_CANCEL 2
|
||||
#define IDC_DIRS 100
|
||||
#define IDC_DIREDIT 101
|
Loading…
Reference in a new issue