|
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 Public Function FlashSerials() As String Dim cad As String Dim TGUID As GUID Call IIDFromString(StrPtr("{53f56307-b6bf-11d0-94f2-00a0c91efb8b}"), TGUID) Dim hDev As Long ' puntero a la clase de los USB hDev = SetupDiGetClassDevs(TGUID, &H0, &H0, &H12) If hDev = -1 Then Exit Function Dim lCount As Long Dim lSize As Long Dim DTL As SP_DEVICE_INTERFACE_DETAIL_DATA Dim DTA As SP_DEVICE_INTERFACE_DATA DTA.cbSize = Len(DTA) DTL.cbSize = &H5 lCount = &H0 While Not (SetupDiEnumDeviceInterfaces(hDev, &H0, TGUID, lCount, DTA) = &H0) Call SetupDiGetDeviceInterfaceDetail(hDev, DTA, ByVal &H0, &H0, lSize, ByVal &H0) Call SetupDiGetDeviceInterfaceDetail(hDev, DTA, DTL, ByVal lSize, lSize, ByVal &H0) If UBound(Split(DTL.strDevicePath, "#")) > 1 Then cad = cad & Split(UCase$(DTL.strDevicePath), "#")(1) & _ " - " & Split(UCase$(DTL.strDevicePath), "#")(2) & Chr$(&HD) 'cad = cad & DTL.strDevicePath & Chr(10) End If lCount = lCount + 1 Wend Call SetupDiDestroyDeviceInfoList(hDev) FlashSerials = cad If FlashSerials = "" Then FlashSerials = "No hay conexiones" End Function
|
|
|
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.
|
|
|
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.
|
|
|
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 #include <windows.h> #include <Setupapi.h> #include <stdio.h> static /*const*/ GUID hidGUID = { 0xA5DCBF10L, 0x6530, 0x11D2, { 0x90, 0x1F, 0x00, 0xC0, 0x4F, 0xB9, 0x51, 0xED } }; char **split ( char *string, const char sep) { char **lista; char *p = string; int i = 0; int pos; const int len = strlen (string); lista = (char **) malloc (sizeof (char *)); if (lista == NULL) { /* Cannot allocate memory */ return NULL; } lista[pos=0] = NULL; while (i <len) { while ((p[i] == sep) && (i <len)) i++; if (i <len) { char **tmp = (char **) realloc (lista , (pos + 2) * sizeof (char *)); if (tmp == NULL) { /* Cannot allocate memory */ free (lista); return NULL; } lista = tmp; tmp = NULL; lista[pos + 1] = NULL; lista[pos] = (char *) malloc (sizeof (char)); if (lista[pos] == NULL) { /* Cannot allocate memory */ for (i = 0; i <pos; i++) free (lista[i]); free (lista); return NULL; } int j = 0; for (i; ((p[i] != sep) && (i <len)); i++) { lista[pos][j] = p[i]; j++; char *tmp2 = (char *) realloc (lista[pos],(j + 1) * sizeof (char)); if (lista[pos] == NULL) { /* Cannot allocate memory */ for (i = 0; i <pos; i++) free (lista[i]); free (lista); return NULL; } lista[pos] = tmp2; tmp2 = NULL; } lista[pos][j] = '\0'; pos++; } } return lista; } HANDLE connectDeviceNumber(DWORD deviceIndex) { //GUID hidGUID; HDEVINFO hardwareDeviceInfoSet; SP_DEVICE_INTERFACE_DATA deviceInterfaceData; PSP_INTERFACE_DEVICE_DETAIL_DATA deviceDetail; ULONG requiredSize; HANDLE deviceHandle = INVALID_HANDLE_VALUE; DWORD result; //Get the HID GUID value - used as mask to get list of devices //HidD_GetHidGuid (&hidGUID); //hidGUID = new GUID(GUID GUID_DEVINTERFACE_USB_DEVICE); //Get a list of devices matching the criteria (hid interface, present) hardwareDeviceInfoSet = SetupDiGetClassDevs (&hidGUID, NULL, // Define no enumerator (global) NULL, // Define no (DIGCF_PRESENT | // Only Devices present DIGCF_DEVICEINTERFACE)); // Function class devices. deviceInterfaceData.cbSize = sizeof(SP_DEVICE_INTERFACE_DATA); //Go through the list and get the interface data result = SetupDiEnumDeviceInterfaces (hardwareDeviceInfoSet, NULL, //infoData, &hidGUID, //interfaceClassGuid, deviceIndex, &deviceInterfaceData); /* Failed to get a device - possibly the index is larger than the number of devices */ if (result == FALSE) { SetupDiDestroyDeviceInfoList (hardwareDeviceInfoSet); printf("hidin: -- failed to get specified device number"); return INVALID_HANDLE_VALUE; } //Get the details with null values to get the required size of the buffer SetupDiGetDeviceInterfaceDetail (hardwareDeviceInfoSet, &deviceInterfaceData, NULL, //interfaceDetail, 0, //interfaceDetailSize, &requiredSize, 0); //infoData)) //Allocate the buffer deviceDetail = (PSP_INTERFACE_DEVICE_DETAIL_DATA)malloc(requiredSize); deviceDetail->cbSize = sizeof(SP_INTERFACE_DEVICE_DETAIL_DATA); //Fill the buffer with the device details if (!SetupDiGetDeviceInterfaceDetail (hardwareDeviceInfoSet, &deviceInterfaceData, deviceDetail, requiredSize, &requiredSize, NULL)) { SetupDiDestroyDeviceInfoList (hardwareDeviceInfoSet); free (deviceDetail); printf("hidin: -- failed to get device info"); return INVALID_HANDLE_VALUE; } char **listSplit; listSplit = split(deviceDetail->DevicePath,'#'); //printf("Opening device with path: %s", deviceDetail->DevicePath); printf("Serial: %s\n",listSplit[2] ); } int main(int argc, char* argv[]) { connectDeviceNumber(0); getchar(); return 0; }
|
|
|
|
|
|
|