Atlanta Custom Software Development 

 
   Search        Code/Page
 

User Login
Email

Password

 

Forgot the Password?
Services
» Web Development
» Maintenance
» Data Integration/BI
» Information Management
Programming
  Database
Automation
OS/Networking
Graphics
Links
Tools
» Regular Expr Tester
» Free Tools

WriteToStdOutput - Write to standard output stream

Total Hit ( 2424)

Rate this article:     Poor     Excellent 

 Submit Your Question/Comment about this article

Rating


 



Click here to copy the following block
Option Explicit

Private Declare Function GetStdHandle Lib "kernel32" (ByVal nStdHandle As Long) _
  As Long
Private Declare Function WriteFile Lib "kernel32" (ByVal hFile As Long, _
  lpBuffer As Any, ByVal nNumberOfBytesToWrite As Long, _
  lpNumberOfBytesWritten As Long, lpOverlapped As Any) As Long

Private Const STD_OUTPUT_HANDLE = -11&

' write to standard output channel
'
' NOTE: this routine works only in compiled applications

Sub WriteToStdOutput(ByVal Text As String)
  Dim hStdOut As Long
  Dim ret As Long
  Dim bytesWritten As Long
  
  ' get the handle of standard output
  hStdOut = GetStdHandle(STD_OUTPUT_HANDLE)
  
  ' write to standard output
  ret = WriteFile(hStdOut, ByVal Text, Len(Text), bytesWritten, ByVal 0&)
  
  ' deal with errors
  If ret = 0 Then
    Err.Raise 1001, , "Unable to write to standard output"
  ElseIf bytesWritten < Len(Text) Then
    Err.Raise 1002, , "Incomplete write operation"
  End If
End Sub


Submitted By : Nayan Patel  (Member Since : 5/26/2004 12:23:06 PM)

Job Description : He is the moderator of this site and currently working as an independent consultant. He works with VB.net/ASP.net, SQL Server and other MS technologies. He is MCSD.net, MCDBA and MCSE. In his free time he likes to watch funny movies and doing oil painting.
View all (893) submissions by this author  (Birth Date : 7/14/1981 )


Home   |  Comment   |  Contact Us   |  Privacy Policy   |  Terms & Conditions   |  BlogsZappySys

© 2008 BinaryWorld LLC. All rights reserved.