• Sábado 12 de Julio de 2025, 06:55

Mostrar Mensajes

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


Temas - akira

Páginas: [1]
1
VB .NET / Directorios
« en: Viernes 1 de Abril de 2005, 18:13 »
lo que necesitaria hacer es cargar mas de un directorio en el tipo filesystemwatcher.path, osea que me vea los eventos en mas de un direcotio, ej. C:\TEMP y C:\PRUEBA, como hago esto?
Desde ya muchas gracias.
Saludos, aca paso el codigo donde defino eso.
Código: Text
  1.  
  2.  watchfolder = New System.IO.FileSystemWatcher
  3.  
  4.         watchfolder.Path = txt_watchpath.Text
  5.         watchfolder.IncludeSubdirectories = True
  6.         watchfolder.NotifyFilter = IO.NotifyFilters.DirectoryName
  7.         watchfolder.NotifyFilter = watchfolder.NotifyFilter Or _
  8.                                    IO.NotifyFilters.FileName
  9.         watchfolder.NotifyFilter = watchfolder.NotifyFilter Or _
  10.                                    IO.NotifyFilters.Attributes
  11.  
  12.  
El txt_watchpath.text lo reemplazaria por los directorios que necesito ver.
Saludos.

2
VB .NET / Archivos .ini
« en: Martes 29 de Marzo de 2005, 16:43 »
Hola amigos/as tengo una pregunta para ud's, tengo un programa que logea cambios de archivos en un directorio, lo que me gustaria hacer, es que lea un archivo ini en el cual le pueda definir todas las variables para que verifique archivos o directorios, se que esto va a ser mas complicado, pero me gustaria que me den una mano.
Saludos.
Adjunto mi programa.
[CODE]Option Explicit On
Option Strict Off
Imports System
Imports System.IO
Imports System.Diagnostics
Imports Microsoft.VisualBasic

Public Class Form1
    Inherits System.Windows.Forms.Form

#Region " Código generado por el Diseñador de Windows Forms "

    Public Sub New()
        MyBase.New()

        'El Diseñador de Windows Forms requiere esta llamada.
        InitializeComponent()

        'Agregar cualquier inicialización después de la llamada a InitializeComponent()

    End Sub

    'Form reemplaza a Dispose para limpiar la lista de componentes.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Requerido por el Diseñador de Windows Forms
    Private components As System.ComponentModel.IContainer

    'NOTA: el Diseñador de Windows Forms requiere el siguiente procedimiento
    'Puede modificarse utilizando el Diseñador de Windows Forms.
    'No lo modifique con el editor de código.
    Friend WithEvents Label1 As System.Windows.Forms.Label
    Friend WithEvents txt_watchpath As System.Windows.Forms.TextBox
    Friend WithEvents Label2 As System.Windows.Forms.Label
    Friend WithEvents btn_startwatch As System.Windows.Forms.Button
    Friend WithEvents btn_stop As System.Windows.Forms.Button
    Friend WithEvents txt_folderactivity As System.Windows.Forms.TextBox
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.Label1 = New System.Windows.Forms.Label
        Me.txt_watchpath = New System.Windows.Forms.TextBox
        Me.Label2 = New System.Windows.Forms.Label
        Me.btn_startwatch = New System.Windows.Forms.Button
        Me.btn_stop = New System.Windows.Forms.Button
        Me.txt_folderactivity = New System.Windows.Forms.TextBox
        Me.SuspendLayout()
        '
        'Label1
        '
        Me.Label1.Location = New System.Drawing.Point(8, 40)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(152, 16)
        Me.Label1.TabIndex = 0
        Me.Label1.Text = "Ingresar Carpeta a Scannear"
        '
        'txt_watchpath
        '
        Me.txt_watchpath.Location = New System.Drawing.Point(160, 40)
        Me.txt_watchpath.Name = "txt_watchpath"
        Me.txt_watchpath.Size = New System.Drawing.Size(248, 20)
        Me.txt_watchpath.TabIndex = 1
        Me.txt_watchpath.Text = ""
        '
        'Label2
        '
        Me.Label2.Location = New System.Drawing.Point(24, 112)
        Me.Label2.Name = "Label2"
        Me.Label2.Size = New System.Drawing.Size(120, 16)
        Me.Label2.TabIndex = 2
        Me.Label2.Text = "Actividad en la carpeta"
        '
        'btn_startwatch
        '
        Me.btn_startwatch.Location = New System.Drawing.Point(440, 40)
        Me.btn_startwatch.Name = "btn_startwatch"
        Me.btn_startwatch.Size = New System.Drawing.Size(120, 24)
        Me.btn_startwatch.TabIndex = 3
        Me.btn_startwatch.Text = "Empezar"
        '
        'btn_stop
        '
        Me.btn_stop.Location = New System.Drawing.Point(440, 80)
        Me.btn_stop.Name = "btn_stop"
        Me.btn_stop.Size = New System.Drawing.Size(120, 24)
        Me.btn_stop.TabIndex = 4
        Me.btn_stop.Text = "Detener"
        '
        'txt_folderactivity
        '
        Me.txt_folderactivity.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
                    Or System.Windows.Forms.AnchorStyles.Left) _
                    Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.txt_folderactivity.AutoSize = False
        Me.txt_folderactivity.Location = New System.Drawing.Point(24, 136)
        Me.txt_folderactivity.Name = "txt_folderactivity"
        Me.txt_folderactivity.Size = New System.Drawing.Size(552, 216)
        Me.txt_folderactivity.TabIndex = 5
        Me.txt_folderactivity.Text = ""
        '
        'Form1
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.ClientSize = New System.Drawing.Size(592, 365)
        Me.Controls.Add(Me.txt_folderactivity)
        Me.Controls.Add(Me.btn_stop)
        Me.Controls.Add(Me.btn_startwatch)
        Me.Controls.Add(Me.Label2)
        Me.Controls.Add(Me.txt_watchpath)
        Me.Controls.Add(Me.Label1)
        Me.Name = "Form1"
        Me.Text = "File Logger"
        Me.ResumeLayout(False)

    End Sub

