Thread View: be.comp.programming
4 messages
4 total messages
Started by Marc DEVLIEGER
Thu, 31 Oct 2002 19:17
dosgegevens in een tekstveld in VB60
Author: Marc DEVLIEGER
Date: Thu, 31 Oct 2002 19:17
Date: Thu, 31 Oct 2002 19:17
8 lines
1191 bytes
1191 bytes
Hoi, hoe kan ik de IPCONFIG en NETSTAT gegevens in een tekstveld krijgen in VB6.0 Groeten, Marc DV
Re: dosgegevens in een tekstveld in VB60
Author: Tim A.
Date: Fri, 01 Nov 2002 23:18
Date: Fri, 01 Nov 2002 23:18
16 lines
1428 bytes
1428 bytes
"Marc DEVLIEGER" <Marc.Devlieger@pandora.be> schreef in bericht news:ylfw9.189256$8o4.30198@afrodite.telenet-ops.be... > > Hoi, hoe kan ik de IPCONFIG en NETSTAT gegevens in een > tekstveld krijgen in VB6.0 > > Groeten, > > > Marc DV > Foefeloplossing: shell "nedstat > c:\file.txt" Vervolgens file.txt inlezen in de multilinetextbox ?
Re: dosgegevens in een tekstveld in VB60
Author: Wauters Kris
Date: Sat, 02 Nov 2002 12:06
Date: Sat, 02 Nov 2002 12:06
90 lines
4269 bytes
4269 bytes
>
> shell "nedstat > c:\file.txt"
> Vervolgens file.txt inlezen in de multilinetextbox ?
>
heu, ge gaat waarschijnlijk op die manier die file.txt al beginnen inlezen
alvorens die is aangemaakt.
(shell start dat commando op, en gaat terwijl al verder in VB)
dit is "ietsje" properder :
Private Declare Function WaitForSingleObject Lib "kernel32" (ByVal hHandle
As Long, ByVal dwMilliseconds As Long) As Long
Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long)
As Long
Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess
As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
Private Declare Function GetTempPath Lib "kernel32" Alias "GetTempPathA"
(ByVal nBufferLength As Long, ByVal lpBuffer As String) As Long
Private Declare Function GetTempFileName Lib "kernel32" Alias
"GetTempFileNameA" (ByVal lpszPath As String, ByVal lpPrefixString As
String, ByVal wUnique As Long, ByVal lpTempFileName As String) As Long
Private Const INFINITE = -1&
Private Const SYNCHRONIZE = &H100000
Private Const MAX_PATH = 260
Private Const CCHDEVICENAME = 32
Private Const CCHFORMNAME = 32
Private Const SRCCOPY = &HCC0020 ' (DWORD) destination = source
Public Sub ShellProgramAndWaitToFinish(StrPassedProgramToShell As String)
Dim LongiTask As Long, LongRet As Long, LongpHandle As Long
LongiTask = Shell(StrPassedProgramToShell, vbNormalFocus)
LongpHandle = OpenProcess(SYNCHRONIZE, False, LongiTask)
LongRet = WaitForSingleObject(LongpHandle, INFINITE)
LongRet = CloseHandle(LongpHandle)
If Err > 0 Then
MsgBox CStr(Err.Number) & ":" & Err.Description & " " & ProgramToShell,
vbInformation, "ShellProgramAndWaitToFinish"
End If
End Sub
Public Function CreateTempFile() As String
Dim StrTempDir As String
Dim StrTmpFile As String
Dim LongR As Long
StrTempDir = Space$(MAX_PATH)
LongR = GetTempPath(MAX_PATH, StrTempDir)
StrTempDir = Left$(StrTempDir, LongR)
StrTmpFile = Space$(MAX_PATH)
LongR = GetTempFileName(StrTempDir, "TMP", 0, StrTmpFile)
If LongR <> 0 Then
StrTmpFile = Left$(StrTmpFile, InStr(StrTmpFile, Chr$(0)) - 1)
CreateTempFile = StrTmpFile
Else
CreateTempFile = ""
End If
End Function
als je bovenstaande code toevoegt in je applicatie, kan je dit doen:
dim StrTmpBestandsnaam as string
dim IntI as integer
dim StrTmpString as string
StrTmpBestandsnaam = CreateTempFile
ShellProgramAndWaitToFinish("ipconfig >" & StrTmpBestandsNaam)
IntI = FreeFile()
Open StrTmpBestandsNaam for input as #IntI
while not eof(IntI)
textbox.text = textbox.text & line input#IntI,StrTmpString & VBCrLf
wend
close inti
kill StrTmpBestandsnaam
het cre�ren van een TempFile zorgt ervoor dat je geen fout krijgt als je
geen rechten zou hebben op de C-schijf ofzo,
(of als je windows op een D zou ge�nstalleerd zijn ofzo)
die ShellProgramAndWaitToFinish wacht tot het shell commando is uitgevoerd
en afgelopen alvorens terug verder te gaan met je VB applicatie.
Groeten,
Kris
Re: dosgegevens in een tekstveld in VB60
Author: Franky Braem
Date: Sat, 02 Nov 2002 13:36
Date: Sat, 02 Nov 2002 13:36
20 lines
1382 bytes
1382 bytes
Hallo Marc, Op mijn website http://users.skynet.be/saw kan je een control downloaden die ik geschreven heb voor het redirecten van DOS-output. 't Is geschreven in C++, maar je kan het even goed in VB gebruiken. Franky. "Marc DEVLIEGER" <Marc.Devlieger@pandora.be> wrote in message news:ylfw9.189256$8o4.30198@afrodite.telenet-ops.be... > > Hoi, hoe kan ik de IPCONFIG en NETSTAT gegevens in een > tekstveld krijgen in VB6.0 > > Groeten, > > > Marc DV > >
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads