![]() |
Windows 7, wie bekomme ich IShellLibrary Interface
Hallo,
Windows 7 hat ein neues Interface ![]() In Delphi 2010 ist die Definition bereits vorhanden. Meine Frage ist: wie kann ich das Interface bekommen? Ich habe versucht in etwa so: var myShellLibrary: IShellLibrary; ShellFolder.QueryInterface(IID_IShellLibrary, Pointer(myhellLibrary)); aber das scheint nicht zu funktionieren. Gruß marcos |
Re: Windows 7, wie bekomme ich IShellLibrary Interface
Zitat:
Zitat:
Ach und für demnächst: [delphi]-Tags nicht vergessen. |
Re: Windows 7, wie bekomme ich IShellLibrary Interface
Also eigentlich reicht dir diese Funktion:
![]() Edit: Zitat:
|
Re: Windows 7, wie bekomme ich IShellLibrary Interface
SHLoadLibraryFromParsingName wäre wohl die richtige Funktion.
Ich habe versucht die Funktion zu deklarieren (Delphi 2010 scheint die Deklaration noch nicht zu haben). Leider das Programm kompiliert, aber startet auch nicht - keine Fehlermeldung. Was ist da noch falsch? marcos
Delphi-Quellcode:
unit Unit1;
interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ShellApi, ShlObj, ActiveX; type TForm1 = class(TForm) Label1: TLabel; Edit1: TEdit; Button1: TButton; procedure Button1Click(Sender: TObject); procedure FormCreate(Sender: TObject); private { Private declarations } FShellLibrary: IShellLibrary; public { Public declarations } end; function SHLoadLibraryFromParsingName( libraryParsingName: PWideChar; stgmFlags: dword; const riid: TIID; var ppv: Pointer): HResult; stdcall; var Form1: TForm1; implementation {$R *.dfm} function SHLoadLibraryFromParsingName; external shell32 name 'SHLoadLibraryFromParsingName'; procedure TForm1.FormCreate(Sender: TObject); begin Edit1.Text := '::{031E4825-7B94-4DC3-B131-E946B44C8DD5}\Documents.library-ms'; // ParsingName für die Dokumente-Bibliothek end; procedure TForm1.Button1Click(Sender: TObject); begin if Succeeded(SHLoadLibraryFromParsingName( PWideChar(Edit1.Text), STGM_READWRITE, IID_IShellLibrary, Pointer(FShellLibrary)) ) then ShowMessage('Success'); end; end. |
Re: Windows 7, wie bekomme ich IShellLibrary Interface
Das Thema würde mich auch interessieren.
Bei mir ist aber genauso - wird kompiliert, aber nicht gestartet. Es muss an der Deklaration von SHLoadLibraryFromParsingName liegen. Vielleicht hat jemand eine Idee? Eric |
Re: Windows 7, wie bekomme ich IShellLibrary Interface
Mal ne vielleicht ganz blöde Frage, aber kann ich das IShellLibrary Interface auch unter Delphi 2006 nutzen? Hab bislang selber noch nichts mit Interfaces zu tun gehabt.
|
Re: Windows 7, wie bekomme ich IShellLibrary Interface
Zitat:
Zitat:
Hat jemand Ahnung, wo die Funktion versteckt ist? Es scheint, dass sie in shell32.dll nicht vorhanden ist. Die Deklaration der Funktion sollte in Shobjidl.h vorhanden sein, wenn jemand die Datei hat - vielleicht ist dort was zu finden. marcos |
Re: Windows 7, wie bekomme ich IShellLibrary Interface
Man muss die Definitionen in Shobjidl.h finden und übersetzen.
Eric
Delphi-Quellcode:
unit Unit1;
interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ShellApi, ShlObj, ActiveX; type TForm1 = class(TForm) Label1: TLabel; Edit1: TEdit; Button1: TButton; procedure Button1Click(Sender: TObject); procedure FormCreate(Sender: TObject); procedure FormDestroy(Sender: TObject); private { Private declarations } FShellLibrary: IShellLibrary; public { Public declarations } end; var Form1: TForm1; implementation {$R *.dfm} function SHCreateLibrary(const riid: TIID; var ppv: Pointer): HRESULT; begin result := CoCreateInstance(CLSID_ShellLibrary, nil, CLSCTX_INPROC_SERVER, IID_IShellLibrary, Pointer(ppv) ) ; end; function SHLoadLibraryFromParsingName( libraryParsingName: PWideChar; stgmFlags: dword; const riid: TIID; var ppv: IShellLibrary): HResult; var libraryFilePidl: PItemIDList; libraryFileShellItem: IShellItem; shellLibrary: IShellLibrary; attributes: dword; begin attributes := 0; result := SHILCreateFromPath(libraryParsingName,libraryFilePidl, attributes ); if result = S_OK then begin result := SHCreateItemFromIDList(libraryFilePidl, IID_IShellItem, Pointer(libraryFileShellItem) ); if result = S_OK then begin result := SHCreateLibrary(IID_IShellLibrary, Pointer(shellLibrary) ); if result = S_OK then begin result := shellLibrary.LoadLibraryFromItem(libraryFileShellItem, STGM_READWRITE ); if result = S_OK then ppv := shellLibrary; end; end; end; end; procedure TForm1.FormCreate(Sender: TObject); begin CoInitialize(nil); Edit1.Text := '::{031E4825-7B94-4DC3-B131-E946B44C8DD5}\Documents.library-ms'; end; procedure TForm1.FormDestroy(Sender: TObject); begin CoUninitialize; end; procedure TForm1.Button1Click(Sender: TObject); begin if Succeeded(SHLoadLibraryFromParsingName(PWideChar(Edit1.Text),STGM_READWRITE,IID_IShellLibrary, FShellLibrary )) then ShowMessage('Success'); end; end. |
Alle Zeitangaben in WEZ +1. Es ist jetzt 23:19 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz