ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/proj/trunk/VTBFileUtil2/ScanUtility.cxx
(Generate patch)

Comparing trunk/VTBFileUtil2/ScanUtility.cxx (file contents):
Revision 288 by douglas, 2003-09-03T15:58:38-07:00 vs.
Revision 292 by douglas, 2003-09-08T18:43:28-07:00

# Line 2 | Line 2
2   //
3   // Douglas Thrift
4   //
5 < // $Id: ScanUtility.cxx,v 1.14 2003/09/03 22:58:38 douglas Exp $
5 > // $Id: ScanUtility.cxx,v 1.17 2003/09/09 01:43:28 douglas Exp $
6  
7   #include "ScanUtility.h"
8  
# Line 193 | Line 193 | void ScanUtility::saveDirs(void)
193   {
194          HKEY key;
195  
196 <        if (RegCreateKeyEx(HKEY_CURRENT_USER,
196 >        if (LONG code = RegCreateKeyEx(HKEY_CURRENT_USER,
197                  "Software\\DouglasThrift\\VTBFileUtil2", 0, NULL,
198                  REG_OPTION_NON_VOLATILE, KEY_QUERY_VALUE | KEY_SET_VALUE, NULL, &key,
199                  NULL) == ERROR_SUCCESS)
# Line 218 | Line 218 | void ScanUtility::saveDirs(void)
218                                  LPBYTE(scanDir.c_str()), scanDir.length() + 1) !=
219                                  ERROR_SUCCESS)
220                          {
221 <                                error();
221 >                                error(NULL, code);
222                          }
223                  }
224  
# Line 240 | Line 240 | void ScanUtility::saveDirs(void)
240                                  LPBYTE(saveDir.c_str()), saveDir.length() + 1) !=
241                                  ERROR_SUCCESS)
242                          {
243 <                                error();
243 >                                error(NULL, code);
244                          }
245                  }
246  
# Line 248 | Line 248 | void ScanUtility::saveDirs(void)
248          }
249          else
250          {
251 <                error();
251 >                error(NULL, code);
252          }
253   }
254  
255   void ScanUtility::setScanDir(HWND parent)
256   {
257 +        char buffer[MAX_PATH];
258 +
259 +        SHGetFolderPath(parent, CSIDL_FLAG_CREATE | CSIDL_DESKTOPDIRECTORY, NULL,
260 +                0, buffer);
261 +
262          BROWSEINFO info;
263  
264          info.hwndOwner = parent;
# Line 308 | Line 313 | void ScanUtility::setScanDir(HWND parent
313  
314   void ScanUtility::setSaveDir(HWND parent)
315   {
316 +        char buffer[MAX_PATH];
317 +
318 +        SHGetFolderPath(parent, CSIDL_FLAG_CREATE | CSIDL_DESKTOPDIRECTORY, NULL,
319 +                0, buffer);
320 +
321          BROWSEINFO info;
322  
323          info.hwndOwner = parent;
# Line 381 | Line 391 | void ScanUtility::populate(HWND parent)
391  
392                          FindClose(finder);
393                  }
384                else
385                {
386                        error(parent);
387                }
394  
395                  if (scans.empty())
396                  {
# Line 466 | Line 472 | int ScanUtility::browse(HWND dialog, UIN
472                  SendMessage(dialog, BFFM_SETOKTEXT, 0,
473                          LPARAM(toWide("&Select").c_str()));
474                  SendMessage(dialog, BFFM_SETEXPANDED, FALSE, CSIDL_DRIVES);
475 <                SendMessage(dialog, BFFM_SETSELECTION, TRUE, LPARAM(HIWORD(d) ?
476 <                        data->scanDir.c_str() : data->saveDir.c_str()));
475 >
476 >                if ((HIWORD(d) ? data->scanDir : data->saveDir) != "")
477 >                {
478 >                        IShellFolder* desktop;
479 >                        LPWSTR path = new WCHAR[(HIWORD(d) ? data->scanDir.length() :
480 >                                data->saveDir.length()) + 1];
481 >                        LPITEMIDLIST id;
482 >
483 >                        wsprintfW(path, toWide(HIWORD(d) ? data->scanDir :
484 >                                data->saveDir).c_str());
485 >
486 >                        if (debug) cerr << "path = " << toAnsi(path) << "\n";
487 >
488 >                        SHGetDesktopFolder(&desktop);
489 >                        desktop->ParseDisplayName(dialog, NULL, path, NULL, &id, NULL);
490 >
491 >                        if (id != NULL)
492 >                        {
493 >                                SendMessage(dialog, BFFM_SETSELECTION, FALSE, LPARAM(id));
494 >
495 >                                LPMALLOC destruct;
496 >
497 >                                SHGetMalloc(&destruct);
498 >                                destruct->Free(id);
499 >                                destruct->Release();
500 >                        }
501 >
502 >                        desktop->Release();
503 >                }
504                  break;
505          case BFFM_SELCHANGED:
506                  {
# Line 852 | Line 885 | INT_PTR ScanUtility::enter(HWND dialog,
885                                                  << "}\n";
886                                  }
887  
888 <                                data->save = data->saveDir + '\\' + data->client.getFile();
888 >                                data->save = data->saveDir + data->client.getFile();
889  
890                                  if (debug) cerr << "save = " << data->save << "\n";
891                                  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines