Project: FFFTP
Code Location: git://git.sourceforge.jp/gitroot/ffftp/ffftp.gitmaster
Browse
/
Download File
bookmark.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
/*=============================================================================
*
*								�u�b�N�}�[�N
*
===============================================================================
/ Copyright (C) 1997-2007 Sota. All rights reserved.
/
/ Redistribution and use in source and binary forms, with or without 
/ modification, are permitted provided that the following conditions 
/ are met:
/
/  1. Redistributions of source code must retain the above copyright 
/     notice, this list of conditions and the following disclaimer.
/  2. Redistributions in binary form must reproduce the above copyright 
/     notice, this list of conditions and the following disclaimer in the 
/     documentation and/or other materials provided with the distribution.
/
/ THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 
/ IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 
/ OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
/ IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 
/ INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 
/ BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 
/ USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 
/ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
/ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 
/ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/============================================================================*/

#define WINVER 0x400

#define	STRICT
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <mbstring.h>
#include <malloc.h>
#include <windowsx.h>
#include <commctrl.h>

#include "common.h"
#include "resource.h"

#include <htmlhelp.h>
#include "helpid.h"


/*===== �v���g�^�C�v =====*/

static int AddBookMark(char *Path);
static int GetBothPath(char *Str, char **Path1, char **Path2);
static BOOL CALLBACK EditBookMarkProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
static BOOL CALLBACK BookMarkEditCallBack(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam);

/*===== �O���Q�� =====*/

extern HWND hHelpWin;

/* �ݒ�l */
extern HFONT ListFont;		/* ���X�g�{�b�N�X�̃t�H���g */
extern SIZE BmarkDlgSize;



/*----- �u�b�N�}�[�N���N���A���� ----------------------------------------------
*
*	Parameter
*		�Ȃ�
*
*	Return Value
*		�Ȃ�
*----------------------------------------------------------------------------*/

void ClearBookMark(void)
{
	HMENU hMenu;

	hMenu = GetSubMenu(GetMenu(GetMainHwnd()), BMARK_SUB_MENU);
	while(GetMenuItemCount(hMenu) > DEFAULT_BMARK_ITEM)
		DeleteMenu(hMenu, DEFAULT_BMARK_ITEM, MF_BYPOSITION);
	return;
}


/*----- �J�����g�f�B���N�g�����u�b�N�}�[�N�ɒlj� ------------------------------
*
*	Parameter
*		int Win : �E�C���h�E�ԍ� (WIN_xxx)
*
*	Return Value
*		�Ȃ�
*----------------------------------------------------------------------------*/

void AddCurDirToBookMark(int Win)
{
	char Buf[BMARK_MARK_LEN + FMAX_PATH * 2 + BMARK_SEP_LEN + 1];

	if(Win == WIN_LOCAL)
	{
		strcpy(Buf, BMARK_MARK_LOCAL);
		AskLocalCurDir(Buf + BMARK_MARK_LEN, FMAX_PATH);
	}
	else if(Win == WIN_REMOTE)
	{
		strcpy(Buf, BMARK_MARK_REMOTE);
		AskRemoteCurDir(Buf + BMARK_MARK_LEN, FMAX_PATH);
	}
	else
	{
		strcpy(Buf, BMARK_MARK_BOTH);
		AskLocalCurDir(Buf + BMARK_MARK_LEN, FMAX_PATH);
		strcat(Buf, BMARK_SEP);
		AskRemoteCurDir(Buf + strlen(Buf), FMAX_PATH);
	}
	AddBookMark(Buf);
	return;
}


/*----- �u�b�N�}�[�N�Ƀp�X��o�^���� ------------------------------------------
*
*	Parameter
*		char *Path : �p�X��
*
*	Return Value
*		int �X�e�[�^�X
*			SUCCESS/FAIL
*----------------------------------------------------------------------------*/

