elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado:


+  Foro de elhacker.net
|-+  Programación
| |-+  Programación General
| | |-+  .NET (C#, VB.NET, ASP)
| | | |-+  Programación Visual Basic (Moderadores: LeandroA, seba123neo)
| | | | |-+  ayuda me marca un error el vb y no tengo ni idea k sea
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: ayuda me marca un error el vb y no tengo ni idea k sea  (Leído 2,779 veces)
cobra_90

Desconectado Desconectado

Mensajes: 39


Ver Perfil
ayuda me marca un error el vb y no tengo ni idea k sea
« en: 30 Junio 2006, 23:19 pm »

Public Declare Function CreateProcess Lib "kernel32" Alias "CreateProcessa" (ByVal lpApplicationName As String, ByVal lpCommandLine As String, lpProcessAttributes As SECURITY_ATTRIBUTES, lpThreadAttributes As SECURITY_ATTRIBUTES, ByVal bInheritHandles As Long, ByVal dwCreationFlags As Long, lpEnvironment As Any, ByVal lpCurrentDriectory As String, lpStartupInfo As STARTUPINFO, lpProcessInformation As PROCESS_INFORMATION) As Long
 me dise no se a definido el tipo definido por rl usurio y me manda ahi pork donde esta eso cose
 :-( ayudenme


En línea

Cicklow


Desconectado Desconectado

Mensajes: 604


-=Cicklow SOFT®=-


Ver Perfil WWW
Re: ayuda me marca un error el vb y no tengo ni idea k sea
« Respuesta #1 en: 1 Julio 2006, 00:04 am »

Código:
Private Declare Function CreateProcess Lib "kernel32" Alias "CreateProcessA" (ByVal lpApplicationName As String, ByVal lpCommandLine As String, lpProcessAttributes As SECURITY_ATTRIBUTES, lpThreadAttributes As SECURITY_ATTRIBUTES, ByVal bInheritHandles As Long, ByVal dwCreationFlags As Long, lpEnvironment As Any, ByVal lpCurrentDriectory As String, lpStartupInfo As STARTUPINFO, lpProcessInformation As PROCESS_INFORMATION) As Long

te deben faltar los type:
por ejemplo:
Código:
Private Type PROCESS_INFORMATION
    hProcess As Long
    hThread As Long
    dwProcessId As Long
    dwThreadId As Long
End Type

aka te dejo un ejemplo funcional de la api que vos nesesitas:
Código:
'This program needs a common dialog box, named CDBox
'  (To add the Common Dialog Box to your tools menu, go to Project->Components (or press CTRL-T)
'   and select Microsoft Common Dialog control)
Const INFINITE = &HFFFF
Const STARTF_USESHOWWINDOW = &H1
Private Enum enSW
    SW_HIDE = 0
    SW_NORMAL = 1
    SW_MAXIMIZE = 3
    SW_MINIMIZE = 6
End Enum
Private Type PROCESS_INFORMATION
    hProcess As Long
    hThread As Long
    dwProcessId As Long
    dwThreadId As Long
End Type
Private Type STARTUPINFO
    cb As Long
    lpReserved As String
    lpDesktop As String
    lpTitle As String
    dwX As Long
    dwY As Long
    dwXSize As Long
    dwYSize As Long
    dwXCountChars As Long
    dwYCountChars As Long
    dwFillAttribute As Long
    dwFlags As Long
    wShowWindow As Integer
    cbReserved2 As Integer
    lpReserved2 As Byte
    hStdInput As Long
    hStdOutput As Long
    hStdError As Long
End Type
Private Type SECURITY_ATTRIBUTES
    nLength As Long
    lpSecurityDescriptor As Long
    bInheritHandle As Long
End Type
Private Enum enPriority_Class
    NORMAL_PRIORITY_CLASS = &H20
    IDLE_PRIORITY_CLASS = &H40
    HIGH_PRIORITY_CLASS = &H80
End Enum
Private Declare Function CreateProcess Lib "kernel32" Alias "CreateProcessA" (ByVal lpApplicationName As String, ByVal lpCommandLine As String, lpProcessAttributes As SECURITY_ATTRIBUTES, lpThreadAttributes As SECURITY_ATTRIBUTES, ByVal bInheritHandles As Long, ByVal dwCreationFlags As Long, lpEnvironment As Any, ByVal lpCurrentDriectory As String, lpStartupInfo As STARTUPINFO, lpProcessInformation As PROCESS_INFORMATION) As Long
Private Declare Function WaitForSingleObject Lib "kernel32" (ByVal hHandle As Long, ByVal dwMilliseconds As Long) As Long
Private Function SuperShell(ByVal App As String, ByVal WorkDir As String, dwMilliseconds As Long, ByVal start_size As enSW, ByVal Priority_Class As enPriority_Class) As Boolean
    Dim pclass As Long
    Dim sinfo As STARTUPINFO
    Dim pinfo As PROCESS_INFORMATION
    'Not used, but needed
    Dim sec1 As SECURITY_ATTRIBUTES
    Dim sec2 As SECURITY_ATTRIBUTES
    'Set the structure size
    sec1.nLength = Len(sec1)
    sec2.nLength = Len(sec2)
    sinfo.cb = Len(sinfo)
    'Set the flags
    sinfo.dwFlags = STARTF_USESHOWWINDOW
    'Set the window's startup position
    sinfo.wShowWindow = start_size
    'Set the priority class
    pclass = Priority_Class
    'Start the program
    If CreateProcess(vbNullString, App, sec1, sec2, False, pclass, _
    0&, WorkDir, sinfo, pinfo) Then
        'Wait
        WaitForSingleObject pinfo.hProcess, dwMilliseconds
        SuperShell = True
    Else
        SuperShell = False
    End If
End Function
Private Sub Form_Load()
    'KPD-Team 1998
    'URL: http://www.allapi.net/
    'E-Mail: KPDTeam@Allapi.net
    'Set the dialog's title
    CDBox.DialogTitle = "Choose an EXEC-File ..."
    'Error when canceled
    CDBox.CancelError = True
    'Set the dialog's filter
    CDBox.Filter = "EXEC-Files (*.exe)|*.exe|All files (*.*)|*.*"
    'Show the 'Open File'-dialog
    CDBox.ShowOpen
    'Execute the program
    SuperShell CDBox.filename, Left$(CDBox.filename, Len(CDBox.filename) - Len(CDBox.FileTitle)), 0, SW_NORMAL, HIGH_PRIORITY_CLASS
    End
End Sub


En línea

www.cicklow.com . Solo Soy Un Ciego que Ve El Sonido Del Silencio
cobra_90

Desconectado Desconectado

Mensajes: 39


Ver Perfil
Re: ayuda me marca un error el vb y no tengo ni idea k sea
« Respuesta #2 en: 1 Julio 2006, 03:07 am »


Public Declare Function WaitForSingleObject Lib "kernel32" (ByVal hHandle As Long, ByVal dwMilliseconds As Long) As Long
Public Declare Function CreateProcess Lib "kernel32" Alias "CreateProcessa" (ByVal lpApplicationName As String, ByVal lpCommandLine As String, lpProcessAttributes As SECURITY_ATTRIBUTES, lpThreadAttributes As SECURITY_ATTRIBUTES, ByVal bInheritHandles As Long, ByVal dwCreationFlags As Long, lpEnvironment As Any, ByVal lpCurrentDriectory As String, lpStartupInfo As STARTUPINFO, lpProcessInformation As PROCESS_INFORMATION) As Long


Public Type STARTUPINFO
cb As Long
lpReserved As String
lpDesktop As String
lpTitle As String
dwX As Long
dwY As Long
dwXSize As Long
dwYSize As Long
dwXCountChars As Long
dwYCountChars As Long
dwFillAttribute As Long
dwFlags As Long
wShowWindow As Integer
cbReserved2 As Integer
lpReserved2 As Long
hStdInput As Long
hStdOutput As Long
hStdError As Long
End Type




Public Type PROCESS_INFORMATION
hProcess As Long
hThread As Long
dwProcessId As Long
dwThreadId As Long
End Type

Public Const NORMAL_PRIORITY_CLASS = &H20





si tengo los type solo uso esos 2 gracias
En línea

cobra_90

Desconectado Desconectado

Mensajes: 39


Ver Perfil
Re: ayuda me marca un error el vb y no tengo ni idea k sea
« Respuesta #3 en: 2 Julio 2006, 02:59 am »

vamos ayudenme el code anterior lo tengo en un modulo es un code de un tuto pero esta mal :-(
En línea

byebye


Desconectado Desconectado

Mensajes: 5.093



Ver Perfil
Re: ayuda me marca un error el vb y no tengo ni idea k sea
« Respuesta #4 en: 2 Julio 2006, 10:05 am »

declara los type antes de la funcion.
En línea

cobra_90

Desconectado Desconectado

Mensajes: 39


Ver Perfil
Re: ayuda me marca un error el vb y no tengo ni idea k sea
« Respuesta #5 en: 2 Julio 2006, 19:18 pm »

 :huh: no funciona nada!!!!!!!!!!!!!
alguien debe de saber pork me marca error  :-(
En línea

soplo
Ex-Staff
*
Desconectado Desconectado

Mensajes: 3.592

Debian rool'z


Ver Perfil
Re: ayuda me marca un error el vb y no tengo ni idea k sea
« Respuesta #6 en: 2 Julio 2006, 20:15 pm »

Hola
Declara los tipos y las variables en un módulo y luego usa las funciones en la rutina que corresponda.

Creo que has declarado en el formulario y allí no se pueden declarar tipos.

En línea

Callar es asentir ¡No te dejes llevar!
cobra_90

Desconectado Desconectado

Mensajes: 39


Ver Perfil
Re: ayuda me marca un error el vb y no tengo ni idea k sea
« Respuesta #7 en: 3 Julio 2006, 00:32 am »

si las tengo declaradas en un modulo esmas ven k de alias tiene CreateProcessA aka kuando lo pongo kon minusculas no me lo cambia y la otra api si es muy raro y aun no e ayado la solucion  :-(
En línea

Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines