viewtopic.php?p=78024#p78024
but someone know how read the french characters with accent ?
numro = numéro
srie = série
Rpertoire = Répertoire
Le volume dans le lecteur C s'appelle Neptune
Le numro de srie du volume est 2ADC-090B
Rpertoire de c:\
Code: Select all
Global pi.PROCESS_INFORMATION
Global hWritePipe.l,hReadPipe.l,PipeMem.l,PipeString$
Global compx.l,last.s
PipeMem=AllocateMemory(1024)
Procedure GetOutPut()
bytesread.l = 0
r.l=PeekNamedPipe_(hreadPipe,0,0,0,@bytesread,0)
If bytesread>0
o.l=ReadFile_(hReadPipe,PipeMem,1023,@bytesread,0)
If o
For f.l=0 To bytesread-1
t.b=PeekB(PipeMem+f)
If t=10
PrintN(PipeString$)
PipeString$=""
Else
If t>31 And t<128
PipeString$+Chr(t)
EndIf
EndIf
Next
EndIf
EndIf
EndProcedure
Procedure RunCommand(cmd.s,path.s)
sa.SECURITY_ATTRIBUTES
sa\nLength=SizeOf(SECURITY_ATTRIBUTES)
sa\bInheritHandle=1
sa\lpSecurityDescriptor=0
xx.l=CreatePipe_(@hReadPipe,@hWritePipe,@sa,1)
si.STARTUPINFO
si\cb=SizeOf(STARTUPINFO)
si\dwFlags=#STARTF_USESTDHANDLES|#STARTF_USESHOWWINDOW
si\hStdOutput=hWritePipe
si\hStdError=hWritePipe
cmdcom$=Space(255)
GetEnvironmentVariable_("comspec",@cmdcom$,255)
If cmdcom$="command.com"
cmdcom$+" "
Else
cmdcom$+" /C "
EndIf
If FileSize(path)=-2
pathaddr=@path
Else
pathaddr=0
EndIf
ProcedureReturn CreateProcess_(0,cmdcom$+cmd,@sa,@sa,1,#CREATE_NEW_CONSOLE,0,pathaddr,@si,@pi)
EndProcedure
OpenConsole()
PipeString$=""
If RunCommand("dir","c:/")
exitcode.l=259
While exitcode=259
t=GetExitCodeProcess_(pi\hProcess,@exitcode)
If exitcode=259
GetOutPut()
EndIf
Wend
PrintN("*** Finished - Press Enter ***")
CloseHandle_(hWritePipe)
Else
Debug GetLastError_()
EndIf
Input()
CloseConsole()