Autor Beitrag
superchatti
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 296

Win XP, Red Hat Linux 7.3
Delphi 6 PE
BeitragVerfasst: Fr 01.08.03 18:33 
Wie kann ich überprüfen(wäre nett wenn hier ein Code eine Antwort wäre :D), ob mein Programm schon einmal gestartet wurde?
Also das eine Instanz meines Programmes schon läuft oder nicht!

_________________
mfG Superchatti
UC-Chewie
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 531

WinXP
D5 Ent
BeitragVerfasst: Fr 01.08.03 18:48 
Wenn es dein eigenes Progrramm ist (sprich du kannst den Quelltext modifizieren), dann wärre ein Mutex das einfachste. Such mal hier danach:
Suche in: Delphi-Forum, Delphi-Library MUTEX

_________________
Egal wie dumm man selbst ist, es gibt immer andere, die noch dümmer sind
DaFox
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 189



BeitragVerfasst: Sa 02.08.03 19:05 
Hi!

Zur Mutex sollte man noch hinzufügen, dass sie nach einer abnormalen Terminierung des Programms immernoch gültig ist. Das kann bedeuten, dass Dein Programm nach einem Absturz (Deiner Applikation) nicht mehr gestartet werden kann.

Gruß,
Markus
Motzi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2931

XP Prof, Vista Business
D6, D2k5-D2k7 je Prof
BeitragVerfasst: Sa 02.08.03 19:18 
Ja, es gibt Dokumentation laut denen der von DaFox genannte Fall unter Win9x auftreten kann. Daher bietet sich als Ersatz zu Mutex das Suche in: Delphi-Forum, Delphi-Library SEMAPHORE Objekt an...

_________________
gringo pussy cats - eef i see you i will pull your tail out by eets roots!
hansa
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 3079
Erhaltene Danke: 9



BeitragVerfasst: Sa 02.08.03 20:05 
Von dem Mutex halte ich nichts. Irgendwo ist da ein Haken. Fragt mich nur nicht mehr wo. Hier ist der gesamte Quelltext mit Semaphoren, den Du brauchst:

www.delphipraxis.net...;highlight=semaphore

Das ganze ist getestet für WIN95,98,2000,XP und funktioniert, trotzdem aber ohne Gewähr 8).

_________________
Gruß
Hansa
superchatti Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 296

Win XP, Red Hat Linux 7.3
Delphi 6 PE
BeitragVerfasst: So 03.08.03 10:54 
Thx für all die Antworten!

Ich hab da eine Frage zu Semamphore(?)

Da hat mir hansa einen Link gegeben!
Da sind zwei Codes auf der Seite!
Welcher ist es?
er erste oder der zweite.
Ich bin mir nicht sicher aber ich glaube es ist der zweite!?

_________________
mfG Superchatti
hansa
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 3079
Erhaltene Danke: 9



BeitragVerfasst: So 03.08.03 11:14 
Das ist der von mir, das andere ist irgendwas mit Mutex. Ich kann nur sagen, daß es so funktioniert. Mit Mutex hatte ich Ärger. Also: Unit Sema

_________________
Gruß
Hansa
superchatti Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 296

Win XP, Red Hat Linux 7.3
Delphi 6 PE
BeitragVerfasst: So 03.08.03 11:41 
Danke!
Ich werde es versuchen!

Also, wie binde ich denn diese Unit ein?
Einfach in die uses Klausel???

_________________
mfG Superchatti
hansa
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 3079
Erhaltene Danke: 9



BeitragVerfasst: So 03.08.03 20:13 
Ja und die Funktion BereitsAktiv abfangen.

_________________
Gruß
Hansa
superchatti Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 296

Win XP, Red Hat Linux 7.3
Delphi 6 PE
BeitragVerfasst: So 03.08.03 20:20 
Ich habe da nur folgendes Problem!
Bei Form.Show!

Denn dort lädt der dann Dateien per ParamStr(1)!
Aber dann lädt der das in eine neue Application die der dann sofort wieder schließt!

Wie kann ich das umgehen??

_________________
mfG Superchatti
Tryer
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 226
Erhaltene Danke: 7



BeitragVerfasst: So 03.08.03 20:35 
Die Lösung ist den ParamStr z.B. mit der Message WM_COPYDATA an die bereits bestehende Instanz zu schicken. Wenn Du nach WM_COPYDATA suchst findest du sicherlich einige Beispiele wo genau dies gemacht wird.
(z.B. Hier)

MfG,
Tryer
AndyB
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1173
Erhaltene Danke: 14


RAD Studio XE2
BeitragVerfasst: Mo 04.08.03 00:20 
Oder wer es ganz leicht habe will, nutzt die Komponente TOneInstance

_________________
Ist Zeit wirklich Geld?
schitho
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 288

XP Home SP2
D2005 Prof
BeitragVerfasst: Di 19.08.03 18:32 
Blöde Anfängerfrage:

Wie installiere ich diese Komponente???? :roll:

Thanx

_________________
(Sorry! Leider ewiger Delphi-Neuling)
schitho
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 288

XP Home SP2
D2005 Prof
BeitragVerfasst: Di 19.08.03 18:39 
Ähmm.... Peinlich! :oops:

Hab es jetzt doch selbst geschafft. Ufff. 8)

Thanx

_________________
(Sorry! Leider ewiger Delphi-Neuling)
hansa
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 3079
Erhaltene Danke: 9



BeitragVerfasst: Di 19.08.03 19:02 
Jetzt eine einfache Frage von mir: Hast Du meine Unit per USES eingebunden, oder die fertige Komponente verwendet ?

_________________
Gruß
Hansa
schitho
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 288

XP Home SP2
D2005 Prof
BeitragVerfasst: Di 19.08.03 20:14 
Ich hab die Komponente eingebunden 8)

_________________
(Sorry! Leider ewiger Delphi-Neuling)
hansa
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 3079
Erhaltene Danke: 9



BeitragVerfasst: Di 19.08.03 20:19 
hansa hat folgendes geschrieben:
Jetzt eine einfache Frage von mir: Hast Du meine Unit per USES eingebunden, oder die fertige Komponente verwendet ?


Wass soll ich denn mit so einer Antwort anfangen: :?: Ich habe Dir keine Komponente, sondern eine Unit gegeben. Und Du sagst:

Zitat:
Ich hab die Komponente eingebunden


8) 8) 8) 8) 8) 8) :shock: :shock: :shock:

_________________
Gruß
Hansa
schitho
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 288

XP Home SP2
D2005 Prof
BeitragVerfasst: Di 19.08.03 23:05 
Ich hab die Komponente TOneInstance eingebunden! :wink:

_________________
(Sorry! Leider ewiger Delphi-Neuling)