Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Win32/Win64 API (native code) (https://www.delphipraxis.net/17-win32-win64-api-native-code/)
-   -   Delphi GetActiveObject + IShellDispatch2 = Operation unavailable. (https://www.delphipraxis.net/110190-getactiveobject-ishelldispatch2-%3D-operation-unavailable.html)

Dezipaitor 14. Mär 2008 14:20


GetActiveObject + IShellDispatch2 = Operation unavailable.
 
Ich versuche mich gerade an ein bisschen Shellprogrammierung. Dazu möchte ich die ShellExecute vom Interface IShellDispatch2 aufrufen.
Jedoch bekomme ich bei der Instanzerstellung nur : Operation unavailable.

Unitdownload: RVShlDisp
Delphi-Quellcode:
program Project7;

{$APPTYPE CONSOLE}

uses
  RVShlDisp,
  ActiveX,
  ComObj,
  SysUtils;

var P : IUnknown;
    Shell : IShellDispatch2;
    HR : HRESULT;
begin
  CoInitialize(nil);


//  OleCheck(
  HR := GetActiveObject(IID_IShellDispatch2, nil, P);
  //==
  //P := GetActiveOleObject('Shell.Application');
  Shell := P as IShellDispatch2;

end.
Was stimmt nicht?

THX

Dezipaitor 14. Mär 2008 14:29

Re: GetActiveObject + IShellDispatch2 = Operation unavailabl
 
Mit
Delphi-Quellcode:
P := CreateOleObject('Shell.Application');
funktioniert es.


Alle Zeitangaben in WEZ +1. Es ist jetzt 01:45 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 by Thomas Breitkreuz