Показать сообщение отдельно
  #11  
Старый 04.03.2008, 15:31
Аватар для KOOL
KOOL KOOL вне форума
Активный
 
Регистрация: 06.01.2008
Адрес: Рязань
Сообщения: 306
Версия Delphi: 2009
Репутация: 6150
По умолчанию

И последний вопрос(как я надеюсь ): как все-таки подключить плагин? Чему нужно присвоить результат функции CreatePlayerPlugin(PluginService: IPluginService) ?... вот временный код:
Код:
procedure TPLForm.LoadPlugin(Name : string);
var
  Srv: IPPlugin;                //
  PSrv : IPluginService;     //Это будут глобальные переменные
  HndDLLHandle: THandle; //
  Msg : TPPluginMessage;
  CreatePlayerPlugin : function(PluginService : IPluginService):IPPlugin;
begin
  HndDLLHandle:=LoadLibrary(PChar(ExeDir+'Plugins\'+Name));
  if HndDLLHandle<>0 then
    begin
      @CreatePlayerPlugin:=GetProcAddress(HndDLLHandle,'CreatePlayerPlugin');
      if @CreatePlayerPlugin<>nil then
        try
          PSrv := TPluginService.Create;  //вот тут я и не знаю
          Srv := CreatePlayerPlugin(PSrv);//как делать. вылезает
        except
          on EAccessViolation do;           //AccessViolation
        end
      else
        Application.MessageBox('Function not exists','Player',MB_TOPMOST+MB_ICONERROR);
    end
  else
    Application.MessageBox('DLL not found','Player',MB_TOPMOST+MB_ICONERROR);
 FreeLibrary(HndDLLHandle);
end;
Ответить с цитированием