Foro de elhacker.net

Programación => Programación Visual Basic => Mensaje iniciado por: ELGRANSOLRAC en 16 Febrero 2006, 01:04 am



Título: problemas con codigo un fichero asociado a una aplicacion
Publicado por: ELGRANSOLRAC en 16 Febrero 2006, 01:04 am
Hola a todos:
Mi problema es que tengo un codigo que asocia un fichero con una extension por ejemplo .BAR a una aplicacion concreta.
Cuando pinchas en el fichero con la extension .BAR llama a mi aplicacion y yo lo que quisiera esque mi aplicacion tiene un textbox y se visualizaran los datos en el textobox automaticamente.
Si es posible agradecceria ayuda esto loco buscando por hay Gracias...
Código:

Private Declare Function RegCreateKey Lib "advapi32.dll" Alias "RegCreateKeyA" _
(ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
Private Declare Function RegSetValue Lib "advapi32.dll" Alias "RegSetValueA" _
(ByVal hKey As Long, ByVal lpSubKey As String, ByVal dwType As Long, ByVal _
lpData As String, ByVal cbData As Long) As Long

Const ERROR_SUCCESS = 0&
Const ERROR_BADDB = 1&
Const ERROR_BADKEY = 2&
Const ERROR_CANTOPEN = 3&
Const ERROR_CANTREAD = 4&
Const ERROR_CANTWRITE = 5&
Const ERROR_OUTOFMEMORY = 6&
Const ERROR_INVALID_PARAMETER = 7&
Const ERROR_ACCESS_DENIED = 8&
Private Const HKEY_CLASSES_ROOT = &H80000000
Private Const MAX_PATH = 260&
Private Const REG_SZ = 1



Private Sub Command1_Click()
Dim sKeyName As String
Dim sKeyValue As String
Dim ret&
Dim lphKey&

'Crea una entrada llamada `MyApp`.
    sKeyName = "MyApp"
    sKeyValue = "My Application"
    ret& = RegCreateKey&(HKEY_CLASSES_ROOT, sKeyName, lphKey&)
    ret& = RegSetValue&(lphKey&, "", REG_SZ, sKeyValue, 0&)
'Asocia la extensión .BAR a "MyApp".
    sKeyName = ".BAR"
    sKeyValue = "MyApp"
    ret& = RegCreateKey&(HKEY_CLASSES_ROOT, sKeyName, lphKey&)
    ret& = RegSetValue&(lphKey&, "", REG_SZ, sKeyValue, 0&)
'Establece la ruta de `MyApp`.
    sKeyName = "MyApp"
    sKeyValue = "c:\my.exe %1"
    ret& = RegCreateKey&(HKEY_CLASSES_ROOT, sKeyName, lphKey&)
    ret& = RegSetValue&(lphKey&, "shell\open\command", REG_SZ, sKeyValue, MAX_PATH)


End Sub


Título: Re: problemas con codigo un fichero asociado a una aplicacion
Publicado por: APOKLIPTICO en 16 Febrero 2006, 05:47 am
Código:
Private Sub Form_Load()
Open Command For Binary As #1
Dim chars As String * 1
Do Until EOF(1)
DoEvents
Get #1, , chars
textbox1 = textbox1 & chars 'donde textbox1 es el nombre de la caja de texto
Loop
End Sub