Click here to Skip to main content
15,922,325 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralCheckbox in Datagrid Pin
partt30-Jul-04 9:18
partt30-Jul-04 9:18 
GeneralVector Pin
fo0lish30-Jul-04 8:33
fo0lish30-Jul-04 8:33 
GeneralRe: Vector Pin
Colin Angus Mackay31-Jul-04 3:28
Colin Angus Mackay31-Jul-04 3:28 
GeneralRe: Vector Pin
fo0lish31-Jul-04 4:03
fo0lish31-Jul-04 4:03 
GeneralGraphical Representation of Sound intensity Pin
alexvw30-Jul-04 7:36
alexvw30-Jul-04 7:36 
GeneralRe: Graphical Representation of Sound intensity Pin
Dave Kreskowiak1-Aug-04 3:59
mveDave Kreskowiak1-Aug-04 3:59 
GeneralRe: Graphical Representation of Sound intensity Pin
ppomor15-Jan-13 7:49
ppomor15-Jan-13 7:49 
GeneralRedirecting Standard output in an unmanaged DLL Pin
madfiddlerchris30-Jul-04 4:56
madfiddlerchris30-Jul-04 4:56 
I have a WINDOWS application that calls an unmanaged DLL (it's a JNI). The DLL redirects standard output and standard error for the JVM that is initiated.

Unfortunately the DLL function returns an error whilst performing this redirection.

I have created a test CONSOLE application which, essentially does the same thing but I have redirected standard output and standard error before calling the function in the DLL and this works fine. Applying the same method in the WINDOWS application does not work and an error is returned

Here is the code for the CONSOLE app (that works)...


Imports System.Runtime.InteropServices
Imports System.IO

Module Module1

<DllImport("myJNI.dll")> _
Public Function myFunction() As Integer
End Function

Sub Main()

Dim returnCode As Int16
Dim stdout, stderr As String
Dim fsStdOut, fsStdErr As StreamWriter

Try
stdout = "c:\out.txt"
fsStdOut = New StreamWriter(stdout)
fsStdOut.AutoFlush = True
Console.SetOut(fsStdOut)
Catch exc As IOException
Debug.WriteLine(exc.Message & "Cannot open " & stdout & " file.")
End Try
Try
stderr = "c:\err.txt"
fsStdErr = New StreamWriter(stderr)
fsStdErr.AutoFlush = True
Console.SetError(fsStdErr)
Catch exc As IOException
Debug.WriteLine(exc.Message & "Cannot open " & stderr & " file.")
End Try

returnCode = myFunction()
Console.WriteLine("myFunction returned " & Str(returnCode))
fsStdOut.Close()
fsStdErr.Close()

End Sub

End Module


So does a .NET WINDOWS application tie up stdout/stderr in some way and if so how can I get around this?


Any help appreciated!


GeneralRe: Redirecting Standard output in an unmanaged DLL Pin
madfiddlerchris30-Jul-04 5:58
madfiddlerchris30-Jul-04 5:58 
Questionmerging projects?? Pin
kowplunk30-Jul-04 4:34
kowplunk30-Jul-04 4:34 
AnswerRe: merging projects?? Pin
Dave Kreskowiak1-Aug-04 3:57
mveDave Kreskowiak1-Aug-04 3:57 
Generalparsing video files in VB Pin
Kevnar30-Jul-04 3:35
Kevnar30-Jul-04 3:35 
GeneralRe: parsing video files in VB Pin
Kevnar1-Aug-04 22:07
Kevnar1-Aug-04 22:07 
GeneralPackage And deployment in VB.NET Pin
Thangaraj P.V.30-Jul-04 2:27
Thangaraj P.V.30-Jul-04 2:27 
GeneralRe: Package And deployment in VB.NET Pin
Dave Kreskowiak30-Jul-04 3:35
mveDave Kreskowiak30-Jul-04 3:35 
GeneralDirectX 9 Pin
Jim Taylor29-Jul-04 23:35
Jim Taylor29-Jul-04 23:35 
GeneralRe: DirectX 9 Pin
Dave Kreskowiak30-Jul-04 3:09
mveDave Kreskowiak30-Jul-04 3:09 
GeneralRe: DirectX 9 Pin
Jim Taylor30-Jul-04 4:01
Jim Taylor30-Jul-04 4:01 
GeneralRe: DirectX 9 Pin
Dave Kreskowiak1-Aug-04 3:55
mveDave Kreskowiak1-Aug-04 3:55 
GeneralRe: DirectX 9 Pin
Jim Taylor1-Aug-04 6:15
Jim Taylor1-Aug-04 6:15 
GeneralIO File Deletion Error Pin
payal sheth29-Jul-04 21:49
payal sheth29-Jul-04 21:49 
GeneralRe: IO File Deletion Error Pin
Dave Kreskowiak30-Jul-04 3:04
mveDave Kreskowiak30-Jul-04 3:04 
Questionhow do you use request command Pin
lxhan29-Jul-04 21:38
lxhan29-Jul-04 21:38 
AnswerRe: how do you use request command Pin
Dave Kreskowiak30-Jul-04 3:01
mveDave Kreskowiak30-Jul-04 3:01 
QuestionCan some 1 plz send me a cyber cafe system code? Pin
vendem29-Jul-04 17:23
vendem29-Jul-04 17:23 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.