#End Region


    Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click

    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        txt_folderactivity.Multiline = True
        txt_folderactivity.ScrollBars = ScrollBars.Vertical
    End Sub
    Public watchfolder As FileSystemWatcher
    Private Sub btn_startwatch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_startwatch.Click
        watchfolder = New System.IO.FileSystemWatcher
        watchfolder.Path = txt_watchpath.Text
        watchfolder.NotifyFilter = IO.NotifyFilters.DirectoryName
        watchfolder.NotifyFilter = watchfolder.NotifyFilter Or _
                                   IO.NotifyFilters.FileName
        watchfolder.NotifyFilter = watchfolder.NotifyFilter Or _
                                   IO.NotifyFilters.Attributes

        AddHandler watchfolder.Created, AddressOf logchange
        AddHandler watchfolder.Deleted, AddressOf logchange
        AddHandler watchfolder.Renamed, AddressOf logrename
        watchfolder.EnableRaisingEvents = True

        btn_startwatch.Enabled = False
        btn_stop.Enabled = True
    End Sub
    Private Sub logchange(ByVal source As Object, ByVal e As _
                            System.IO.FileSystemEventArgs)
        Dim sr As StreamWriter
        Dim f As String = e.FullPath
        Dim arc As New System.IO.FileInfo(f)
        Dim dt As DateTime = DateTime.Now
        Const FILE_NAME As String = "C:\logbckp.txt"
        If File.Exists(FILE_NAME) = True Then
            sr = File.AppendText(FILE_NAME)
            If e.ChangeType = IO.WatcherChangeTypes.Created Then
                sr.WriteLine("El archivo  " & e.FullPath & _
                                         " ha sido creado" & vbCrLf)
                txt_folderactivity.Text &= "El archivo  " & e.FullPath & _
                                         " ha sido creado" & vbCrLf
                sr.WriteLine("Tamaño archivo en bytes " & arc.Length & _
                            "Fecha de modificacion " & dt.ToString("d") & vbCrLf)
                txt_folderactivity.Text &= "Tamaño archivo en bytes " & arc.Length & _
                            " fecha modificacion " & dt.ToString("d") & vbCrLf
            End If
            If e.ChangeType = IO.WatcherChangeTypes.Deleted Then
                sr.WriteLine("El archivo " & e.FullPath & _
                                        " ha sido borrado" & vbNewLine)
                txt_folderactivity.Text &= "El archivo " & e.FullPath & _
                                        " ha sido borrado" & vbNewLine
                txt_folderactivity.Text &= " fecha eliminacion " & _
                dt.ToString("d") & vbNewLine
            End If
            sr.Flush()
            sr.Close()
        End If

        If File.Exists(FILE_NAME) = False Then
            sr = File.CreateText(FILE_NAME)
            If e.ChangeType = IO.WatcherChangeTypes.Created Then
                sr.WriteLine("El archivo  " & e.FullPath & _
                                         " ha sido creado" & vbCrLf)
                txt_folderactivity.Text &= "El archivo  " & e.FullPath & _
                                         " ha sido creado" & vbCrLf
                txt_folderactivity.Text &= "Tamaño archivo en bytes " & arc.Length & _
                " fecha modificacion " & dt.ToString("d") & vbCrLf
            End If
            If e.ChangeType = IO.WatcherChangeTypes.Deleted Then
                sr.WriteLine("El archivo " & e.FullPath & _
                                        " ha sido borrado" & vbCrLf)
                txt_folderactivity.Text &= "El archivo " & e.FullPath & _
                                        " ha sido borrado" & vbCrLf
                txt_folderactivity.Text &= "Tamaño archivo en bytes " & arc.Length & _
                " fecha modificacion " & dt.ToString("d") & vbCrLf
            End If
            sr.WriteLine("Tamaño archivo en bytes " & arc.Length & _
            " fecha modificacion " & dt.ToString("d") & vbCrLf)
            sr.Flush()
            sr.Close()
        End If

    End Sub
    Public Sub logrename(ByVal source As Object, ByVal e As _
                                System.IO.RenamedEventArgs)
        Const FILE_NAME As String = "C:\logbckp.txt"
        Dim sr As StreamWriter
        Dim f As String = e.FullPath
        Dim arc As New System.IO.FileInfo(f)
        Dim dt As DateTime = DateTime.Now
        If File.Exists(FILE_NAME) = True Then
            sr = File.AppendText(FILE_NAME)
            sr.WriteLine("El Archivo " & e.OldName & _
            " ha sido renombrado a  " & e.Name & vbCrLf)
            sr.WriteLine(" tamaño archivo en bytes " & arc.Length & _
           " fecha modificacion " & dt.ToString("d") & vbCrLf)
            sr.Flush()
            sr.Close()
            txt_folderactivity.Text &= "El Archivo " & e.OldName & _
            " ha sido renombrado a  " & e.Name & vbCrLf
            txt_folderactivity.Text &= "Tamaño archivo en bytes " & arc.Length & _
            " fecha modificacion " & dt.ToString("d") & vbCrLf
        End If
        If File.Exists(FILE_NAME) = False Then
            sr = File.CreateText(FILE_NAME)
            sr.WriteLine("El Archivo " & e.OldName & _
            " ha sido renombrado a  " & e.Name & vbCrLf)
            sr.WriteLine("Tamaño archivo en bytes " & arc.Length & _
            " fecha modificacion " & dt.ToString("d") & vbCrLf)
            sr.Flush()
            sr.Close()
            txt_folderactivity.Text &= "El Archivo " & e.OldName & _
            " ha sido renombrado a  " & e.Name & vbCrLf
            txt_folderactivity.Text &= " tamaño archivo en bytes " & arc.Length & _
                           " fecha modificacion " & dt.ToString("d") & vbCrLf
        End If
    End Sub

    Private Sub btn_stop_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_stop.Click
        watchfolder.EnableRaisingEvents = False
        btn_startwatch.Enabled = True
        btn_stop.Enabled = False
    End Sub

    Private Sub txt_watchpath_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txt_watchpath.TextChanged

    End Sub

    Private Sub txt_folderactivity_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)

    End Sub

    Private Sub txt_folderactivity_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txt_folderactivity.TextChanged

    End Sub