static int AddBookMark(char *Path)
{
	HMENU hMenu;
	int MarkID;
	int Sts;

	Sts = FAIL;
	hMenu = GetSubMenu(GetMenu(GetMainHwnd()), BMARK_SUB_MENU);
	MarkID = (GetMenuItemCount(hMenu) - DEFAULT_BMARK_ITEM) + MENU_BMARK_TOP;
	if(AppendMenu(hMenu, MF_STRING, MarkID, Path) == TRUE)
		Sts = SUCCESS;
	return(Sts);
}


/*----- �w���ID�����ƒu�b�N�}�[�N�̃p�X��Ԃ� --------------------------------
*
*	Parameter
*		int MarkID : ID
*		char *Local : ���[�J�����̃p�X��Ԃ��o�b�t�@
*		char *Remote : �����[�g���̃p�X��Ԃ��o�b�t�@
*		int Max : �o�b�t�@�̃T�C�Y
*
*	Return Value
*		int �X�e�[�^�X (BMARK_TYPE_xxx)
*----------------------------------------------------------------------------*/

int AskBookMarkText(int MarkID, char *Local, char *Remote, int Max)
{
	HMENU hMenu;
	MENUITEMINFO mInfo;
	int Sts;
	char Tmp[BMARK_MARK_LEN + FMAX_PATH * 2 + BMARK_SEP_LEN + 1];
	char *Path1;
	char *Path2;
	int Num;

	memset(Local, NUL, Max);
	memset(Remote, NUL, Max);

	Sts = BMARK_TYPE_NONE;
	hMenu = GetSubMenu(GetMenu(GetMainHwnd()), BMARK_SUB_MENU);

	mInfo.cbSize = sizeof(MENUITEMINFO);
	mInfo.fMask = MIIM_TYPE;
	mInfo.dwTypeData = Tmp;
	mInfo.cch = BMARK_MARK_LEN + FMAX_PATH * 2 + BMARK_SEP_LEN;
	if(GetMenuItemInfo(hMenu, MarkID, FALSE, &mInfo) == TRUE)
	{
		Num = GetBothPath(Tmp, &Path1, &Path2);
		if(strncmp(Tmp, BMARK_MARK_LOCAL, BMARK_MARK_LEN) == 0)
		{
			Sts = BMARK_TYPE_LOCAL;
			strncpy(Local, Path1, Max-1);
		}
		else if(strncmp(Tmp, BMARK_MARK_REMOTE, BMARK_MARK_LEN) == 0)
		{
			Sts = BMARK_TYPE_REMOTE;
			strncpy(Remote, Path1, Max-1);
		}
		else if(strncmp(Tmp, BMARK_MARK_BOTH, BMARK_MARK_LEN) == 0)
		{
			if(Num == 2)
			{
				strncpy(Local, Path1, Max-1);
				strncpy(Remote, Path2, Max-1);
				Sts = BMARK_TYPE_BOTH;
			}
		}
	}
	return(Sts);
}


/*----- �u�b�N�}�[�N�̕�������Q�‚̃p�X�����o�� --------------------------
*
*	Parameter
*		char *Str : ������
*		char **Local : ���[�J�����̃p�X�̐擪��Ԃ����[�N
*		char **Remote : �����[�g���̃p�X�̐擪��Ԃ����[�N
*
*	Return Value
*		int �p�X�̌� (1 or 2)
*
*	Note
*		Str�̓��e������������
*----------------------------------------------------------------------------*/

static int GetBothPath(char *Str, char **Path1, char **Path2)
{
	char *Pos;
	int Ret;

	Ret = 1;
	*Path1 = Str + BMARK_MARK_LEN;

	Pos = _mbsstr(Str, BMARK_SEP);
	if(Pos != NULL)
	{
		Ret = 2;
		*Pos = NUL;
		*Path2 = Pos + BMARK_SEP_LEN;
	}
	return(Ret);
}


/*----- �u�b�N�}�[�N��ڑ����̃z�X�g���X�g�ɕۑ����� --------------------------
*
*	Parameter
*		�Ȃ�
*
*	Return Value
*		�Ȃ�
*----------------------------------------------------------------------------*/

void SaveBookMark(void)
{
	HMENU hMenu;
	MENUITEMINFO mInfo;
	int i;
	int Cnt;
	char *Buf;
	char *Pos;
	int Len;
	char Tmp[BMARK_MARK_LEN + FMAX_PATH * 2 + BMARK_SEP_LEN + 1];
	int CurHost;

	if(AskConnecting() == YES)
	{
		if((CurHost = AskCurrentHost()) != HOSTNUM_NOENTRY)
		{
			if((Buf = malloc(BOOKMARK_SIZE)) != NULL)
			{
				hMenu = GetSubMenu(GetMenu(GetMainHwnd()), BMARK_SUB_MENU);

				Pos = Buf;
				Len = 0;
				Cnt = GetMenuItemCount(hMenu);
				for(i = DEFAULT_BMARK_ITEM; i < Cnt; i++)
				{
					mInfo.cbSize = sizeof(MENUITEMINFO);
					mInfo.fMask = MIIM_TYPE;
					mInfo.dwTypeData = Tmp;
					mInfo.cch = FMAX_PATH;
					if(GetMenuItemInfo(hMenu, i, TRUE, &mInfo) == TRUE)
					{
						if(Len + strlen(Tmp) + 2 <= BOOKMARK_SIZE)
						{
							strcpy(Pos, Tmp);
							Pos += strlen(Tmp) + 1;
							Len += strlen(Tmp) + 1;
						}
					}
				}

				if(Pos == Buf)
				{
					memset(Buf, NUL, 2);
					Len = 2;
				}
				else
				{
					*Pos = NUL;
					Len++;
				}

				SetHostBookMark(CurHost, Buf, Len);

				free(Buf);
			}
		}
	}
	return;
}


/*----- �z�X�g���X�g����u�b�N�}�[�N��ǂݍ��� --------------------------------
*
*	Parameter
*		�Ȃ�
*
*	Return Value
*		�Ȃ�
*----------------------------------------------------------------------------*/

void LoadBookMark(void)
{
	char *Buf;
	char *Pos;
	int CurHost;
	char Tmp[FMAX_PATH + BMARK_MARK_LEN + 1];

	if(AskConnecting() == YES)
	{
		if((CurHost = AskCurrentHost()) != HOSTNUM_NOENTRY)
		{
			if((Buf = AskHostBookMark(CurHost)) != NULL)
			{
				ClearBookMark();
				Pos = Buf;
				while(*Pos != NUL)
				{
					/* ���t�H�[�}�b�g�̂��߂̏��� */
					/* �i�p�X��"L"��"H"���‚��ĂȂ����j */
					if((strncmp(Pos, BMARK_MARK_LOCAL, BMARK_MARK_LEN) != 0) &&
					   (strncmp(Pos, BMARK_MARK_REMOTE, BMARK_MARK_LEN) != 0) &&
					   (strncmp(Pos, BMARK_MARK_BOTH, BMARK_MARK_LEN) != 0))
					{
						strcpy(Tmp, BMARK_MARK_REMOTE);
						strcat(Tmp, Pos);
						AddBookMark(Tmp);
					}
					else
						AddBookMark(Pos);

					Pos += strlen(Pos) + 1;
				}
			}
		}
	}
	return;
}


/*----- �u�b�N�}�[�N�ҏW�E�C���h�E --------------------------------------------
*
*	Parameter
*		�Ȃ�
*
*	Return Value
*		�X�e�[�^�X (YES=���s/NO=���)
*----------------------------------------------------------------------------*/

int EditBookMark(void)
{
	int Sts;

	Sts = DialogBox(GetFtpInst(), MAKEINTRESOURCE(bmark_dlg), GetMainHwnd(), EditBookMarkProc);
	return(Sts);
}


/*----- �u�b�N�}�[�N�ҏW�E�C���h�E�̃R�[���o�b�N ------------------------------
*
*	Parameter
*		HWND hDlg : �E�C���h�E�n���h��
*		UINT message : ���b�Z�[�W�ԍ�
*		WPARAM wParam : ���b�Z�[�W�� WPARAM ��
*		LPARAM lParam : ���b�Z�[�W�� LPARAM ��
*
*	Return Value
*		BOOL TRUE/FALSE
*----------------------------------------------------------------------------*/

static BOOL CALLBACK EditBookMarkProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
	HMENU hMenu;
	MENUITEMINFO mInfo;
	int Cur;
	int Max;
	char Tmp[BMARK_MARK_LEN + FMAX_PATH * 2 + BMARK_SEP_LEN + 1];

	static DIALOGSIZE DlgSize = {
		{ BMARK_NEW, BMARK_SET, BMARK_DEL, BMARK_DOWN, BMARK_UP, IDHELP, BMARK_SIZEGRIP, -1 },
		{ IDOK, BMARK_JUMP, BMARK_SIZEGRIP, -1 },
		{ BMARK_LIST, -1 },
		{ 0, 0 },
		{ 0, 0 }
	};

	switch (message)
	{
		case WM_INITDIALOG :
			if(ListFont != NULL)
				SendDlgItemMessage(hDlg, BMARK_LIST, WM_SETFONT, (WPARAM)ListFont, MAKELPARAM(TRUE, 0));

			hMenu = GetSubMenu(GetMenu(GetMainHwnd()), BMARK_SUB_MENU);
			Max = GetMenuItemCount(hMenu);
			for(Cur = DEFAULT_BMARK_ITEM; Cur < Max; Cur++)
			{
				mInfo.cbSize = sizeof(MENUITEMINFO);
				mInfo.fMask = MIIM_TYPE;
				mInfo.dwTypeData = Tmp;
				mInfo.cch = FMAX_PATH;
				if(GetMenuItemInfo(hMenu, Cur, TRUE, &mInfo) == TRUE)
					SendDlgItemMessage(hDlg, BMARK_LIST, LB_ADDSTRING, 0, (LPARAM)Tmp);
			}
			DlgSizeInit(hDlg, &DlgSize, &BmarkDlgSize);
		    return(TRUE);

		case WM_COMMAND :
			switch(GET_WM_COMMAND_ID(wParam, lParam))
			{
				case BMARK_JUMP :
					if((Cur = SendDlgItemMessage(hDlg, BMARK_LIST, LB_GETCURSEL, 0, 0)) != LB_ERR)
						PostMessage(GetMainHwnd(), WM_COMMAND, MAKEWPARAM(Cur+MENU_BMARK_TOP, 0), 0);
					/* ������ break �͂Ȃ� */

				case IDCANCEL :
				case IDOK :
					ClearBookMark();
					Max = SendDlgItemMessage(hDlg, BMARK_LIST, LB_GETCOUNT, 0, 0);
					for(Cur = 0; Cur < Max; Cur++)
					{
						SendDlgItemMessage(hDlg, BMARK_LIST, LB_GETTEXT, Cur, (LPARAM)Tmp);
						AddBookMark(Tmp);
					}
					AskDlgSize(hDlg, &DlgSize, &BmarkDlgSize);
					EndDialog(hDlg, YES);
					break;

				case BMARK_SET :
					if((Cur = SendDlgItemMessage(hDlg, BMARK_LIST, LB_GETCURSEL, 0, 0)) != LB_ERR)
					{
						SendDlgItemMessage(hDlg, BMARK_LIST, LB_GETTEXT, Cur, (LPARAM)Tmp);
						if(DialogBoxParam(GetFtpInst(), MAKEINTRESOURCE(bmark_edit_dlg), hDlg, BookMarkEditCallBack, (LPARAM)Tmp) == YES)
						{
							SendDlgItemMessage(hDlg, BMARK_LIST, LB_DELETESTRING, Cur, 0);
							SendDlgItemMessage(hDlg, BMARK_LIST, LB_INSERTSTRING, Cur, (LPARAM)Tmp);
							SendDlgItemMessage(hDlg, BMARK_LIST, LB_SETCURSEL, Cur, 0);
						}
					}
					break;

				case BMARK_NEW :
					strcpy(Tmp, "");
					if(DialogBoxParam(GetFtpInst(), MAKEINTRESOURCE(bmark_edit_dlg), hDlg, BookMarkEditCallBack, (LPARAM)Tmp) == YES)
					{
						SendDlgItemMessage(hDlg, BMARK_LIST, LB_ADDSTRING, 0, (LPARAM)Tmp);
						Cur = SendDlgItemMessage(hDlg, BMARK_LIST, LB_GETCOUNT, 0, 0) - 1;
						SendDlgItemMessage(hDlg, BMARK_LIST, LB_SETCURSEL, Cur, 0);
					}
					break;

				case BMARK_DEL :
					if((Cur = SendDlgItemMessage(hDlg, BMARK_LIST, LB_GETCURSEL, 0, 0)) != LB_ERR)
					{
						SendDlgItemMessage(hDlg, BMARK_LIST, LB_DELETESTRING, Cur, 0);
						if(Cur >= SendDlgItemMessage(hDlg, BMARK_LIST, LB_GETCOUNT, 0, 0))
							Cur = max1(0, SendDlgItemMessage(hDlg, BMARK_LIST, LB_GETCOUNT, 0, 0)-1);
						if(SendDlgItemMessage(hDlg, BMARK_LIST, LB_GETCOUNT, 0, 0) > 0)
							SendDlgItemMessage(hDlg, BMARK_LIST, LB_SETCURSEL, Cur, 0);
					}
					break;

				case BMARK_UP :
					if((Cur = SendDlgItemMessage(hDlg, BMARK_LIST, LB_GETCURSEL, 0, 0)) != LB_ERR)
					{
						if(Cur > 0)
						{
							SendDlgItemMessage(hDlg, BMARK_LIST, LB_GETTEXT, Cur, (LPARAM)Tmp);
							SendDlgItemMessage(hDlg, BMARK_LIST, LB_DELETESTRING, Cur, 0);
							SendDlgItemMessage(hDlg, BMARK_LIST, LB_INSERTSTRING, --Cur, (LPARAM)Tmp);
							SendDlgItemMessage(hDlg, BMARK_LIST, LB_SETCURSEL, Cur, 0);
						}
					}
					break;

				case BMARK_DOWN :
					if((Cur = SendDlgItemMessage(hDlg, BMARK_LIST, LB_GETCURSEL, 0, 0)) != LB_ERR)
					{
						if(Cur < SendDlgItemMessage(hDlg, BMARK_LIST, LB_GETCOUNT, 0, 0)-1)
						{
							SendDlgItemMessage(hDlg, BMARK_LIST, LB_GETTEXT, Cur, (LPARAM)Tmp);
							SendDlgItemMessage(hDlg, BMARK_LIST, LB_DELETESTRING, Cur, 0);
							SendDlgItemMessage(hDlg, BMARK_LIST, LB_INSERTSTRING, ++Cur, (LPARAM)Tmp);
							SendDlgItemMessage(hDlg, BMARK_LIST, LB_SETCURSEL, Cur, 0);
						}
					}
					break;

				case IDHELP :
					hHelpWin = HtmlHelp(NULL, AskHelpFilePath(), HH_HELP_CONTEXT, IDH_HELP_TOPIC_0000019);
					break;
			}
			return(TRUE);

		case WM_SIZING :
			DlgSizeChange(hDlg, &DlgSize, (RECT *)lParam, (int)wParam);
		    return(TRUE);

	}
    return(FALSE);
}


/*----- �u�b�N�}�[�N��̓_�C�A���O�̃R�[���o�b�N ------------------------------
*
*	Parameter
*		HWND hDlg : �E�C���h�E�n���h��
*		UINT message : ���b�Z�[�W�ԍ�
*		WPARAM wParam : ���b�Z�[�W�� WPARAM ��
*		LPARAM lParam : ���b�Z�[�W�� LPARAM ��
*
*	Return Value
*		BOOL TRUE/FALSE
*----------------------------------------------------------------------------*/

static BOOL CALLBACK BookMarkEditCallBack(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam)
{
	static char *Str;
	char *Path1;
	char *Path2;
	char Local[FMAX_PATH+1];
	char Remote[FMAX_PATH+1];
	int Num;

	switch (iMessage)
	{
		case WM_INITDIALOG :
			Str = (char *)lParam;
			SendDlgItemMessage(hDlg, BEDIT_LOCAL, EM_LIMITTEXT, FMAX_PATH-1, 0);
			SendDlgItemMessage(hDlg, BEDIT_REMOTE, EM_LIMITTEXT, FMAX_PATH-1, 0);
			if(strlen(Str) > BMARK_MARK_LEN)
			{
				Num = GetBothPath(Str, &Path1, &Path2);
				if(strncmp(Str, BMARK_MARK_LOCAL, BMARK_MARK_LEN) == 0)
					SendDlgItemMessage(hDlg, BEDIT_LOCAL, WM_SETTEXT, 0, (LPARAM)Path1);
				else if(strncmp(Str, BMARK_MARK_REMOTE, BMARK_MARK_LEN) == 0)
				{
					SendDlgItemMessage(hDlg, BEDIT_REMOTE, WM_SETTEXT, 0, (LPARAM)Path1);
					/* �z�X�g���ɃJ�[�\�����ړ����Ă��� */
					SetFocus(GetDlgItem(hDlg, BEDIT_REMOTE));
					SendDlgItemMessage(hDlg, BEDIT_REMOTE, EM_SETSEL, 0, -1);
					return(FALSE);
				}
				else if((strncmp(Str, BMARK_MARK_BOTH, BMARK_MARK_LEN) == 0) && (Num == 2))
				{
					SendDlgItemMessage(hDlg, BEDIT_LOCAL, WM_SETTEXT, 0, (LPARAM)Path1);
					SendDlgItemMessage(hDlg, BEDIT_REMOTE, WM_SETTEXT, 0, (LPARAM)Path2);
				}
			}
			return(TRUE);

		case WM_COMMAND :
			switch(GET_WM_COMMAND_ID(wParam, lParam))
			{
				case IDOK :
					SendDlgItemMessage(hDlg, BEDIT_LOCAL, WM_GETTEXT, FMAX_PATH+1, (LPARAM)Local);
					SendDlgItemMessage(hDlg, BEDIT_REMOTE, WM_GETTEXT, FMAX_PATH+1, (LPARAM)Remote);
					if(strlen(Local) > 0)
					{
						if(strlen(Remote) > 0)
						{
							/* ���� */
							strcpy(Str, BMARK_MARK_BOTH);
							strcat(Str, Local);
							strcat(Str, BMARK_SEP);
							strcat(Str, Remote);
						}
						else
						{
							/* ���[�J���̂� */
							strcpy(Str, BMARK_MARK_LOCAL);
							strcat(Str, Local);
						}
						EndDialog(hDlg, YES);
					}
					else if(strlen(Remote) > 0)
					{
						/* �z�X�g�̂� */
						strcpy(Str, BMARK_MARK_REMOTE);
						strcat(Str, Remote);
						EndDialog(hDlg, YES);
					}
					else
						EndDialog(hDlg, NO);
					break;

				case IDCANCEL :
					EndDialog(hDlg, NO);
					break;
			}
            return(TRUE);
	}
	return(FALSE);
}