AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Win32/Win64 API (native code) limiting number of instances in Windows terminal server
Thema durchsuchen
Ansicht
Themen-Optionen

limiting number of instances in Windows terminal server

Ein Thema von imadam · begonnen am 4. Jun 2019 · letzter Beitrag vom 5. Jun 2019
Antwort Antwort
Benutzerbild von Dalai
Dalai

Registriert seit: 9. Apr 2006
1.684 Beiträge
 
Delphi 5 Professional
 
#1

AW: limiting number of instances in Windows terminal server

  Alt 5. Jun 2019, 08:40
Yes, reading the number of processes running as user X is another possible approach. Unfortunately I don't know how to read the user a process runs as, even less when TS is involved.

Regards
Dalai
  Mit Zitat antworten Zitat
hoika

Registriert seit: 5. Jul 2006
Ort: Magdeburg
8.277 Beiträge
 
Delphi 10.4 Sydney
 
#2

AW: limiting number of instances in Windows terminal server

  Alt 5. Jun 2019, 08:52
Hello,
use a GUID as (global) Mutex-Name with _1, _2 and so on.

if _1 is used, use _2.
if _x is used, you have your maximum instances ...

quick&dirty


or just said: use JEDI JvAppInst.pas
hey use some form of hidden window for each instance
Heiko

Geändert von hoika ( 5. Jun 2019 um 08:56 Uhr)
  Mit Zitat antworten Zitat
mjustin

Registriert seit: 14. Apr 2008
3.010 Beiträge
 
Delphi 2009 Professional
 
#3

AW: limiting number of instances in Windows terminal server

  Alt 5. Jun 2019, 09:00
Yes, reading the number of processes running as user X is another possible approach. Unfortunately I don't know how to read the user a process runs as, even less when TS is involved.
It is easy to count the instances running in the current session. Example in .Net:

Code:
private static int CountApplicationInstances()
    {
        var currentProcess = Process.GetCurrentProcess();
        var processes = Process.GetProcessesByName(currentProcess.ProcessName);

        // test if there's another process running in current session.
        var intTotalRunningInCurrentSession = processes.Count(prc => prc.SessionId == currentProcess.SessionId);

        return intTotalRunningInCurrentSession;
    }
(based on https://stackoverflow.com/a/36210660/80901)
Michael Justin
habarisoft.com
  Mit Zitat antworten Zitat
Antwort Antwort

 

Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 07:13 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz