Foros del Web » Programación para mayores de 30 ;) » Programación General »

multiprocesos

Estas en el tema de multiprocesos en el foro de Programación General en Foros del Web. hola a todos, alguien pudiera orientarme para saber como puedo hacer que mi aplicación realice dos o mas procesos al mismo tiempo, por ejemplo, realizar ...
  #1 (permalink)  
Antiguo 14/02/2003, 16:07
 
Fecha de Ingreso: agosto-2002
Mensajes: 7
Antigüedad: 21 años, 8 meses
Puntos: 0
multiprocesos

hola a todos, alguien pudiera orientarme para saber como puedo hacer que mi aplicación realice dos o mas procesos al mismo tiempo, por ejemplo, realizar una consulta a un servidor y mientras esto sucede, copiar archivos de un directorio a otro, de antemano muchisimas gracias, salu2
  #2 (permalink)  
Antiguo 15/02/2003, 10:07
Avatar de Jorge_Mota  
Fecha de Ingreso: diciembre-2002
Ubicación: Chapinlandia :-D
Mensajes: 725
Antigüedad: 21 años, 4 meses
Puntos: 11
'Using the CreateThread function in Visual Basic
'is very risky! VB5 is 'kinda' stable, but VB6
'applications will probably crash when you
'use the CreateThread function.

'In a form
'Add a command button to the form
Private Sub Command1_Click()
'KPD-Team 1999
'URL: http://www.allapi.net/
'E-Mail: [email protected]
'After you click this button, try to move the window
'You will see that the AsyncThread-function was executed asynchronously
hThread = CreateThread(ByVal 0&, ByVal 0&, AddressOf AsyncThread, ByVal 0&, ByVal 0&, hThreadID)
CloseHandle hThread
End Sub
Private Sub Form_Unload(Cancel As Integer)
'If the thread is still running, close it
If hThread <> 0 Then TerminateThread hThread, 0
End Sub
'In a module
Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Declare Function CreateThread Lib "kernel32" (lpThreadAttributes As Any, ByVal dwStackSize As Long, ByVal lpStartAddress As Long, lpParameter As Any, ByVal dwCreationFlags As Long, lpThreadID As Long) As Long
Declare Function TerminateThread Lib "kernel32" (ByVal hThread As Long, ByVal dwExitCode As Long) As Long
Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Public hThread As Long, hThreadID As Long
Public Sub AsyncThread()
'Let this thread sleep for 10 seconds
Sleep 10000
hThread = 0
End Sub
__________________
Jorge Mota
Blog
Gubiz estafa
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 02:07.