Visual Basic 6 c использованием API-функций: Прошу помочь разобраться

LunnyTsar 08.04.2004 - 11:35 | По просьбе приятеля (у него нет доступа в Инет)публикую его вопрос: "Прошу помочь разобраться с одной небольшой проблемкой. Использую в программе стандартное диалоговое окно Windows "Обзор папок" для выбора каталога. Вызывается окно при помощи стандартной для Windows API-функции SHBrowseForFolder, которая и позволяет пользователю выбрать каталог на диске компьютера. Проблема в том, что при вызове данного диалогового окна открывается корень всей иерархии дисков и ресурсов компьютера, а хотелось бы в качестве параметра передать функции SHBrowseForFolder каталог, который при вызове функции уже должен быть открыт (т.е. выбран) (например "C:\Мои документы", или какой-либо другой существующий каталог данного компьютера). Заранее благодарю."
? 1 - 08.04.2004 - 11:47 | заранее спасибо! =) вообще скажи приятелю пусть купит диски с MSDN! пример из MSDN LPITEMIDLIST PidlBrowse(HWND hwnd, int nCSIDL, LPSTR pszDisplayName) { LPITEMIDLIST pidlRoot = NULL; LPITEMIDLIST pidlSelected = NULL; BROWSEINFO bi = {0}; LPMALLOC pMalloc = NULL; SHGetMalloc(&pMalloc); if(nCSIDL) { SHGetFolderLocation(hwnd, nCSIDL, NULL, NULL, &pidlRoot); } else { pidlRoot = NULL; } bi.hwndOwner = hwnd; bi.pidlRoot = pidlRoot; bi.pszDisplayName = pszDisplayName; bi.lpszTitle = "Choose a folder"; bi.ulFlags = 0; bi.lpfn = NULL; bi.lParam = 0; pidlSelected = SHBrowseForFolder(&bi); if(pidlRoot) { pMalloc->Free(pidlRoot); } pMalloc->Release(); return pidlSelected; }
? 2 - 08.04.2004 - 11:49 | где nCSIDL If a special folder does not exist, you can force its creation by using the following special CSIDL: CSIDL_FLAG_CREATE Version 5.0. Combine this CSIDL with any of the CSIDLs listed below to force the creation of the associated folder. The remaining CSIDLs correspond to either file system folders or virtual folders. Where the CSIDL identifies a file system folder, a commonly used path is given as an example. Other paths may be used. Some CSIDLs can be mapped to an equivalent %VariableName% environment variable. CSIDLs are more reliable, however, and should be used if possible. CSIDL_ADMINTOOLS Version 5.0. File system directory that is used to store administrative tools for an individual user. The Microsoft Management Console will save customized consoles to this directory, and it will roam with the user. CSIDL_ALTSTARTUP File system directory that corresponds to the user's nonlocalized Startup program group. CSIDL_APPDATA Version 4.71. File system directory that serves as a common repository for application-specific data. A typical path is C:\Documents and Settings\username\Application Data. This CSIDL is supported by the redistributable ShFolder.dll for systems that do not have the Internet Explorer 4.0 integrated Shell installed. CSIDL_BITBUCKET Virtual folder containing the objects in the user's Recycle Bin. CSIDL_COMMON_ADMINTOOLS Version 5.0. File system directory containing containing administrative tools for all users of the computer. CSIDL_COMMON_ALTSTARTUP File system directory that corresponds to the nonlocalized Startup program group for all users. Valid only for Windows NT® systems. CSIDL_COMMON_APPDATA Version 5.0. Application data for all users. A typical path is C:\Documents and Settings\All Users\Application Data. CSIDL_COMMON_DESKTOPDIRECTORY File system directory that contains files and folders that appear on the desktop for all users. A typical path is C:\Documents and Settings\All Users\Desktop. Valid only for Windows NT® systems. CSIDL_COMMON_DOCUMENTS File system directory that contains documents that are common to all users. Typical paths are C:\Documents and Settings\All Users\Documents. Valid for Windows NT® systems and Windows 95 and Windows 98 systems with Shfolder.dll installed. CSIDL_COMMON_FAVORITES File system directory that serves as a common repository for all users' favorite items. Valid only for Windows NT® systems. CSIDL_COMMON_PROGRAMS File system directory that contains the directories for the common program groups that appear on the Start menu for all users. A typical path is C:\Documents and Settings\All Users\Start Menu\Programs. Valid only for Windows NT® systems. CSIDL_COMMON_STARTMENU File system directory that contains the programs and folders that appear on the Start menu for all users. A typical path is C:\Documents and Settings\All Users\Start Menu. Valid only for Windows NT® systems. CSIDL_COMMON_STARTUP File system directory that contains the programs that appear in the Startup folder for all users. A typical path is C:\Documents and Settings\All Users\Start Menu\Programs\Startup. Valid only for Windows NT® systems. CSIDL_COMMON_TEMPLATES File system directory that contains the templates that are available to all users. A typical path is C:\Documents and Settings\All Users\Templates. Valid only for Windows NT® systems. CSIDL_CONTROLS Virtual folder containing icons for the Control Panel applications. CSIDL_COOKIES File system directory that serves as a common repository for Internet cookies. A typical path is C:\Documents and Settings\username\Cookies. CSIDL_DESKTOP Windows Desktop—virtual folder that is the root of the namespace. CSIDL_DESKTOPDIRECTORY File system directory used to physically store file objects on the desktop (not to be confused with the desktop folder itself). A typical path is C:\Documents and Settings\username\Desktop CSIDL_DRIVES My Computer—virtual folder containing everything on the local computer: storage devices, printers, and Control Panel. The folder may also contain mapped network drives. CSIDL_FAVORITES File system directory that serves as a common repository for the user's favorite items. A typical path is C:\Documents and Settings\username\Favorites. CSIDL_FONTS Virtual folder containing fonts. A typical path is C:\WINNT\Fonts. CSIDL_HISTORY
? 3 - 08.04.2004 - 11:50 | File system directory that serves as a common repository for Internet history items. CSIDL_INTERNET Virtual folder representing the Internet. CSIDL_INTERNET_CACHE Version 4.72. File system directory that serves as a common repository for temporary Internet files. A typical path is C:\Documents and Settings\username\Temporary Internet Files. CSIDL_LOCAL_APPDATA Version 5.0. File system directory that serves as a data repository for local (nonroaming) applications. A typical path is C:\Documents and Settings\username\Local Settings\Application Data. CSIDL_MYMUSIC File system directory that serves as a common repository for music files. A typical path is C:\My Music. CSIDL_MYPICTURES Version 5.0. My Pictures folder. A typical path is C:\Documents and Settings\username\My Documents\My Pictures. CSIDL_NETHOOD A file system folder containing the link objects that may exist in the My Network Places virtual folder. It is not the same as CSIDL_NETWORK, which represents the network namespace root. A typical path is C:\Documents and Settings\username\NetHood. CSIDL_NETWORK Network Neighborhood—virtual folder representing the root of the network namespace hierarchy. CSIDL_PERSONAL File system directory that serves as a common repository for documents. A typical path is C:\Documents and Settings\username\My Documents. This should be distinguished from the virtual My Documents folder in the namespace. To access that virtual folder, use the technique described in Managing the File System. CSIDL_PRINTERS Virtual folder containing installed printers. CSIDL_PRINTHOOD File system directory that contains the link objects that may exist in the Printers virtual folder. A typical path is C:\Documents and Settings\username\PrintHood. CSIDL_PROFILE Version 5.0. User's profile folder. CSIDL_PROGRAM_FILES Version 5.0. Program Files folder. A typical path is C:\Program Files. CSIDL_PROGRAM_FILES_COMMON Version 5.0. A folder for components that are shared across applications. A typical path is C:\Program Files\Common. Valid only for Windows NT® and Windows® 2000 systems. CSIDL_PROGRAMS File system directory that contains the user's program groups (which are also file system directories). A typical path is C:\Documents and Settings\username\Start Menu\Programs. CSIDL_RECENT File system directory that contains the user's most recently used documents. A typical path is C:\Documents and Settings\username\Recent. To create a shortcut in this folder, use SHAddToRecentDocs. In addition to creating the shortcut, this function updates the Shell's list of recent documents and adds the shortcut to the Documents submenu of the Start menu. CSIDL_SENDTO File system directory that contains Send To menu items. A typical path is C:\Documents and Settings\username\SendTo. CSIDL_STARTMENU File system directory containing Start menu items. A typical path is C:\Documents and Settings\username\Start Menu. CSIDL_STARTUP File system directory that corresponds to the user's Startup program group. The system starts these programs whenever any user logs onto Windows NT® or starts Windows® 95. A typical path is C:\Documents and Settings\username\Start Menu\Programs\Startup. CSIDL_SYSTEM Version 5.0. System folder. A typical path is C:\WINNT\SYSTEM32. CSIDL_TEMPLATES File system directory that serves as a common repository for document templates. CSIDL_WINDOWS Version 5.0. Windows directory or SYSROOT. This corresponds to the %windir% or %SYSTEMROOT% environment variables. A typical path is C:\WINNT

>>