MSG2Server verbessert

This commit is contained in:
ms
2025-03-18 13:43:25 +01:00
parent d275cf320d
commit a46d9cff23
6 changed files with 55 additions and 4 deletions

View File

@@ -5,6 +5,7 @@ Imports System.Security
Imports System.Diagnostics
Imports System.Text
Imports System.Web
Imports iTextSharp.text.pdf.codec
Public Class cExtProgramme
@@ -123,6 +124,28 @@ Public Class cExtProgramme
End Try
End Function
Public Shared Function msg2server(nachricht As String, server As String)
Dim batfile As String = "msgsend.bat"
Dim args As String = """" & nachricht & """" & " " & server
' MsgBox(args)
Dim psi As New ProcessStartInfo()
psi.FileName = "cmd.exe"
psi.Arguments = "/c """ & batFile & " " & args & """"
psi.RedirectStandardOutput = True
psi.UseShellExecute = False
psi.CreateNoWindow = True
Try
Dim process As Process = Process.Start(psi)
Dim output As String = process.StandardOutput.ReadToEnd()
process.WaitForExit()
Console.WriteLine(output)
Catch ex As Exception
Console.WriteLine("Fehler beim Starten der Batch-Datei: " & ex.Message)
End Try
End Function
Public Shared Function StartTeamviewer(ID As String, Optional Passwort As String = "BmWr501956")
Dim p As String = ""
If Passwort.Length < 1 Then

View File

@@ -683,6 +683,9 @@
<None Include="DokuDataSet.xss">
<DependentUpon>DokuDataSet.xsd</DependentUpon>
</None>
<None Include="msgsend.bat">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="My Project\app.manifest" />
<None Include="My Project\Application.myapp">
<Generator>MyApplicationCodeGenerator</Generator>

View File

@@ -319,7 +319,7 @@ Namespace My.Resources
End Property
'''<summary>
''' Sucht eine lokalisierte Zeichenfolge, die 0.0.2.02 ähnelt.
''' Sucht eine lokalisierte Zeichenfolge, die 0.0.2.04 ähnelt.
'''</summary>
Friend ReadOnly Property Version() As String
Get

View File

@@ -137,7 +137,7 @@
<value>..\Resources\mail20.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Version" xml:space="preserve">
<value>0.0.2.02</value>
<value>0.0.2.04</value>
</data>
<data name="Link1" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Link.bmp;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>

18
Dokumentation/msgsend.bat Normal file
View File

@@ -0,0 +1,18 @@
@echo off
if "%~2"=="" (
echo Nutzung: %~nx0 "Nachricht" Computer1 Computer2 Computer3 ...
exit /b 1
)
set "Nachricht=%~1"
shift
:loop
if "%~1"=="" goto :end
echo Sende Nachricht an %~1...
msg * /server:%~1 %Nachricht%
shift
goto loop
:end
echo Nachricht wurde gesendet.

View File

@@ -144,10 +144,17 @@ Public Class uscntr_SendMSG
If SingleUserRec = True Then
cExtProgramme.msgsend(msgfin)
Else
Dim serverlist As String = ""
For Each srv As String In recserver
cExtProgramme.msgsend(String.Format(msg, "*", srv, TextBox1.Text))
Threading.Thread.Sleep(3000)
serverlist &= srv & " "
' cExtProgramme.msgsend(String.Format(msg, "*", srv, TextBox1.Text))
'Threading.Thread.Sleep(3000)
Next
serverlist = serverlist.Substring(0, serverlist.Length - 1)
'MsgBox(serverlist)
cExtProgramme.msg2server(TextBox1.Text, serverlist)
End If
End Function