Autor Beitrag
Gwaineg
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 55

WIN XP Prof
D7 Ent
BeitragVerfasst: Fr 12.08.05 08:12 
ich bin gerade dabei ein programm in einen dienst umzuwandeln und habe jetzt alle wichtigen dinge in eine extra unit geschrieben die ich sowohl beim diesnt als auch bei der normalen anwendung verwende(hab das gemacht damit ich es auch so testen kann, weil es noch erweitert wird)
wenn ich aber den dienst starte kommt eine zugriffsverletzung im constructor

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
constructor TSL.create;
begin
    FTPC:= TIdFTP.Create(self);
    qu:= TQuery.Create(self);
    qu.DatabaseName:='Warenwirtschaft';
end;


wenn ich das in der anwendung mache kommt die aber nicht und es funktioniert alles ganz normal
arj
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 378

Win XP/Vista, Debian, (K)Ubuntu
Delphi 5 Prof, Delphi 7 Prof, C# (#Develop, VS 2005), Java (Eclipse), C++, QT, PHP, Python
BeitragVerfasst: Fr 12.08.05 08:17 
Wie rufst du denn den das
TSL.create; auf?
Gwaineg Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 55

WIN XP Prof
D7 Ent
BeitragVerfasst: Fr 12.08.05 08:21 
so

ausblenden Delphi-Quelltext
1:
2:
3:
4:
procedure TService1.ServiceCreate(Sender: TObject);
begin
  SL.create();
end;
arj
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 378

Win XP/Vista, Debian, (K)Ubuntu
Delphi 5 Prof, Delphi 7 Prof, C# (#Develop, VS 2005), Java (Eclipse), C++, QT, PHP, Python
BeitragVerfasst: Fr 12.08.05 08:22 
Du musst eine Instanz erzeugen:

ausblenden Delphi-Quelltext
1:
sl := TSL.Create();					
Gwaineg Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 55

WIN XP Prof
D7 Ent
BeitragVerfasst: Fr 12.08.05 08:23 
arrggghhhh
jetzt ist es mir auch aufgefallen es gehört natürlich

ausblenden Delphi-Quelltext
1:
  SL:=TSL.create();					
Gwaineg Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 55

WIN XP Prof
D7 Ent
BeitragVerfasst: Fr 12.08.05 08:26 
andere frage: wie leg ich den namen eines dienstes fest.
also wie er in der msconfig heißt
sobald ich dienst.exe /install geschrieben habe läuft der unter dem prozess dienste oder?
arj
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 378

Win XP/Vista, Debian, (K)Ubuntu
Delphi 5 Prof, Delphi 7 Prof, C# (#Develop, VS 2005), Java (Eclipse), C++, QT, PHP, Python
BeitragVerfasst: Fr 12.08.05 08:30 
Gibt es da ncht die Eigenschaft ServiceStartName?
War die nicht dafür?
Gwaineg Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 55

WIN XP Prof
D7 Ent
BeitragVerfasst: Fr 12.08.05 09:28 
ja thx
kanns leider nicht testen weil ich einen fehler habe den ich überhaupt nicht verstehe
er sagt bei

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
program DienstWarenwirtschaft;

uses
  SvcMgr,
  uDienst in 'uDienst.pas' {Service1: TService},
  uSL in 'uSL.pas';

{$R *.RES}

begin
  Application.Initialize;
  Application.Title := 'Dienst zum Konvertieren von Datenbanken';
  Application.CreateForm(TService1, Service1);
  Application.Run;
end.

bei Application.Run
Zitat:

Exception EClassNotFound in Modul DienstWarenwirtschaft.exe bei 0001BD42.

Klasse TIdFTP nicht gefunden.


obwohl die im IDFTP drinsteht
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
unit uSL;

interface

uses DB,DBTables, IDFTP, Variants, SysUtils, Classes;


ich hab sogar schonmal alles auskommentiert was damit zu tun hat, weil ich es z.Z. noch nicht brauche aber das hat auch nichts gebracht
Gwaineg Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 55

WIN XP Prof
D7 Ent
BeitragVerfasst: Fr 12.08.05 10:20 
keine ahnung was ich gemacht habe aber es geht wieder

nächster fehler:
wenn ich jetzt im cmd "dienst.exe /install" schreibe kommt folgender fehler:
Zitat:

Service "Service1" konnte nicht installiert werden; Fehler: "Systemfehler. Code: 1057.
Der Kontenname ist unzulässig oder nicht vorhanden, oder das Kennwort ist für den angegebenen Kontennamen ungültig"

1. mein dienst heißt anders und ich hab auch den ServiceStartNamme geändert das wort "Service1" kommt nirgends vor
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
type
  TDienstSL = class(TService)
    Timer: TTimer;
    FTPC: TIdFTP;
    qu: TQuery;
    procedure TimerTimer(Sender: TObject);
    procedure ServiceCreate(Sender: TObject);
  private
    { Private-Deklarationen }
    SL : TSL;
  public
    function GetServiceController: TServiceController; override;
    { Public-Deklarationen }
  end;

var
  DienstSL: TDienstSL;

..
..

procedure TDienstSL.ServiceCreate(Sender: TObject);
begin
  SL:=TSL.create();
  self. ServiceStartName:='DienstSL';
end;


2. warum der Kontenname ist nicht vorhanden? sollte das /install den nicht anlegen?

3. wenn das /install funktioniert steht das unter msconfig-> dienste drinnen, oder?
muss ich den pc neu starten damit der zum 1. mal lauft?

€dit; nach langem suchen bin ich dahinter gekommen das das ServiceStartName etwas ganz anderes ist und ich das einfach wegtun musste

das zum Einstellen des Dienstnamen heißt DisplayName