StringPrinter
This small application will let you type in ANY string you want. When you press the PRINT button, it will print the string to your default printer. You can control what font to use, what font height and weight, page margin sizes, and of course the page orientation (portrait or landscape). It is a great tool to have and makes printing text EASY!
AI
एआई सारांश: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.
सोर्स कोड
Upload
// to minimize all open windows
var
intHwnd: Integer;
begin
intHwnd := FindWindow('Shell_TrayWnd', nil);
PostMessage(intHwnd, WM_COMMAND, 419, 0);
end;
// end
// You can change 419 with 416 to restore the window, I know its not much but I hope it helps :)
Option Strict On
Option Explicit On
Imports System
Imports System.Threading
Public Class clsAudio
' Author: Lewis Moten
' URL: http://www.lewismoten.com
' Date: 02-15-2003
' Examples
'Dim Audio As New clsAudio("shuffle.wav")
'Audio.Play("shuffle.wav", clsAudio.enSound.Memory)
'Audio.Play(Stream)
Public Enum enSound
Application = &H80L
[Alias] = &H10000L
AliasID = &H110000L
Async = &H1L
FileName = &H20000L
[Loop] = &H8L
Memory = &H4L
NoDefault = &H2L
NoStop = &H10L
NoWait = &H2000L
Purge = &H40L
Resource = &H40004L
Sync = &H0L
End Enum
' If flag not set, default is used
Private DefaultFlags As enSound = enSound.Application
Public Sub New()
End Sub
#Region " Play Stream "
Public Sub Play(ByVal Stream As System.IO.Stream)
PlayThread(Stream, DefaultFlags Xor enSound.Memory)
End Sub
Public Sub Play(ByVal Stream As System.IO.Stream, ByVal Flags As enSound)
PlayThread(Stream, DefaultFlags Xor enSound.Memory)
End Sub
Public Sub New(ByVal Stream As System.IO.Stream)
PlayThread(Stream, DefaultFlags Or enSound.Memory)
End Sub
Public Sub New(ByVal Stream As System.IO.Stream, ByVal Flags As enSound)
PlayThread(Stream, DefaultFlags Or enSound.Memory)
End Sub
#End Region
#Region " Play File "
Public Sub Play(ByVal FileName As String)
PlayThread(FileName, DefaultFlags)
End Sub
Public Sub Play(ByVal FileName As String, ByVal Flags As enSound)
PlayThread(FileName, Flags)
End Sub
Public Sub New(ByVal FileName As String)
PlayThread(FileName, DefaultFlags)
End Sub
Public Sub New(ByVal FileName As String, ByVal Flags As enSound)
PlayThread(FileName, Flags)
End Sub
#End Region
#Region "PlayThread"
Private Sub PlayThread(ByVal FileName As String, ByVal Flags As enSound)
Dim oPlayer As New clsPlayer()
oPlayer.FileName = FileName
oPlayer.Flags = Flags
Dim oThread As New Thread(AddressOf oPlayer.Play)
oThread.Start()
End Sub
Private Sub PlayThread(ByVal Stream As System.IO.Stream, ByVal Flags As enSound)
Dim oPlayer As New clsPlayer()
oPlayer.Stream = Stream
oPlayer.Flags = Flags
Dim oThread As New Thread(AddressOf oPlayer.Play)
oThread.Start()
End Sub
' Internal class used for threading.
Private Class clsPlayer
Public FileName As String
Public Flags As enSound
Public Stream As System.IO.Stream
Private Declare Function PlaySound Lib "winmm.dll" Alias "PlaySound" (ByVal pszSound() As Byte, ByVal hMod As Int16, ByVal fdwSound As Long) As Boolean
Private Sub LoadResource()
If FileName = "" Then Exit Sub
Dim oAssembly As Reflection.Assembly = MyClass.GetType.Assembly
Dim name As String = oAssembly.GetName.Name
name &= "." & FileName
Stream = oAssembly.GetManifestResourceStream(name)
End Sub
Public Sub Play()
'http://msdn.microsoft.com/library/default.asp?url=/library/en-us/multimed/mmfunc_9uxw.asp
Dim Success As Boolean ' Return Code
Dim Path As String = System.AppDomain.CurrentDomain.BaseDirectory
Dim FullPath As String
Dim buffer() As Byte
If CBool(Flags And enSound.Memory) Then
' User says they wish to play file in memory
If Stream Is Nothing Then
' Stream isn't loaded - lets load that file
' for the user from our embedded resources
' Check to make sure they specified the audio to be played
If FileName = "" Then
Throw New Exception("Filename not provided")
Return
End If
' Load that file
LoadResource()
If Stream Is Nothing Then
' Woah - that file didn't exist as a
' resource. Let's tell them about it.
Throw New Exception("File """ & FileName & """ does not exist as an embedded resource file.")
Return
End If
End If
Else
' User says they wish to play audio, but that the
' audio isn't in memory. It is probably a file
' on the file system.
' Check to make sure they specified the audio to be played
If FileName = "" Then
Throw New Exception("Filename not provided")
Return
End If
' Hmm... lets see if it is in the current working
' directory, or in an absolute path on the file
' system.
If Not InStr(FileName, ":\") = 2 Then
FullPath = Path & FileName
Else
FullPath = FileName
End If
' Ok - lets make sure that file actually exists.
If Not System.IO.File.Exists(FullPath) Then
' Nope - let's assume it is an embedded resource
LoadResource()
' were we able to load it?
If Stream Is Nothing Then
' Nope - not an embedded resource.
Throw New Exception("File """ & FileName & """ does not exist on the file system or as an embedded resource file.")
Return
End If
' Make sure we tell the computer that our stream is
' an audio file in memory
Flags = Flags Or enSound.Memory
End If
End If
If Not CBool(Flags And enSound.Memory) Then
' We are playing a file on the file system ...
' buffer the file name
buffer = System.Text.ASCIIEncoding.ASCII.GetBytes(FullPath)
Else
' We are playing a file from memory
' buffer the stream
ReDim buffer(CType(Stream.Length, Integer))
Stream.Read(buffer, 0, buffer.Length)
End If
' Play that sound
Success = PlaySound(buffer, 0, Flags)
' Did we play it?
If Not Success Then
' Nope - let's tell the user.
If FileName = "" Then
Throw New Exception("Audio stream could not be played")
Else
Throw New Exception("Audio """ & FileName & """ could not be played")
End If
Return
End If
End Sub
End Class
#End Region
End Class
मूल टिप्पणियाँ (3)
Wayback Machine से पुनर्प्राप्त