ReactOS 0.4.15-dev-5669-g09dde2c
dirdlg.c File Reference
#include <windows.h>
#include <string.h>
#include <stdio.h>
#include <io.h>
#include "resource.h"
Include dependency graph for dirdlg.c:

Go to the source code of this file.

Functions

INT_PTR CALLBACK DlgMainProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdLine, int nCmdShow)
 

Variables

static char selected [MAX_PATH+1]
 

Function Documentation

◆ DlgMainProc()

INT_PTR CALLBACK DlgMainProc ( HWND  hwndDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 11 of file dirdlg.c.

17{
18 char dir[MAX_PATH + 1];
19
20 switch(uMsg)
21 {
22 case WM_COMMAND:
23 {
24 switch(HIWORD(wParam))
25 {
26 case LBN_DBLCLK:
27 {
28 switch(LOWORD(wParam))
29 {
30 case IDC_DIRS:
31 {
32 if(DlgDirSelectEx(hwndDlg, dir, MAX_PATH, IDC_DIRS))
33 {
34 chdir(dir);
37 }
38 else
39 {
40 SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_OK, 0), 0);
41 }
42 break;
43 }
44 }
45 break;
46 }
47 default:
48 {
49 switch(LOWORD(wParam))
50 {
51 case IDC_OK:
52 {
53 char file[MAX_PATH + 1];
54 int len;
55
56 if(!DlgDirSelectEx(hwndDlg, file, MAX_PATH, IDC_DIRS))
57 {
60 if(strlen(file))
61 {
62 if(selected[len - 1] != '\\')
63 {
64 lstrcat(selected, "\\");
65 }
67 EndDialog(hwndDlg, IDC_OK);
68 }
69 }
70 break;
71 }
72 case IDC_CANCEL:
73 {
74 EndDialog(hwndDlg, IDC_CANCEL);
75 break;
76 }
77 }
78 break;
79 }
80 }
81 break;
82 }
83 case WM_INITDIALOG:
84 {
88 SetFocus(GetDlgItem(hwndDlg, IDC_DIRS));
89 break;
90 }
91 case WM_CLOSE:
92 {
93 EndDialog(hwndDlg, IDC_CANCEL);
94 return TRUE;
95 }
96 }
97 return FALSE;
98}
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
unsigned int dir
Definition: maze.c:112
#define IDC_OK
Definition: resource.h:59
#define IDC_CANCEL
Definition: resource.h:60
WPARAM wParam
Definition: combotst.c:138
static char selected[MAX_PATH+1]
Definition: dirdlg.c:7
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define MAX_PATH
Definition: compat.h:34
GLenum GLsizei len
Definition: glext.h:6722
#define IDC_DIREDIT
Definition: resource.h:6
#define IDC_DIRS
Definition: resource.h:5
#define chdir
Definition: syshdrs.h:69
#define LOWORD(l)
Definition: pedump.c:82
Definition: fci.c:127
#define HIWORD(l)
Definition: typedefs.h:247
#define lstrcat
Definition: winbase.h:3742
#define GetCurrentDirectory
Definition: winbase.h:3676
#define MAKEWPARAM(l, h)
Definition: winuser.h:3999
#define WM_CLOSE
Definition: winuser.h:1611
#define LBN_DBLCLK
Definition: winuser.h:2061
#define WM_COMMAND
Definition: winuser.h:1730
#define DlgDirList
Definition: winuser.h:5756
#define DDL_DRIVES
Definition: winuser.h:425
#define WM_INITDIALOG
Definition: winuser.h:1729
#define DlgDirSelectEx
Definition: winuser.h:5759
#define LB_SETCOLUMNWIDTH
Definition: winuser.h:2051
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
HWND WINAPI SetFocus(_In_opt_ HWND)
#define DDL_DIRECTORY
Definition: winuser.h:422
#define SendMessage
Definition: winuser.h:5833
#define SendDlgItemMessage
Definition: winuser.h:5832
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)

Referenced by WinMain().

◆ WinMain()

int WINAPI WinMain ( HINSTANCE  hInstance,
HINSTANCE  hPrevInstance,
LPSTR  lpszCmdLine,
int  nCmdShow 
)

Definition at line 101 of file dirdlg.c.

106{
107 char str[MAX_PATH + 32];
109 {
110 sprintf(str, "You selected \"%s\"", selected);
111 MessageBox(0, str, "Selected file", MB_ICONINFORMATION);
112 }
113 return 0;
114}
#define IDD_MAIN
Definition: resource.h:106
HINSTANCE hInstance
Definition: charmap.c:19
INT_PTR CALLBACK DlgMainProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: dirdlg.c:11
#define sprintf(buf, format,...)
Definition: sprintf.c:55
const WCHAR * str
#define MessageBox
Definition: winuser.h:5812
#define MB_ICONINFORMATION
Definition: winuser.h:796
#define MAKEINTRESOURCE
Definition: winuser.h:591
#define DialogBox
Definition: winuser.h:5751

Variable Documentation

◆ selected