Главная страница
    Top.Mail.Ru    Яндекс.Метрика
Форум: "WinAPI";
Текущий архив: 2004.08.01;
Скачать: [xml.tar.bz2];

Вниз

Как открыть стандартное окно со свойством файл?   Найти похожие ветки 

 
Buster ©   (2004-06-22 16:15) [0]

То, которое появляеться по Alt+Enter в ВинКоме или по правой  кнопке (свойства) в проводнике. Насколько понимаю, это АПИшная функция.
Спасибо.


 
Sliski Slimak   (2004-06-22 23:45) [1]

поставь BUPack Component Package ... там есть куча вызовов стандартных диалогов....
http://www.torry.net/quicksearchd.php?String=BUPack&Title=Yes


 
Sliski Slimak   (2004-06-23 00:35) [2]

вот что я нарыл в исходниках вышеуказанного компонента

{The last function I"m going to deal with in this section is
 SHObjectProperties. This is what you would use to display
 the properties dialog for a file or folder. It can also be used
 to display the properties for a printer object.
       hwndOwner identifies the window that owns the dialog.
 lpstrName points to a string containing the path
 name or the printer name whose properties
 will be displayed. uFlags specifies the type of
 name contained in lpstrName.
 lpstrParameters points to a string containing
 the name of the page that will initially be selected. if lpstr-
 Parameters is NULL, the first page on the property sheet
 will be selected.
       if the function succeeds, the return Value is TRUE. If
 the function fails, the return Value is FALSE. To get exten-
 ded error information, call GetLastError. Note that this
 dialog is actually modeless, so when the function returns the
 dialog will probably still be open. There is no way of kno-
 wing when the user has closed the dialog.
       I should also mention that if you only need to display
 the properties for a file or folder, you can quite easily ac-
 complish the same thing with a call to the documented
 function ShellExecuteEx, specifying "properties" for the
 lpVerb parameter. This doesn"t appear to work for printer
 names though.}
 TSHObjectProperties = function (hwndOwner:HWND;uFlags:Integer;lpstrName,lpstrParameters:LPWSTR):boolean;stdcall;

 TSHOutOfMemoryMessageBox = function (Owner: HWND;Caption: Pointer; style: UINT): Integer; stdcall;
 TSHHandleDiskFull = procedure (Owner: HWND; Drive: UINT); stdcall;

var
 SHPickIconDlg:TSHPickIconDlg;
 SHHandleDiskFull:TSHHandleDiskFull;
 SHOutOfMemoryMessageBox:TSHOutOfMemoryMessageBox;
 SHObjectProperties:TSHObjectProperties;
 SHFindComputer:TSHFindComputer;
 SHFindFiles:TSHFindComputer;
 SHRunFileDlg:TSHRunFileDlg;
 SHRestartDlg:TSHRestartDlg;
 SHExitWindowsDlg:TSHExitWindowsDlg;

implementation

const
 DllName = "Shell32.dll";

var
 hDll:THandle;

initialization
 hDll := LoadLibrary(DllName);
 if hDll<>0 then
 begin
   SHPickIconDlg := GetProcAddress(hDll,PChar(62));
   SHHandleDiskFull := GetProcAddress(hDll,PChar(185));
   SHOutOfMemoryMessageBox := GetProcAddress(hDll,PChar(126));
   SHObjectProperties := GetProcAddress(hDll,PChar(178));
   SHFindComputer := GetProcAddress(hDll,PChar(91));
   SHFindFiles := GetProcAddress(hDll,PChar(90));
   SHRunFileDlg := GetProcAddress(hDll,PChar(61));
   SHRestartDlg := GetProcAddress(hDll,PChar(59));
   SHExitWindowsDlg := GetProcAddress(hDll,PChar(60));
 end
 else
   PError("MRU");
finalization
 if hDll<>0 then
    FreeLibrary(hDll);
end.

Итого, что мы имеем?
То, что вызывается функция SHObjectProperties из Shell32.dll

uses Activex;

Function ObjectProperties
(hOwner,uFlags:LongInt;sName,sParam:String): LongInt;
{Функция вызывает диалог "Свойства"

Параметры
hOwner - хэндл родителя.
uFlags - может принимать два значения - 1 для свойств принтера, 2 -
для
файла
sName - имя принтера или файла. Если вместо имени файла указаны папка или диск, вызывается
соответствующее окно свойств. Если указано "" - появляются свойства Системы.
sParam - название
вкладки на пропертях, которую надо показать. Если предать пустую строку или несуществующую вкладку -
будет показана первая вкладка.
}

implementation

Function ObjectProperties
(hOwner,uFlags:LongInt;sName,sParam:String): LongInt;
Var sNameW,sParamW:PWideChar;

sNameL,sParamL:Integer;
begin
SNameL:=Length(sName)+1;

sNameW := CoTaskMemAlloc(SNameL * sizeof(WideChar));
StringToWideChar(SName,
SNameW, sNameL);
SParamL:=Length(sParam)+1;
sParamW :=
CoTaskMemAlloc(SParamL *
sizeof(WideChar));
StringToWideChar(SParam, SParamW, sParamL);

Result:=SHObjectProperties (hOwner,uFlags,sNameW,sParamW);

CoTaskMemFree(sNameW);CoTaskMemFree(sParamW);
end;


 
Sliski Slimak   (2004-06-23 00:50) [3]

Ну а ещё проще будет просто так-

procedure TForm1.Button1Click(Sender: TObject);
var
hDLL:HWND;
SHObjectProperties: function(hwndOwner:HWND;uFlags:Integer;lpstrName,lpstrParameters:LPWSTR):boolean; stdcall;
begin
hDLL :=LoadLibrary("shell32.dll") ;
if hDll<>0 then
SHObjectProperties := GetProcAddress(hDll,PChar(178));
SHObjectProperties(handle,2,"c:\windows",nil);
end;


 
Sliski Slimak   (2004-06-23 00:50) [4]

Проверь-работает


 
jack128 ©   (2004-06-23 00:53) [5]


> Sliski Slimak   (23.06.04 00:50)

выгружать библиотеку кто будет?


 
Buster ©   (2004-06-23 10:32) [6]


> Sliski Slimak  

Выгружать буду я :-)

Спасибо. Это то что нужно.



Страницы: 1 вся ветка

Форум: "WinAPI";
Текущий архив: 2004.08.01;
Скачать: [xml.tar.bz2];

Наверх





Память: 0.47 MB
Время: 0.071 c
1-1089934447
Alex870
2004-07-16 03:34
2004.08.01
Excel


1-1090406223
Dm_S
2004-07-21 14:37
2004.08.01
xl_1:=CreateOLEObject( Excel.Application в консольном приложении


6-1084508226
NLO
2004-05-14 08:17
2004.08.01
ICQ


1-1090395146
kingdom
2004-07-21 11:32
2004.08.01
История DirectX


14-1089302163
OSokin
2004-07-08 19:56
2004.08.01
Мастера Дельфи





Afrikaans Albanian Arabic Armenian Azerbaijani Basque Belarusian Bulgarian Catalan Chinese (Simplified) Chinese (Traditional) Croatian Czech Danish Dutch English Estonian Filipino Finnish French
Galician Georgian German Greek Haitian Creole Hebrew Hindi Hungarian Icelandic Indonesian Irish Italian Japanese Korean Latvian Lithuanian Macedonian Malay Maltese Norwegian
Persian Polish Portuguese Romanian Russian Serbian Slovak Slovenian Spanish Swahili Swedish Thai Turkish Ukrainian Urdu Vietnamese Welsh Yiddish Bengali Bosnian
Cebuano Esperanto Gujarati Hausa Hmong Igbo Javanese Kannada Khmer Lao Latin Maori Marathi Mongolian Nepali Punjabi Somali Tamil Telugu Yoruba
Zulu
Английский Французский Немецкий Итальянский Португальский Русский Испанский