End Class



 :lightsabre:

3
VB .NET / Pregunta, Modificacion Archivos
« en: Lunes 21 de Marzo de 2005, 18:41 »
Hola que tal soy nuevo en VB .NET, me han pedido que haga un aplicativo que chequee la fecha de un archivo para saber si ha sido modificado, cualquier ayuda sobre el tema es apreciado, ya que no tengo idea ni por donde empezar.
Saludos

4
C/C++ / Impresion De Matrices
« en: Lunes 14 de Marzo de 2005, 17:00 »
Hola a todos, desde ya gracias por el simple hecho de ponerse a leer esto.
El problema es el siguiente, me piden que imprima por pantalla una matriz recorriendola en forma de espiral y que vaya mostrando cada elemento 1 a 1 y que quede ordenada como matriz en el display.
Se como recorrerla en espiral lo que no se es como mantener el orden de la matriz por pantalla.
Gracias.
 :comp:

5
C/C++ / Matrices, Vectore Y Funciones
« en: Viernes 11 de Marzo de 2005, 20:38 »
Tengo este problema, necesito escribir un codigo para hacer una matriz, esto es lo que tengo pero no me compila estoy usando Visual C++ v6.0, si alguien me podria dar una mano estaria mas que agradecido
#Include <stdio.h>
#include <conio.h>

void cargar ( mat [][]);

void main ()
{
int m[5][5];
cargar(m);
}

void cargar(mat[][])
{
int i,j;
for (i=0;i<5;i++)
{
      for (j=0;j<5;j++)
      {
       printf ("Ingrese Numero de Fila %d  Columna %d",i,j);
       scanf("%d",&m[j]);
       }
}
}

Páginas: [1]