10{
16 wchar_t fmtStrPath[20]=
L"";
17 wchar_t fmtStrFile[20]=
L"";
18 wchar_t fmtString[40]=
L"";
19
20
21
22
23
24
25
26
29 if (!(totalWidth % 2))
30 halfTotLen=totalWidth / 2;
31 else
32 halfTotLen=(totalWidth-1) / 2;
33
34
35
36 if ( (pathLen >= halfTotLen) && (fnLen < halfTotLen) )
37 {
38 len4fn = fnLen;
39 len4path = (totalWidth - len4fn);
40 }
41
42 if ( (pathLen < halfTotLen) && (fnLen < halfTotLen) )
43 {
44 len4fn = fnLen;
45 len4path = pathLen;
46 }
47
48 if ( (pathLen >= halfTotLen) && (fnLen >= halfTotLen) )
49 {
50 len4fn = halfTotLen;
51 len4path = halfTotLen;
52 }
53
54 if ( (pathLen < halfTotLen) && (fnLen >= halfTotLen) )
55 {
56 len4path = pathLen;
57 len4fn = (totalWidth - len4path);
58 }
59
60
61
62
63 if (halfTotLen < (totalWidth/2)) len4path++;
64
65 if (pathLen > len4path)
swprintf (fmtStrPath,
L"%%.%ds...\\", len4path-4);
66 else
68
69 if (fnLen > len4fn)
swprintf (fmtStrFile,
L"%%.%ds...", len4fn-3);
70 else
72
73 wcscpy (fmtString, fmtStrPath);
74 wcscat (fmtString, fmtStrFile);
75
77
78 return (1);
79}
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
_CRTIMP wchar_t *__cdecl wcscat(_Inout_updates_z_(_String_length_(_Dest)+_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)