Delphi-PRAXiS
Seite 1 von 4  1 23     Letzte »    

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Lazarus (IDE) (https://www.delphipraxis.net/81-lazarus-ide/)
-   -   Netzwerkabbrüche oder Programm schließt sich einfach (https://www.delphipraxis.net/196937-netzwerkabbrueche-oder-programm-schliesst-sich-einfach.html)

Matthias LE 2. Jul 2018 11:52

Netzwerkabbrüche oder Programm schließt sich einfach
 
Hallo liebe Community,

weiß kein Rat. Habe mehrere Anwendungen in Lazarus geschrieben. Mein Problem ist, sobald ich diese Tools auf ein Laufwerk im Netzwerk lege und von dort aus auf den Clients verknüpfe (also die Anwendungs.exe) habe ich das Problem, das es öfters mal vorkommt das sich das Programm einfach so schließt.

Woran kann das liegen bzw. wie kann man sowas abfangen?

Danke im voraus.
Matthias

KodeZwerg 2. Jul 2018 11:57

AW: Netzwerkabbrüche oder Programm schließt sich einfach
 
Falls Lazarus auch PEFlags setzen kann, Versuche das hier in deiner .dpr Datei einzufügen:
Delphi-Quellcode:
//0x0400 IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP If the image is on removable media, copy and run from the swap file.
//0x0800 IMAGE_FILE_NET_RUN_FROM_SWAP If the image is on the network, copy and run from the swap file.
{$SetPEFlags IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP or IMAGE_FILE_NET_RUN_FROM_SWAP}

Matthias LE 2. Jul 2018 12:02

AW: Netzwerkabbrüche oder Programm schließt sich einfach
 
Vielen Dank KodeZwerg

muss gestehen, das ich scheinbar nicht genug Ahnung habe um das umzusetzen was du als Lösung geschrieben hast. :-D 8-)

KodeZwerg 2. Jul 2018 12:10

AW: Netzwerkabbrüche oder Programm schließt sich einfach
 
Ich bin ungeeignet um eine Antwort zu geben die sich auf Lazarus beschränkt aber in Delphi Worten erkläre ich es Dir gerne.
Delphi-Quellcode:
{$SetPEFlags IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP or IMAGE_FILE_NET_RUN_FROM_SWAP}
ist eine Direktive.
Eine Anweisung an den Compiler etwas spezielles in die .exe Datei zu schreiben.
Dieses spezielle ist in diesem Fall IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP und IMAGE_FILE_NET_RUN_FROM_SWAP.
Das Bewirkt das die .exe Datei beim start voll in den Speicher geladen wird, das sollte Abstürze über Netzlaufwerke verhindern.

Die .dpr Datei ist in Delphi die Projekt-Datei mit der alles beginnt.

Ich hoffe es ist verständlich.

Matthias LE 2. Jul 2018 12:21

AW: Netzwerkabbrüche oder Programm schließt sich einfach
 
bei Lazarus müsste das dann die .lpr sein, würde ich sagen. Kann ich das direkt in die Datei schreiben?

program project1;

{$mode objfpc}{$H+}

uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Interfaces, // this includes the LCL widgetset
Forms, datetimectrls, printer4lazarus, Unit1, Unit2, Unit3, Unit4, Unit5,
Unit6, Unit7, Unit8, Unit9, Unit10, Unit11, Unit12, Unit13, Unit14
{ you can add units after this };

{$R *.res}

begin
RequireDerivedFormResource := True;
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.CreateForm(TForm2, Form2);
Application.CreateForm(TForm3, Form3);
Application.CreateForm(TForm4, Form4);
Application.CreateForm(TForm5, Form5);
Application.CreateForm(TForm6, Form6);
Application.CreateForm(TForm7, Form7);
Application.CreateForm(TForm8, Form8);
Application.CreateForm(TForm9, Form9);
Application.CreateForm(TForm10, Form10);
Application.CreateForm(TForm11, Form11);
Application.CreateForm(TForm12, Form12);
Application.CreateForm(TForm13, Form13);
Application.CreateForm(TForm14, Form14);
Application.Run;
end.

KodeZwerg 2. Jul 2018 12:26

AW: Netzwerkabbrüche oder Programm schließt sich einfach
 
Das ist schonmal die korrekte Datei! Es kann sein das Du bei uses noch "Windows" einbinden musst für die deklaration der Flags, ansonsten passt es so.
Delphi-Quellcode:
...

uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Interfaces, // this includes the LCL widgetset
Forms, datetimectrls, printer4lazarus, Unit1, Unit2, Unit3, Unit4, Unit5,
Unit6, Unit7, Unit8, Unit9, Unit10, Unit11, Unit12, Unit13, Unit14
{ you can add units after this };

{$SetPEFlags IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP or IMAGE_FILE_NET_RUN_FROM_SWAP}

...

edit
Beim zweiten mal raufschauen was Du da in uses lädst, ist Dein Ziel-System Windows?
Mein tipp gilt nur für Windows Anwendungen!

Matthias LE 2. Jul 2018 12:35

AW: Netzwerkabbrüche oder Programm schließt sich einfach
 
Fehlermeldung - {$SetPEFlags IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP or IMAGE_FILE_NET_RUN_FROM_SWAP} project1.lpr(19,2) Error: Identifier not found "IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP"

Nutze ich nur {$SetPEFlags} kompiliert Lazarus erfolgreich.

KodeZwerg 2. Jul 2018 12:40

AW: Netzwerkabbrüche oder Programm schließt sich einfach
 
Es ist nicht ratsam aber man kann es auch so machen:
Delphi-Quellcode:
{$SetPEFlags $400 or $800}
Das gilt nur für Windows-Anwendungen!

Matthias LE 2. Jul 2018 12:50

AW: Netzwerkabbrüche oder Programm schließt sich einfach
 
es funktioniert. :-D Ab jetzt beobachten wie sich die Programme so verhalten im Netzwerk.

Vielen Dank bis hierher. Ich melde mich, falls es noch nicht reicht. 8-)

Edit: ich lasse das Topic hier noch offen

KodeZwerg 2. Jul 2018 13:00

AW: Netzwerkabbrüche oder Programm schließt sich einfach
 
Da ich noch keine Antwort auf meine Frage ob Ziel-System Windows ist habe ich hier eine Limitation dafür eingebaut.
Ich würde es vielleicht so machen:
Delphi-Quellcode:
uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
{$IFDEF Windows}
Windows,
{$ENDIF}
Interfaces, // this includes the LCL widgetset
Forms, datetimectrls, printer4lazarus, Unit1, Unit2, Unit3, Unit4, Unit5,
Unit6, Unit7, Unit8, Unit9, Unit10, Unit11, Unit12, Unit13, Unit14
{ you can add units after this };

{$IFDEF Windows}
{$SetPEFlags IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP or IMAGE_FILE_NET_RUN_FROM_SWAP}
{$ENDIF}
So wäre es vielleicht die sicherere Methode? Entscheide Du!


Alle Zeitangaben in WEZ +1. Es ist jetzt 02:49 Uhr.
Seite 1 von 4  1 23     Letzte »    

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz