-
stdout -- Why is it so hard?
So I am trying to pass a value back to stdout after executing a VB application
with command switches from command line. Although it appears to get a valid
handle, nothing is returned to the shell session.
Here is what I am doing.....
Option Explicit
Public Const STD_OUTPUT_HANDLE = -11&
Public Declare Function w32_stdout Lib "kernel32" Alias "GetStdHandle" _
(Optional ByVal Handletype As Long = STD_OUTPUT_HANDLE) As Long
Public Declare Function WriteFile Lib "kernel32" _
(ByVal hFile As Long, ByVal lpBuffer As Any, ByVal nNumberOfBytesToWrite
As Long, _
lpNumberOfBytesWritten As Long, Optional ByVal lpOverlapped As Long = 0&)
As Long
Public Function stdout()
Dim sWriteBuffer As String
Dim lBytesWritten As Long
Dim hStdOut As Long
'Send something to stdout
sWriteBuffer = "This really sucks!" & vbCrLf
hStdOut = w32_stdout()
WriteFile hStdOut, sWriteBuffer, Len(sWriteBuffer) + 1, lBytesWritten
End Function
Any suggestions on how to return a value to the command line via stdout or
another method? I hate to say it but in C this is cake. Why does it have
to be so hard in VB.
Thanks!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks