Menú

Mostrar Mensajes

Esta sección te permite ver todos los mensajes escritos por este usuario. Ten en cuenta que sólo puedes ver los mensajes escritos en zonas a las que tienes acceso en este momento.

Mostrar Mensajes Menú

Mensajes - elmaro

#11
Lo bueno es que ahora eso ya no va a pasar mas ;) Todo se aprende

Saludos
#12
Cita de: Keyen Night en  4 Marzo 2010, 14:30 PM
Yo te recomiendo usar AccessControl tanto para archivos como para carpetas mira este ejemplo de un codigo que puse hace tiempo, claro le falta que lo pulas más ya que este codigo es algo viejo y ya aprendi una forma de hacerlo mejor pero ahora no estoy en mi PC donde tengo el source xD

http://foro.elhacker.net/net/denegar_acceso_a_archivo_o_directorios_sub-t263788.0.html;msg1286242#msg1286242

Unido ha esto puedes ocultar el archivo ponerlo de solo lectura y del sistema

Esta bueno el code.
Sabes que así como esta cuando elimino el archivo me da error como es de esperarse, pero... si lo intento borrar con SHITF+DEL (borrarlo definitivamente) lo borra sin problemas :O. Sera cuestión de mirarlo

Saludos
#13
Viendo por ahi creo que esta es la constante


Código (vbnet) [Seleccionar]
Private Const BM_CLICK = &HF5
#14
Para hacer eso tenes que saber el handle del botón que quieres presionar. Y enviarle con SendMessage "un click"

Acá tienes el código del SendMessage:
Código (vbnet) [Seleccionar]
    <System.Runtime.InteropServices.DllImport("user32.DLL")> _
    Public Function SendMessage( _
            ByVal hWnd As System.IntPtr, ByVal wMsg As Integer, _
            ByVal wParam As Integer, ByVal lParam As Integer _
            ) As Integer
    End Function

    <System.Runtime.InteropServices.DllImport("user32.DLL")> _
Public Function SendMessage( _
        ByVal hWnd As System.IntPtr, ByVal wMsg As Integer, _
        ByVal wParam As Integer, ByVal lParam As String _
        ) As Integer
    End Function


Para buscar el handle del boton puedes instalarte WinID (asi sabes como buscarlo desde la aplicacion)

Seguramente te sirvan todas estas funciones:
Código (vbnet) [Seleccionar]
<System.Runtime.InteropServices.DllImport("user32.dll", _
    EntryPoint:="FindWindow")> _
    Public Function FindWindow(ByVal lpClassName As String, ByVal lpWindowName As String) As IntPtr
    End Function

    <System.Runtime.InteropServices.DllImport("user32.dll")> _
    Public Function EnumChildWindows(ByVal hWndParent As System.IntPtr, ByVal lpEnumFunc As EnumWindowsProc, ByVal lParam As Integer) As Boolean
    End Function

    Public Function GetChildWindows(ByVal ParentHandle As IntPtr) As IntPtr()
        Dim ChildrenList As New List(Of IntPtr)
        Dim ListHandle As GCHandle = GCHandle.Alloc(ChildrenList)
        Try
            EnumChildWindows(ParentHandle, AddressOf EnumWindow, GCHandle.ToIntPtr(ListHandle))
        Finally
            If ListHandle.IsAllocated Then ListHandle.Free()
        End Try
        Return ChildrenList.ToArray
    End Function

    Private Function EnumWindow(ByVal Handle As IntPtr, ByVal Parameter As IntPtr) As Boolean
        Dim ChildrenList As List(Of IntPtr) = GCHandle.FromIntPtr(Parameter).Target
        If ChildrenList Is Nothing Then Throw New Exception("GCHandle Target could not be cast as List(Of IntPtr)")
        ChildrenList.Add(Handle)
        Return True
    End Function

    <System.Runtime.InteropServices.DllImport("user32.dll")> _
    Public Sub GetClassName(ByVal hWnd As System.IntPtr, ByVal lpClassName As System.Text.StringBuilder, ByVal nMaxCount As Integer)
        ' Leave function empty   
    End Sub


Lo que no se es cual es la constante a enviar. Quedaría buscar por ahí

Saludos
#15
Con esto obtenes los items seleccionados:
Código (vbnet) [Seleccionar]
ListView1.SelectedItems

Si solo seleccionas 1, lo obtenes asi:

Código (vbnet) [Seleccionar]
ListView1.SelectedItems(0)

Para el nombre de ese item:

Código (vbnet) [Seleccionar]
ListView1.SelectedItems(0).Text

Y bueno, anda investigando que mas podes sacar de ahí ;)

Saludos
#16
Código (vbnet) [Seleccionar]
Public Shared Function Serialize(ByVal Obj As Object, ByVal AsByte As Boolean) As Byte()
       Dim bf As New Runtime.Serialization.Formatters.Binary.BinaryFormatter
       Dim ms As New IO.MemoryStream
       bf.Serialize(ms, Obj)
       Return ms.ToArray
End Function

Public Shared Function Deserialize(ByVal Obj As Byte()) As Object
       Dim bf As New Runtime.Serialization.Formatters.Binary.BinaryFormatter
       Dim ms As New IO.MemoryStream(Obj)
       Return bf.Deserialize(ms)
End Function
#17
Código (vbnet) [Seleccionar]
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        For i = 1 To 4
            DataGridView1.Columns.Add("Col " & i, "Col " & i)
        Next

        For i = 1 To 10
            DataGridView1.Rows.Add("Row 1-" & i, "Row 2-" & i, "Row 3-" & i, "Row 4-" & i)
        Next
    End Sub

    Private Sub DataGridView1_CellEndEdit(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellEndEdit
        If DataGridView1.Item(e.ColumnIndex, e.RowIndex).Value = "" Then
            DataGridView1.Item(e.ColumnIndex, e.RowIndex).ReadOnly = True
        End If
    End Sub
#18
Código (vbnet) [Seleccionar]
Dim fs As New FileStream("c:\op.txt", FileMode.Open)

'Bloquear
fs.Lock(0, fs.Length)

'Desbloquear
fs.Unlock(0, fs.Length)


Espero te sirva

Saludos
#19
O manejas los números como números o puedes poner:

Código (csharp) [Seleccionar]
string a="PEPE02";
string b="PEPE10";


y listo

Saludos!