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

 

 


Tema destacado: Estamos en la red social de Mastodon


  Mostrar Mensajes
Páginas: 1 ... 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 [31] 32 33 34 35 36 37 38
301  Programación / Programación Visual Basic / Re: Seriales de Pen-Drives conectados (SRC) en: 6 Diciembre 2011, 05:41 am
 :( pensé que eran verdaderos, gracias, habrá que ejecutar como administrador  :xD

Saludos.
302  Programación / Programación Visual Basic / Re: Seriales de Pen-Drives conectados (SRC) en: 5 Diciembre 2011, 06:51 am
Gracias Hasseds, usando WMI me devuelve casi el mismo serial de IDE que utilizando la clase 53f56307-b6bf-11d0-94f2-00a0c91efb8b , estas seguro que no es el serial verdadero?  :-[

Saludos.

303  Programación / Programación Visual Basic / Re: Seriales de Pen-Drives conectados (SRC) en: 4 Diciembre 2011, 20:09 pm
Hola tengo una consulta la clase: "{53f56307-b6bf-11d0-94f2-00a0c91efb8b}" me detecta hasta las unidades de disco IDE, si alguien tuviera discos SATA para ver si los detecta
Código
  1. Public Function FlashSerials() As String
  2.    Dim cad As String
  3.   Dim TGUID As GUID
  4.  
  5.   Call IIDFromString(StrPtr("{53f56307-b6bf-11d0-94f2-00a0c91efb8b}"), TGUID)
  6.  
  7.   Dim hDev As Long
  8.   ' puntero a la clase de los USB
  9.   hDev = SetupDiGetClassDevs(TGUID, &H0, &H0, &H12)
  10.  
  11.   If hDev = -1 Then Exit Function
  12.  
  13.   Dim lCount       As Long
  14.   Dim lSize        As Long
  15.   Dim DTL          As SP_DEVICE_INTERFACE_DETAIL_DATA
  16.   Dim DTA          As SP_DEVICE_INTERFACE_DATA
  17.  
  18.   DTA.cbSize = Len(DTA)
  19.   DTL.cbSize = &H5
  20.   lCount = &H0
  21.  
  22.   While Not (SetupDiEnumDeviceInterfaces(hDev, &H0, TGUID, lCount, DTA) = &H0)
  23.  
  24.     Call SetupDiGetDeviceInterfaceDetail(hDev, DTA, ByVal &H0, &H0, lSize, ByVal &H0)
  25.  
  26.     Call SetupDiGetDeviceInterfaceDetail(hDev, DTA, DTL, ByVal lSize, lSize, ByVal &H0)
  27.  
  28.     If UBound(Split(DTL.strDevicePath, "#")) > 1 Then
  29.        cad = cad & Split(UCase$(DTL.strDevicePath), "#")(1) & _
  30.         " - " & Split(UCase$(DTL.strDevicePath), "#")(2) & Chr$(&HD)
  31.        'cad = cad & DTL.strDevicePath & Chr(10)
  32.     End If
  33.  
  34.     lCount = lCount + 1
  35.   Wend
  36.  
  37.   Call SetupDiDestroyDeviceInfoList(hDev)
  38.   FlashSerials = cad
  39.   If FlashSerials = "" Then FlashSerials = "No hay conexiones"
  40.  
  41. End Function
  42.  
304  Programación / .NET (C#, VB.NET, ASP) / Re: Reconocer areas de imagenes - ayuda en: 26 Noviembre 2011, 14:11 pm
Bueno, digamos esta imagen


Ahora si hago click en la parte azul, obtendre un valor de 1 y si hago click en el rojo obtendré 2.
El asunto esta en detectar en que parte hice click. Lo que devuelva es más fácil de codificar  :)

Tengo una idea, pienso en hacer un mapa de bits de la imagen, utilizaria una matriz de enteros. Me pregunto hasta cuanta memoria podría utilizar como máximo.

Saludos.
305  Programación / .NET (C#, VB.NET, ASP) / Reconocer areas de imagenes - ayuda en: 25 Noviembre 2011, 17:57 pm
Una vez vi un programa que tenia una imagen y uno podia hacer click en distintas areas de la imagen y se obtenia un valor. Pero la imagen, ni las areas de la imagen eran cuadradas y menos redondas.

Existe algun boton u otro control que me permita hacer esto, en flash creo que se puede hacer, estoy buscando información para vb.net.

Saludos.
306  Programación / .NET (C#, VB.NET, ASP) / Re: Problema Serializar/Deserializar en: 23 Noviembre 2011, 16:17 pm
Encontre un ejemplo en http://msdn.microsoft.com/es-pe/library/system.runtime.serialization.serializationbinder.aspx hice modificaciones y ya funciona.
307  Programación / .NET (C#, VB.NET, ASP) / Problema Serializar/Deserializar en: 23 Noviembre 2011, 07:18 am
Serializo y deserializo un objeto en un Proyecto1 sin ningun problema, pero cuando intento deserializar el objeto desde otro proyecto aún copiando la misma clase del objeto.
Me sale un error que dice: No se pudo encontrar el ensamblado 'Proyecto1,versión=1.0.4344.1002,culture=neutral,PublicKeyToken=null'

Parece que al guardar el objeto se crea esta especie de cabecera que referencia al proyecto que creo el archivo. Estoy intentando quitar esta cabecera, pienso que deberia poderse sobreescribiendo el metodo: Serealize.

Alguien tiene alguna idea. Agredezco los comentarios.  :xD

308  Programación / .NET (C#, VB.NET, ASP) / Re: DLL para controlar el puerto USB en C# o VB. net 2008 en: 22 Noviembre 2011, 15:57 pm
hay controles para mandar a imprimir y deberian funcionarte. En todo caso podrias averiguar funciones de la API para imprimir, aqui te dejo una pagina http://pinvoke.net/ para que puedas invocar funciones de la API en vb.net, me ha servido mucho esa pag.

Saludos.
309  Foros Generales / Foro Libre / Animación Naruto rikudou en: 19 Noviembre 2011, 19:55 pm
se aceptan agravios...

canción: So Long Dear Friend by JETZT 
310  Programación / Programación C/C++ / Seriales PenDrive DevC++ (SRC) en: 17 Noviembre 2011, 17:27 pm
Buscando código para VB.NET encontré esto, hice pequeñas modificaciones para que funcione en Dev C++ y googleando encontré la función Split, comparto el resultado

Hay que linkear: -lsetupapi
Código
  1.  
  2. #include <windows.h>
  3. #include <Setupapi.h>
  4. #include <stdio.h>
  5.  
  6. static /*const*/ GUID hidGUID = { 0xA5DCBF10L, 0x6530, 0x11D2,
  7. { 0x90, 0x1F, 0x00, 0xC0, 0x4F, 0xB9, 0x51, 0xED } };
  8.  
  9. char **split ( char *string, const char sep) {
  10.  
  11.    char       **lista;
  12.    char       *p = string;
  13.    int         i = 0;
  14.  
  15.    int         pos;
  16.    const int   len = strlen (string);
  17.  
  18.    lista = (char **) malloc (sizeof (char *));
  19.    if (lista == NULL) {                      /* Cannot allocate memory */
  20.        return NULL;
  21.    }
  22.  
  23.    lista[pos=0] = NULL;
  24.  
  25.    while (i <len) {
  26.  
  27.        while ((p[i] == sep) && (i <len))
  28.            i++;
  29.  
  30.        if (i <len) {
  31.  
  32.            char **tmp = (char **) realloc (lista , (pos + 2) * sizeof (char *));
  33.            if (tmp == NULL) {       /* Cannot allocate memory */
  34.                free (lista);
  35.                return NULL;
  36.            }
  37.            lista = tmp;
  38.            tmp = NULL;
  39.  
  40.            lista[pos + 1] = NULL;
  41.            lista[pos] = (char *) malloc (sizeof (char));
  42.            if (lista[pos] == NULL) {         /* Cannot allocate memory */
  43.                for (i = 0; i <pos; i++)
  44.                    free (lista[i]);
  45.                free (lista);
  46.                return NULL;
  47.            }
  48.  
  49.            int j = 0;
  50.            for (i; ((p[i] != sep) && (i <len)); i++) {
  51.                lista[pos][j] = p[i];
  52.                j++;
  53.  
  54.                char *tmp2 = (char *) realloc (lista[pos],(j + 1) * sizeof (char));
  55.                if (lista[pos] == NULL) {     /* Cannot allocate memory */
  56.                    for (i = 0; i <pos; i++)
  57.                        free (lista[i]);
  58.                    free (lista);
  59.                    return NULL;
  60.                }
  61.                lista[pos] = tmp2;
  62.                tmp2 = NULL;
  63.            }
  64.            lista[pos][j] = '\0';
  65.            pos++;
  66.        }
  67.    }
  68.  
  69.    return lista;
  70. }
  71.  
  72. HANDLE connectDeviceNumber(DWORD deviceIndex)
  73. {
  74.    //GUID hidGUID;  
  75.  
  76.  
  77.    HDEVINFO hardwareDeviceInfoSet;
  78.    SP_DEVICE_INTERFACE_DATA deviceInterfaceData;
  79.    PSP_INTERFACE_DEVICE_DETAIL_DATA deviceDetail;
  80.    ULONG requiredSize;
  81.    HANDLE deviceHandle = INVALID_HANDLE_VALUE;
  82.    DWORD result;
  83.  
  84.    //Get the HID GUID value - used as mask to get list of devices
  85.    //HidD_GetHidGuid (&hidGUID);
  86.    //hidGUID = new GUID(GUID GUID_DEVINTERFACE_USB_DEVICE);
  87.  
  88.    //Get a list of devices matching the criteria (hid interface, present)
  89.    hardwareDeviceInfoSet = SetupDiGetClassDevs (&hidGUID,
  90.                                                 NULL, // Define no enumerator (global)
  91.                                                 NULL, // Define no
  92.                                                 (DIGCF_PRESENT | // Only Devices present
  93.                                                 DIGCF_DEVICEINTERFACE)); // Function class devices.
  94.  
  95.    deviceInterfaceData.cbSize = sizeof(SP_DEVICE_INTERFACE_DATA);
  96.  
  97.    //Go through the list and get the interface data
  98.    result = SetupDiEnumDeviceInterfaces (hardwareDeviceInfoSet,
  99.                                          NULL, //infoData,
  100.                                          &hidGUID, //interfaceClassGuid,
  101.                                          deviceIndex,
  102.                                          &deviceInterfaceData);
  103.  
  104.    /* Failed to get a device - possibly the index is larger than the number of devices */
  105.    if (result == FALSE)
  106.    {
  107.        SetupDiDestroyDeviceInfoList (hardwareDeviceInfoSet);
  108.        printf("hidin: -- failed to get specified device number");
  109.        return INVALID_HANDLE_VALUE;
  110.    }
  111.  
  112.    //Get the details with null values to get the required size of the buffer
  113.    SetupDiGetDeviceInterfaceDetail (hardwareDeviceInfoSet,
  114.                                     &deviceInterfaceData,
  115.                                     NULL, //interfaceDetail,
  116.                                     0, //interfaceDetailSize,
  117.                                     &requiredSize,
  118.                                     0); //infoData))
  119.  
  120.    //Allocate the buffer
  121.    deviceDetail = (PSP_INTERFACE_DEVICE_DETAIL_DATA)malloc(requiredSize);
  122.    deviceDetail->cbSize = sizeof(SP_INTERFACE_DEVICE_DETAIL_DATA);
  123.  
  124.    //Fill the buffer with the device details
  125.    if (!SetupDiGetDeviceInterfaceDetail (hardwareDeviceInfoSet,
  126.                                          &deviceInterfaceData,
  127.                                          deviceDetail,
  128.                                          requiredSize,
  129.                                          &requiredSize,
  130.                                          NULL))
  131.    {
  132.        SetupDiDestroyDeviceInfoList (hardwareDeviceInfoSet);
  133.        free (deviceDetail);
  134.        printf("hidin: -- failed to get device info");
  135.        return INVALID_HANDLE_VALUE;
  136.    }
  137.  
  138.    char  **listSplit;
  139.  
  140.    listSplit = split(deviceDetail->DevicePath,'#');
  141.  
  142.    //printf("Opening device with path: %s", deviceDetail->DevicePath);
  143.    printf("Serial: %s\n",listSplit[2] );
  144. }
  145.  
  146. int main(int argc, char* argv[]) {
  147.    connectDeviceNumber(0);
  148.  
  149.    getchar();
  150.   return 0;
  151. }
  152.  
Páginas: 1 ... 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 [31] 32 33 34 35 36 37 38
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines