|
Getting a client to beep through telnet can be a very complicated task. Pragma TelnetServer's Advanced Console and wrapper technology have allowed a system beep from a server application to pass to the client without any customization. Also with a slight modification an echo of beep to the console can also be passed.
Here is some sample code to beep from an application
VB
Imports System
Imports System.Threading
Imports System.Net
Imports System.Net.Sockets
Module Module1
Private welcomeMessage As String = "Welcome VBBeep"
Private Declare Function GetStdHandle Lib "kernel32" _
(ByVal nStdHandle As Long) As Long
Private Declare Function _
SetConsoleMode Lib "kernel32" _
(ByVal hConsoleOutput As Long, _
ByVal dwMode As Long) As Long
Private Const ENABLE_PROCESSED_OUTPUT As Long = &H1
Private Const STD_OUTPUT_HANDLE As Long = -11&
Sub Main()
' These are 3 ways to beep
Console.WriteLine(welcomeMessage)
' System beep calls with Advanced Console or Wrapper
Console.Beep(200, 300)
Console.Beep(500, 300)
Console.Beep(700, 300)
' Character 7 echo to console with Advanced Console or Wrapper
SetConsoleMode(GetStdHandle(STD_OUTPUT_HANDLE), Not (ENABLE_PROCESSED_OUTPUT))
Console.WriteLine(Chr(7))
Console.WriteLine("Beeped")
End Sub
End Module
C
#include <stdio.h>
#include <windows.h>
void main( int argc, char **argv )
{
DWORD Mode;
HANDLE hOutput = GetStdHandle(STD_OUTPUT_HANDLE);
// System beep calls with Advanced Console or Wrapper
Beep(2128,12);
Beep(1824,4);
Beep(2128,12);
// Character 7 echo to console with Advanced Console or Wrapper
GetConsoleMode( hOutput, &Mode );
Mode &= ~ENABLE_PROCESSED_OUTPUT;
SetConsoleMode( hOutput, Mode );
putchar(7);
printf("%c",7);
putchar(7);
printf("%c",7);
putchar(7);
printf("%c",7);
}
.
|