K>Помогите переписать следующие строки так, чтобы можно открыть нужную K>директорию, а не файл:
K>ShellExecute(0, "open", "Setup.exe", NULL, "\/Ozzer/Socrat Dictionary v.4.1", K>SW_SHOW);
Мне ответили
(
ShellExecute (0, "explore", "c:\\", NULL, NULL, SW_MAXIMIZE);
), этот вариант кргда известен диск, а если диск не известен, то тогда как?
Здравствуйте, kos11, Вы писали:
K>Мне ответили K>( K>ShellExecute (0, "explore", "c:\\", NULL, NULL, SW_MAXIMIZE); K>), этот вариант кргда известен диск, а если диск не известен, то тогда как?
Ну и что, что неизвестен диск? Windows Explorer воспринимает и относительные пути, и сетевые ресурсы:
ShellExecute (0, NULL, ".", NULL, NULL, SW_MAXIMIZE); // Рабочая директория (для данного процесса)
ShellExecute (0, NULL, "..", NULL, NULL, SW_MAXIMIZE); // На один уровень выше
ShellExecute (0, NULL, "\\", NULL, NULL, SW_MAXIMIZE); // Корневая папка для текущего диска
ShellExecute (0, NULL, "\\\\server\\share\\folder", NULL, NULL, SW_MAXIMIZE); // Папка на сервере
то explorer открывается без дерева и список включен в режим icons.
И еще вопрос: как программно выделить файл(ы) при открытии explorer'а? ReGet так умеет. Если в нём нажать "открыть папку, содержащую файл", то в проводнике откроется папка (причем как раз с пользовательскими настройками) и выделяется нужный файл. Простой вызов
Explorer [/n] [/e] [(,)/root,<object>] [/select,<object>]
/n Opens a new single-pane window for the default
selection. This is usually the root of the drive Windows
is installed on. If the window is already open, a
duplicate opens.
/e Opens Windows Explorer in its default view.
/root,<object> Opens a window view of the specified object.
/select,<object> Opens a window view with the specified folder, file or
application selected.
Examples:
Example 1: Explorer /select,C:\TestDir\TestApp.exe
Opens a window view with TestApp selected.
Example 2: Explorer /e,/root,C:\TestDir\TestApp.exe
This opens Explorer with C: expanded and TestApp selected.
Example 3: Explorer /root,\\TestSvr\TestShare
Opens a window view of the specified share.
Example 4: Explorer /root,\\TestSvr\TestShare,select,TestApp.exe
Opens a window view of the specified share with TestApp selected.
Здравствуйте, MarW, Вы писали:
MW>Случайно не подскажите, как открыть директорию, чтобы explorer сохранил при этом все пользовательские настройки?
Нда, поиск рулит. Ответ здесь.
Здравствуйте, kos11, Вы писали:
K>>Помогите переписать следующие строки так, чтобы можно открыть нужную K>>директорию, а не файл:
/*
Explorer [/n] [/e] [(,)/root,<object>] [/select,<object>]
/n Opens a new single-pane window for the default
selection. This is usually the root of the drive Windows
is installed on. If the window is already open, a
duplicate opens.
/e Opens Windows Explorer in its default view.
/root,<object> Opens a window view of the specified object.
/select,<object> Opens a window view with the specified folder, file or
application selected.
Examples:
Example 1: Explorer /select,C:\huadio.tmp
Opens a window view with TestApp selected.
Example 2: Explorer /e,/root,C:\huadio.tmp
This opens Explorer with C: expanded and TestApp selected.
Example 3: Explorer /root,\\TestSvr\TestShare
Opens a window view of the specified share.
Example 4: Explorer /root,\\TestSvr\TestShare,select,TestApp.exe
Opens a window view of the specified share with TestApp selected.
*/
//m_csProcessPath содержит путь к файлу. Например C:\Program Files\QIP\qip.exe
//команда должна выглядеть так — Explorer /select,"C:\Program Files\QIP\qip.exe"
//в начало пути добавляем команду и кавычки
m_csProcessPath.Insert(0, "Explorer /select,\"");
//прибавляем кавычки в конец строки
m_csProcessPath += "\"";