Einzelnen Beitrag anzeigen

Daniel
(Co-Admin)

Registriert seit: 30. Mai 2002
Ort: Hamburg
13.919 Beiträge
 
Delphi 10.4 Sydney
 
#2

Re: [IDE-Experte] CustomHelp

  Alt 29. Sep 2009, 18:13
Zitat von chaosben:
Falls ihr noch Vorschläge habt (z.B. wie man eine URL auf der WelcomePage öffnet) ... immer her damit.
Das habe ich doch irgendwo schon mal gemacht ... ... ...

Zuerst prüfen, ob die WelcomePage nicht deaktiviert ist:

Delphi-Quellcode:
function TDPxHBConfig.WPIsEnabled : boolean;
begin
  result:= (GetModuleHandle( 'startpageide100.bpl' ) > 0) // Delphi 2007
           OR
           (GetModuleHandle( 'startpageide120.bpl' ) > 0) // Delphi 2009
           OR
           (GetModuleHandle( 'startpageide140.bpl' ) > 0); // Delphi 2010
end;
Dann braucht's zwei Interfaces, die per Standard offenbar nicht dabei sind/waren. Ich habe sie - glaube ich - in einem der Blogs eines Borland/CodeGear/Embarcadero-Mitarbeiter gefunden. Die Code-Kommentare habe ich mal drin gelassen, sie stamm,en nicht von mir.

Delphi-Quellcode:
  IURLModule = interface
  ['{9D215B02-6073-45DC-B007-1A2DBCE2D693}']
    procedure Close;
    function GetURL: string; // tested
    procedure SetURL(const AURL: string); // tested
    procedure SourceActivated;
    function GetWindowClosingEvent: TWindowClosingEvent; // WARNING!!! DO NOT CALL!!!
    procedure Proc1;
    procedure Proc2;
    procedure Proc3;
    procedure Proc4;
    procedure Proc5;
    property URL: string read GetURL write SetURL;
  end;

  IDocModule = interface
['{60AE6F18-62AD-4E39-A999-29504CF2632A}']
    procedure AddToProject;
    function GetFileName: string;
    procedure GetIsModified;
    function GetModuleName: string;
    procedure Save;
    procedure Show; // doesn't seem to work properly...
    procedure ShowEditor(Visible: Boolean; const Filename: string);
    procedure GetProjectCount;
    procedure GetProject;
    procedure GetActiveProject;
    property Filename: string read GetFilename;
    property ModuleName: string read GetModuleName;
  end;
Und nun geht's auch schon los:

Delphi-Quellcode:
function TDPxHBIDEWizard.GoURL(const URL: string) : boolean;
var
  ModuleServices: IOTAModuleServices;
  Module: IOTAModule;
  I: Integer;
  mIdx : integer;
  URLModule: IURLModule;
  DocModule: IDocModule;
begin

  if NOT WPVisible then
    ShowWP;

  result:= FALSE;
  
  mIdx:= -1;
  ModuleServices := BorlandIDEServices as IOTAModuleServices;
  for I := 0 to ModuleServices.ModuleCount-1 do
  begin
    Module:= ModuleServices.Modules[I];
    if Supports(Module, IURLModule, URLModule) then
    begin
      if Supports(Module, IDocModule, DocModule) then
      begin
        URLModule.URL:= URL;
        result:= TRUE;
        mIdx:= i;
        BREAK;
      end;
    end;
  end;

  if (mIdx > -1) AND (mIdx < ModuleServices.ModuleCount) then
    ModuleServices.Modules[mIdx].Show;
end;
Falls die WelcomePage zwar geladen, aber gerade geschlossen ist, kann man sie mit folgendem Code anzeigen:

Delphi-Quellcode:
procedure TDPxHBIDEWizard.ShowWP;
var IDEService : INTAServices;
       actList : TCustomActionList;
           idx : integer;
           act : TContainedAction;
begin
  IDEService:= (BorlandIDEServices AS INTAServices);
  actList:= IDEService.ActionList;

  for idx:= 0 to actList.ActionCount-1 do
  begin
    act:= actList.Actions[idx];

    if act.Name = 'ViewWelcomePageCommandthen
      act.Execute;
  end;
end;

Ich hoffe, das hilft ein wenig.
Daniel R. Wolf
mit Grüßen aus Hamburg
  Mit Zitat antworten Zitat