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

 

 


Tema destacado: Trabajando con las ramas de git (tercera parte)


  Mostrar Mensajes
Páginas: 1 [2] 3 4 5 6 7 8 9 10 11
11  Programación / .NET (C#, VB.NET, ASP) / Re: Crear Objeto Desde Código en: 21 Septiembre 2011, 06:35 am
Si, los Threads me pueden servir, pero no se como aplicarlo exactamente una manera de solucionarlo fue hacer esto:

Código:

        Dim continuar As Boolean
        Dim wb1 As WebBrowser
        Dim cantidad As Integer
        cantidad = 0
nexti:
        If cantidad = 5 Then Exit Sub
        continuar = True
        wb1 = New WebBrowser
        wb1.Navigate("http://www.MISERVIDOR.com/form.php?1=1234567890")
        Do While continuar = True
            If wb1.CanGoBack Then
                continuar = False
                cantidad = cantidad + 1
                GoTo nexti
            End If
        Loop

de esta manera logro que se envien los mensajes sin problema, pero como hago para repetir este proceso n veces, supongo que como dicen es con Threads

12  Programación / .NET (C#, VB.NET, ASP) / Re: Crear Objeto Desde Código en: 21 Septiembre 2011, 06:24 am
Lo que hace el programa es cargar la página http://miserver.com/formulario.php?numero= numero.text en el navegador (el archivo php automáticamente hace un SUBMIT al formulario a http://otrapagina.com/submit.php

entonces en el document complete si la URL actual es http://otrapagina.com/submit.php

aumentamos la variable CANTIDAD y si cantidad es MENOR a cantidad.text
cargamos nuevamente http://miserver.com/formulario.php?numero.text

lo que hace el programa es enviar mensajes de texto a un celular (como esos de publicidad de destruye 5 iphones y gana un tono y te piden que metas tu numero de celular y te llega un código)  entonces si pongo un numero y quiero que le llegue ese mensaje 5 veces pongo su numero y cantidad 5

entonces carga 5 veces el formulario de envio

Realmente es para jugarle bromas a mis amigos o molestar gente =D

pero lo que quiero es poder enviar a varios numeros en una sola instancia del programa
13  Programación / .NET (C#, VB.NET, ASP) / Crear Objeto Desde Código en: 21 Septiembre 2011, 05:10 am
Buenas Noches

Actualmente tengo el código en VB NET de un programa que carga una página en un WebBrowser y en el sub de DocumentComplete realiza una función

ahora quiero hacer el mismo proceso varias veces (actualmente lo que hago es abrir varias veces el programa)

pero si lo hago necesito crear WebBrowsers de manera Dinámica esto lo logro sin problemas
Código:
        Dim wb1 As WebBrowser
        wb1 = New WebBrowser
        wb1.Navigate("http://www.google.com")

se me ocurre crear varias instancias como sean necesarias de la manera
wb1
wb2
wb3
wb4

etc....

pero como puedo manejar el evento DocumentComplete del webbrowser, seria la misma función para todos los navegadores algo así como

Código:
Private Sub wb1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles wb1.DocumentCompleted

pero hacer que el Handles maneje wb1.DocumentCompleted, wb2.DocumentCompleted, wb3.DocumentCompleted

algo así
Código:
Private Sub wb1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles wb1.DocumentCompleted, wb2.DocumentCompleted, wb3.DocumentCompleted


como hago para hacer esto dinámicamente

Saludos =D

14  Programación / .NET (C#, VB.NET, ASP) / Codigos De Barra en: 28 Agosto 2011, 09:31 am
Buenas

Estoy haciendo un programa que maneja artículos, es como un punto de venta, el problema es que hay artículos que no tienen código de barras así que se le genera un en el programa

estoy intentando imprimirlos, encontre una aplicacion en vb6 pero no la he logrado traducir

lo que ahora hago es llenar una hoja de excel con los datos de los artículos usando la fuente CCode39 o AutomationID (es TreuType) pero el lector no las lee ya que genera muy juntas y chicas las barras

alguna manera de generarlas en vb net?

saludos y de antemano gracias
15  Programación / .NET (C#, VB.NET, ASP) / Picturbox.drawidth en vb net en: 28 Agosto 2011, 09:26 am
Estoy intentando pasar este codigo de vb6 a .net pero me pierdo en el PICTUREBOX

alguna idea?

lo que hace es generar un código de barras

Código:
Private Sub GeraCodBar39(ByVal x As String, ByVal Sclr As Integer)
        Dim pic As PictureBox       
        Dim bc4(0 To 20) As String
        Dim barchar As String
        Dim barcolor As String
        Dim bs As Single
        Dim bwn As Single
        Dim ac As Integer
        Dim s As Integer
        Dim bct As Integer
        Dim bcl As Integer
        ac = 1
        pic.Image = Nothing
        bc4(ac - 1) = "121121211"
        For bct = 1 To Len(x)
            barchar = Mid(x, bct, 1)
            If barchar = " " Then barchar = "SP"
            For s = 0 To UBound(zz1)
                If UCase(barchar) = zz1(s) Then
                    bc4(ac) = zz2(s)
                    ac = ac + 1
                    Exit For
                End If
            Next s
        Next bct
        bc4(ac) = "121121211"
        bs = 200
        pic.DrawWidth = 1
        For bct = 0 To ac
            x = bc4(bct)
            barcolor = Color.Black.ToString
            For s = 1 To Len(x)
                bwn = (Val(Mid(x, s, 1))) * Sclr
                For bcl = 1 To bwn
                pic.Line (bs + bcl, 100)-Step(0, 500), barcolor
                    drawli()
                Next bcl
                If barcolor = Color.Black.ToString Then barcolor = Color.White.ToString Else barcolor = Color.Black.ToString
                bs = bs + bwn
            Next s
            For bcl = 1 To Sclr
                pic.Line (bs + bcl, 100)-Step(0, 500), vbWhite
            Next bcl
            bs = bs + bcl
        Next bct
        pic.FontSize = 16 : pic.CurrentX = 200 : pic.CurrentY = 600 : pic.Print(UCase(txtdata))
    End Sub

los errores me los da en

pic.FontSize
pic.CurrentX
pic.CurrentY
pic.Print(UCase(txtdata)
pic.DrawWidth

lei que tiene que ser con PEN y Graphics pero me pierdo
16  Programación / .NET (C#, VB.NET, ASP) / Re: vb net SELECT de Acces no funciona en: 23 Agosto 2011, 07:17 am
aa ya entiendo dices que antes de eso haga un

dr.read GRACIAS!!

ahora mismo lo pruebo
17  Programación / .NET (C#, VB.NET, ASP) / Re: vb net SELECT de Acces no funciona en: 22 Agosto 2011, 02:48 am
Si lo llamo,

aqui

Código:
dr = cmd.ExecuteReader

lo unica forma que hago que esto funcione es

haciendo el select * from articulos

y ya hago un if

Código:
if dr("codigo") = codigotxt.text & " 1" then

pero hace ToDAS LAS COMPARACIONES
18  Programación / .NET (C#, VB.NET, ASP) / vb net SELECT de Acces no funciona en: 21 Agosto 2011, 00:25 am
Buenas

Tengo un pequeño problema que no logro resolver

si ejecuto este SQL en ACCESS funciona perfectamente y me devuelve el ID, pero si la ejecuto en VB NET me dice que no hay registros

Código:
select id from medicamentos where codigo='2121 1';

ya lo intente tambien como

Código:
select id from medicamentos where codigo like '2121 1';

si ejecuto la consulta en ACCESS funciona tendrá algo que ver que el campo sea de tipo TEXTO?

aqui está el como lo hago en vb net el codigotxt.text contiene "2121"
Código:
Dim cn As OleDbConnection
Dim cmd As OleDbCommand
Dim dr As OleDbDataReader

Try
cn = New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & CurDir() & "\base.accdb;")
cn.Open()
cmd = New OleDbCommand("select id from articulos where codigo like '" & CodigoTxt.Text & " 1'", cn)
dr = cmd.ExecuteReader
MsgBox(dr("id"))
dr.close()
cn.close()
Catch ex As Exception
MsgBox(ex.Message)
End Try

en el vb net me dice el exception "No Data Exist for the Row/column."

Alguna idea?

de antemano GRACIAS
19  Programación / Programación Visual Basic / Re: Conexion por Modem? en: 20 Julio 2011, 23:50 pm
Yo he hecho eso FISICAMENTE pero no desde VB

puedes tener una computadora que sea SERVIDOR con 2 tarjetas de red

en una recibe internet y en otra la reparte, la que reparte conectas un router para repartir el inter a varias maquinas

en la maquina servidor instalas un Servidor DHCP (para darles IP a las demás máquinas)

y tambien un programa como NETLIMITER que te dice que está haciendo cada IP, y desde ahi puedes limitarle puertos, velocidad, evitar que cierta aplicacion tenga inter etc..

Si lo que quieres hacer es instalar un programa en cada maquina, si no se logea un timer que deshabilite la tarjeta de red y listo al logerase la habilita y desactiva el timer

20  Programación / .NET (C#, VB.NET, ASP) / Imprimir Formulario Mayor a la pantalla vb net en: 19 Julio 2011, 08:21 am
Buenas

Tengo un pequeño problema, estoy intentando imprimir un formato en vb net (VS2010)

no puedo hacer el form mas grande a 768 por que es el límite que me pone mi resolución así que agregué un picturebox del tamaño que necesito e hice el form autoscroll = true para agregar los datos del formato que me faltaban

Pero al momento de imprimirlo solo sale la parte del form que se ve, tanto con PRINTFORM como con PRINTDOCUMENT

Con PrintForm Uso este código

Código:
PrintForm1.PrinterSettings.DefaultPageSettings.Margins.Top = 0
        PrintForm1.PrinterSettings.DefaultPageSettings.Margins.Left = 0
        PrintForm1.PrinterSettings.DefaultPageSettings.Margins.Right = 0
        PrintForm1.PrinterSettings.DefaultPageSettings.Margins.Bottom = 0
        PrintForm1.PrinterSettings.DefaultPageSettings.Landscape = False
        PrintForm1.Print(Me, PowerPacks.Printing.PrintForm.PrintOption.Scrollable)

con el printdocument es un poco más largo

EN EL EVENTO CLICK
Código:
Dim printdoc As PrintDocument
        printdoc = New PrintDocument
        AddHandler printdoc.PrintPage, AddressOf OnPrintPage
        printdoc.DefaultPageSettings.Margins.Top = 0
        printdoc.DefaultPageSettings.Margins.Left = 0
        printdoc.DefaultPageSettings.Margins.Bottom = 0
        printdoc.Print()

una CLASE
Código:
Public Class Win32APICall

    Public Const DIB_RGB_COLORS = 0
    Public Const BI_RGB = 0
    Public Const WHITENESS = 16711778

    <DllImport("user32.dll", EntryPoint:="PrintWindow", _
    SetLastError:=True, CharSet:=CharSet.Unicode, _
    ExactSpelling:=True, CallingConvention:=CallingConvention.StdCall)> _
    Public Shared Function PrintWindow(ByVal hWnd As IntPtr, ByVal hDC As IntPtr, ByVal dwFlags As Integer) As UInt32
    End Function

    <StructLayout(LayoutKind.Sequential, pack:=8, CharSet:=CharSet.Auto)> _
    Structure BITMAPINFOHEADER
        Dim biSize As Int32
        Dim biWidth As Int32
        Dim biHeight As Int32
        Dim biPlanes As Int16
        Dim biBitCount As Int16
        Dim biCompression As Int32
        Dim biSizeImage As Int32
        Dim biXPelsPerMeter As Int32
        Dim biYPelsPerMeter As Int32
        Dim biClrUsed As Int32
        Dim biClrImportant As Int32
    End Structure

    <DllImport("gdi32.dll", EntryPoint:="CreateDIBSection", _
    SetLastError:=True, CharSet:=CharSet.Unicode, _
    ExactSpelling:=True, CallingConvention:=CallingConvention.StdCall)> _
    Public Shared Function CreateDIBSection(ByVal hdc As IntPtr, ByRef pbmi As BITMAPINFOHEADER, _
    ByVal iUsage As Int32, ByVal ppvBits As IntPtr, ByVal hSection As IntPtr, _
    ByVal dwOffset As Int32) As IntPtr
    End Function

    <DllImport("gdi32.dll", EntryPoint:="PatBlt", _
    SetLastError:=True, CharSet:=CharSet.Unicode, _
    ExactSpelling:=True, CallingConvention:=CallingConvention.StdCall)> _
    Public Shared Function PatBlt(ByVal hDC As IntPtr, ByVal nXLeft As Int32, _
        ByVal nYLeft As Int32, ByVal nWidth As Int32, ByVal nHeight As Int32, _
        ByVal dwRop As Int32) As Boolean
    End Function

    <DllImport("gdi32.dll", EntryPoint:="SelectObject", _
    SetLastError:=True, CharSet:=CharSet.Unicode, _
    ExactSpelling:=True, CallingConvention:=CallingConvention.StdCall)> _
    Public Shared Function SelectObject(ByVal hDC As IntPtr, ByVal hObj As IntPtr) As IntPtr
    End Function

    <DllImport("GDI32.dll", EntryPoint:="CreateCompatibleDC", SetLastError:=True, CharSet:=CharSet.Unicode, _
    ExactSpelling:=True, CallingConvention:=CallingConvention.StdCall)> _
    Public Shared Function CreateCompatibleDC(ByVal hRefDC As IntPtr) As IntPtr
    End Function

    <DllImport("GDI32.dll", EntryPoint:="DeleteDC", SetLastError:=True, CharSet:=CharSet.Unicode, _
    ExactSpelling:=True, CallingConvention:=CallingConvention.StdCall)> _
    Public Shared Function DeleteDC(ByVal hDC As IntPtr) As Boolean
    End Function

    <DllImport("GDI32.dll", EntryPoint:="DeleteObject", SetLastError:=True, CharSet:=CharSet.Unicode, _
    ExactSpelling:=True, CallingConvention:=CallingConvention.StdCall)> _
    Public Shared Function DeleteObject(ByVal hObj As IntPtr) As Boolean
    End Function

    <DllImport("User32.dll", EntryPoint:="ReleaseDC", SetLastError:=True, CharSet:=CharSet.Unicode, _
    ExactSpelling:=True, CallingConvention:=CallingConvention.StdCall)> _
    Public Shared Function ReleaseDC(ByVal hWnd As IntPtr, ByVal hDC As IntPtr) As Boolean
    End Function

    <DllImport("User32.dll", EntryPoint:="GetDC", SetLastError:=True, CharSet:=CharSet.Unicode, _
    ExactSpelling:=True, CallingConvention:=CallingConvention.StdCall)> _
    Public Shared Function GetDC(ByVal hWnd As IntPtr) As IntPtr
    End Function


End Class

un SUB
Código:
Private Sub OnPrintPage(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs)
        Dim hwndForm As IntPtr
        hwndForm = Me.Handle

        Dim hdcDIBSection As IntPtr
        Dim hdcRef As IntPtr
        Dim hbmDIBSection As IntPtr
        Dim hbmDIBSectionOld As IntPtr
        Dim BMPheader As Win32APICall.BITMAPINFOHEADER

        hdcRef = Win32APICall.GetDC(IntPtr.Zero)
        hdcDIBSection = Win32APICall.CreateCompatibleDC(hdcRef)
        Win32APICall.ReleaseDC(IntPtr.Zero, hdcRef)

        BMPheader.biBitCount = 24
        BMPheader.biClrImportant = 0
        BMPheader.biClrUsed = 0
        BMPheader.biCompression = Win32APICall.BI_RGB
        BMPheader.biSize = 40
        BMPheader.biHeight = 964
        BMPheader.biPlanes = 1
        BMPheader.biSizeImage = 0
        BMPheader.biWidth = Me.Width
        BMPheader.biXPelsPerMeter = 0
        BMPheader.biYPelsPerMeter = 0

        hbmDIBSection = Win32APICall.CreateDIBSection(hdcDIBSection, BMPheader, Win32APICall.DIB_RGB_COLORS, _
        IntPtr.Zero, IntPtr.Zero, 0)

        hbmDIBSectionOld = Win32APICall.SelectObject(hdcDIBSection, hbmDIBSection)
        Win32APICall.PatBlt(hdcDIBSection, 0, 0, Me.Width, 964, Win32APICall.WHITENESS)
        Win32APICall.PrintWindow(hwndForm, hdcDIBSection, 0)
        Win32APICall.SelectObject(hdcDIBSection, hbmDIBSectionOld)

        Dim imageFrm As Bitmap
        imageFrm = Image.FromHbitmap(hbmDIBSection)
        e.Graphics.DrawImage(imageFrm, 0, 0)

        Win32APICall.DeleteDC(hdcDIBSection)
        Win32APICall.DeleteObject(hbmDIBSection)
    End Sub

y las declaraciones Generales
Código:
Imports System.Drawing.Printing
Imports System.Drawing.Graphics
Imports System.Drawing.Imaging
Imports System.Runtime.InteropServices

pero ninguna de las dos me imprime el formulario completo

necesito imprimir el formato que mide 964 pixeles de largo es CASI una hoja carta

alguna sugerencia?
Páginas: 1 [2] 3 4 5 6 7 8 9 10 11
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines