|
1
|
Foros Generales / Foro Libre / Re: Convertir PC en CCTV
|
en: 9 Octubre 2016, 12:07 pm
|
Muchas gracias por tu respuesta simorg! Con una capturadora como la que comentas, cual es la conexión de entrada que debo usar, BNC o RCA? Por lo que he visto dichas capturadoras no superan una resolución de 704x480 (NTSC). Existe alguna capaz de HD o FHD?
|
|
|
2
|
Foros Generales / Foro Libre / Convertir PC en CCTV
|
en: 8 Octubre 2016, 20:57 pm
|
Buenas! Como bien dice el título mi objetivo es convertir un PC en una CCTV pero me he dado cuenta de que la cosa no es tan sencilla como pensaba. Mi idea es hacerme con una cámara de videovigilancia con salida coaxial para conectarla con un cable BNC a una capturadora de vídeo en el PC pero no se que capturadora de vídeo necesito. Seria posible conectar la señal de vídeo con un cable VGA a BNC a una tarjeta gráfica? O necesito una tarjeta especial para tal fin? Mi objetivo final es poder instalar un linux con zoneminder en el PC para hacer funcionar las cámaras. Si alguien puede orientarme se lo agradecería muchísimo!!
Gracias y un saludo de antemano!
|
|
|
3
|
Programación / Programación C/C++ / Re: Ayuda con GetWindowText
|
en: 21 Marzo 2013, 10:13 am
|
Gracias x64Core!! Lo logre!! La verdad es que tengo algunos problemas con la gran vairedad de string de c++... que si ansi, unicode... A lo que iba, la solucion: #include "stdafx.h" #include <iostream> #include <Windows.h> using namespace std; int _tmain(int argc, _TCHAR* argv[]) { char title[128]; ZeroMemory(title, sizeof(title)); HWND wnd = GetForegroundWindow(); while (true) { HWND current = GetForegroundWindow(); if (current!=wnd) { wnd = current; GetWindowTextA(wnd, (LPSTR)title, 128); cout << "Text: " << title << endl; } Sleep(50); } int ans; cin >> ans; return 0; }
Solucion: cambie TCHAR por char, utilize la llamada al metodo GetWindowTextA() como tu dijiste, en formato ansi i como parametro casteo el char a LPSTR... Gracias por tu ayuda!
|
|
|
4
|
Programación / Programación C/C++ / Ayuda con GetWindowText
|
en: 20 Marzo 2013, 13:10 pm
|
Buenas, estoy intentando hacer un codigo en c++ para leer el texto de la ventana maximizada pero por algun motivo el texto no se lee apropiadamente... Aquí les dejo el codigo: #include "stdafx.h" #include <iostream> #include <Windows.h> using namespace std; int _tmain(int argc, _TCHAR* argv[]) { TCHAR title[500]; ZeroMemory(title, sizeof(title)); HWND wnd = GetForegroundWindow(); while (true) { HWND current = GetForegroundWindow(); if (current!=wnd) { wnd = current; GetWindowText(wnd, title, 400); cout << "Text: " << title << endl; } Sleep(50); } return 0; }
Estoy haciendo pruebas con el Visual Studio 2012 pero al ejecutar el programa este siempre me devuelve un valor sin sentido EJ: 01AB8D9 lo cual supongo que debe ser basura... Si alguien puede explicarme que estoy haciendo mal estaria muy agradecido!!
|
|
|
5
|
Programación / Java / Re: Duda sobre Imagenes
|
en: 16 Febrero 2013, 02:57 am
|
Muchas gracias por la información, es algo parecido a lo que leí de wikipedia pero esto no soluciona mi duda. Porque entonces las imágenes tienen distintos tamaños si tienen los mismos pixels dado que cada uno debería ocupar lo mismo? Como se hace para reducir el espacio? Si no me equivoco, al escribir una imagen JPG, conforme mas cantidad de negro exista menos peso tendrá el archivo y contra mas blanco haya más pesa... Como es esto??
|
|
|
6
|
Programación / Java / Duda sobre Imagenes
|
en: 16 Febrero 2013, 00:30 am
|
Buenas, últimamente he estado investigando sobre imágenes en Java y lo que es realmente una imagen para poder desarrollar una aplicación que compare 2 imágenes y obtenga en forma de cadena de enteros la información dentro de la imagen, al hacer esto me han surgido unas cuantas dudas que me gustaría que me aclararan o bien donde puedo encontrar información al respecto. Bien empiezo:
Realizo una captura del escritorio de mi PC a una resolución de 1366x768 de tal modo que llamo a la clase robot y obtengo dicha captura en forma de BufferedImage, esta imagen no es más que una matriz 2D de pixels donde cada pixel según el tipo de imagen puede tener distinta información (almenos en java), suponiendo un tipo de imagen RGB cada pixel estaría compuesto de 3 datos que equivaldrían a 1 Byte cada uno que contendrían la información sobre el color (numero entero del 0-255), bien pues si sacamos cálculos teniendo en cuenta que tenemos una imagen de 1366x768 tenemos un total de 1,049,088 pixels donde cada pixel ocupa 3 Bytes es decir dicha imagen debería ocupar en realidad un total de 3,147,264 Bytes, esto es poco mas de 3MB ?? Como es esto posible si yo al almacenar dicha imagen mediante la clase ImageIO obtengo resultados entorno a 250 KB ? Además, las imágenes de esta resolución no pesan eso...
Donde está el truco?? Estoy seguro de que esto se debe a algún tipo de compresión de imágenes o algo por el estilo pues creo que mis cálculos son correctos...
|
|
|
7
|
Programación / Java / Registro Windows desde Java (WinRegistry)
|
en: 4 Febrero 2013, 03:39 am
|
Buenas! Pues verán, buscando por internet un método adecuado para acceder al registro de Windows mediante Java encontré un código muy interesante pero que tiene la pega de ser detectado como una amenaza para por el mismísimo Windows Defender lo cual hace que la implementación de dicho codigo en cualquier aplicación no sea posible... Mi pregunta es: ¿Existe alguna manera de modificar el código para que sea posible evadir los mecanismos de detección? O dicho de otra forma, que parte del código es la que es detectada como una amenaza para Windows? import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.prefs.Preferences; public class WinRegistry { public static final int HKEY_CURRENT_USER = 0x80000001; public static final int HKEY_LOCAL_MACHINE = 0x80000002; public static final int REG_SUCCESS = 0; public static final int REG_NOTFOUND = 2; public static final int REG_ACCESSDENIED = 5; private static final int KEY_ALL_ACCESS = 0xf003f; private static final int KEY_READ = 0x20019; private static Preferences userRoot = Preferences.userRoot(); private static Preferences systemRoot = Preferences.systemRoot(); private static Class<? extends Preferences> userClass = userRoot.getClass(); private static Method regOpenKey = null; private static Method regCloseKey = null; private static Method regQueryValueEx = null; private static Method regEnumValue = null; private static Method regQueryInfoKey = null; private static Method regEnumKeyEx = null; private static Method regCreateKeyEx = null; private static Method regSetValueEx = null; private static Method regDeleteKey = null; private static Method regDeleteValue = null; static { try { regOpenKey = userClass.getDeclaredMethod("WindowsRegOpenKey", new Class[] { int.class, byte[].class, int.class }); regOpenKey.setAccessible(true); regCloseKey = userClass.getDeclaredMethod("WindowsRegCloseKey", new Class[] { int.class }); regCloseKey.setAccessible(true); regQueryValueEx = userClass.getDeclaredMethod("WindowsRegQueryValueEx", new Class[] { int.class, byte[].class }); regQueryValueEx.setAccessible(true); regEnumValue = userClass.getDeclaredMethod("WindowsRegEnumValue", new Class[] { int.class, int.class, int.class }); regEnumValue.setAccessible(true); regQueryInfoKey = userClass.getDeclaredMethod("WindowsRegQueryInfoKey1", new Class[] { int.class }); regQueryInfoKey.setAccessible(true); regEnumKeyEx = userClass.getDeclaredMethod( "WindowsRegEnumKeyEx", new Class[] { int.class, int.class, int.class }); regEnumKeyEx.setAccessible(true); regCreateKeyEx = userClass.getDeclaredMethod( "WindowsRegCreateKeyEx", new Class[] { int.class, byte[].class }); regCreateKeyEx.setAccessible(true); regSetValueEx = userClass.getDeclaredMethod( "WindowsRegSetValueEx", new Class[] { int.class, byte[].class, byte[].class }); regSetValueEx.setAccessible(true); regDeleteValue = userClass.getDeclaredMethod( "WindowsRegDeleteValue", new Class[] { int.class, byte[].class }); regDeleteValue.setAccessible(true); regDeleteKey = userClass.getDeclaredMethod( "WindowsRegDeleteKey", new Class[] { int.class, byte[].class }); regDeleteKey.setAccessible(true); } e.printStackTrace(); } } private WinRegistry() { } /** * Read a value from key and value name * @param hkey HKEY_CURRENT_USER/HKEY_LOCAL_MACHINE * @param key * @param valueName * @return the value * @throws IllegalArgumentException * @throws IllegalAccessException * @throws InvocationTargetException */ { if (hkey == HKEY_LOCAL_MACHINE) { return readString(systemRoot, hkey, key, valueName); } else if (hkey == HKEY_CURRENT_USER) { return readString(userRoot, hkey, key, valueName); } else { } } /** * Read value(s) and value name(s) form given key * @param hkey HKEY_CURRENT_USER/HKEY_LOCAL_MACHINE * @param key * @return the value name(s) plus the value(s) * @throws IllegalArgumentException * @throws IllegalAccessException * @throws InvocationTargetException */ public static Map <String, String > readStringValues (int hkey, String key ) { if (hkey == HKEY_LOCAL_MACHINE) { return readStringValues(systemRoot, hkey, key); } else if (hkey == HKEY_CURRENT_USER) { return readStringValues(userRoot, hkey, key); } else { } } /** * Read the value name(s) from a given key * @param hkey HKEY_CURRENT_USER/HKEY_LOCAL_MACHINE * @param key * @return the value name(s) * @throws IllegalArgumentException * @throws IllegalAccessException * @throws InvocationTargetException */ public static List <String > readStringSubKeys (int hkey, String key ) { if (hkey == HKEY_LOCAL_MACHINE) { return readStringSubKeys(systemRoot, hkey, key); } else if (hkey == HKEY_CURRENT_USER) { return readStringSubKeys(userRoot, hkey, key); } else { } } /** * Create a key * @param hkey HKEY_CURRENT_USER/HKEY_LOCAL_MACHINE * @param key * @throws IllegalArgumentException * @throws IllegalAccessException * @throws InvocationTargetException */ public static void createKey (int hkey, String key ) { int [] ret; if (hkey == HKEY_LOCAL_MACHINE) { ret = createKey(systemRoot, hkey, key); regCloseKey. invoke(systemRoot, new Object[] { new Integer(ret [0]) }); } else if (hkey == HKEY_CURRENT_USER) { ret = createKey(userRoot, hkey, key); regCloseKey. invoke(userRoot, new Object[] { new Integer(ret [0]) }); } else { } if (ret[1] != REG_SUCCESS) { } } /** * Write a value in a given key/value name * @param hkey * @param key * @param valueName * @param value * @throws IllegalArgumentException * @throws IllegalAccessException * @throws InvocationTargetException */ public static void writeStringValue { if (hkey == HKEY_LOCAL_MACHINE) { writeStringValue(systemRoot, hkey, key, valueName, value); } else if (hkey == HKEY_CURRENT_USER) { writeStringValue(userRoot, hkey, key, valueName, value); } else { } } /** * Delete a given key * @param hkey * @param key * @throws IllegalArgumentException * @throws IllegalAccessException * @throws InvocationTargetException */ public static void deleteKey (int hkey, String key ) { int rc = -1; if (hkey == HKEY_LOCAL_MACHINE) { rc = deleteKey(systemRoot, hkey, key); } else if (hkey == HKEY_CURRENT_USER) { rc = deleteKey(userRoot, hkey, key); } if (rc != REG_SUCCESS) { } } /** * delete a value from a given key/value name * @param hkey * @param key * @param value * @throws IllegalArgumentException * @throws IllegalAccessException * @throws InvocationTargetException */ public static void deleteValue (int hkey, String key, String value ) { int rc = -1; if (hkey == HKEY_LOCAL_MACHINE) { rc = deleteValue(systemRoot, hkey, key, value); } else if (hkey == HKEY_CURRENT_USER) { rc = deleteValue(userRoot, hkey, key, value); } if (rc != REG_SUCCESS) { } } // ===================== private static int deleteValue { int[] handles = (int[]) regOpenKey. invoke(root, new Object[] { if (handles[1] != REG_SUCCESS) { return handles[1]; // can be REG_NOTFOUND, REG_ACCESSDENIED } int rc =((Integer) regDeleteValue. invoke(root, new Integer(handles [0]), toCstr (value ) })).intValue(); regCloseKey. invoke(root, new Object[] { new Integer(handles [0]) }); return rc; } private static int deleteKey (Preferences root, int hkey, String key ) { int rc =((Integer) regDeleteKey. invoke(root, return rc; // can REG_NOTFOUND, REG_ACCESSDENIED, REG_SUCCESS } { int[] handles = (int[]) regOpenKey. invoke(root, new Object[] { if (handles[1] != REG_SUCCESS) { return null; } byte[] valb = (byte[]) regQueryValueEx. invoke(root, new Object[] { new Integer(handles [0]), toCstr (value ) }); regCloseKey. invoke(root, new Object[] { new Integer(handles [0]) }); return (valb != null ? new String(valb ). trim() : null); } private static Map<String,String> readStringValues (Preferences root, int hkey, String key ) { HashMap<String, String> results = new HashMap<String,String>(); int[] handles = (int[]) regOpenKey. invoke(root, new Object[] { if (handles[1] != REG_SUCCESS) { return null; } int[] info = (int[]) regQueryInfoKey.invoke(root, int count = info[0]; // count int maxlen = info[3]; // value length max for(int index=0; index<count; index++) { byte[] name = (byte[]) regEnumValue. invoke(root, new Object[] { results. put(new String(name ). trim(), value ); } regCloseKey. invoke(root, new Object[] { new Integer(handles [0]) }); return results; } private static List<String> readStringSubKeys (Preferences root, int hkey, String key ) { List<String> results = new ArrayList<String>(); int[] handles = (int[]) regOpenKey. invoke(root, new Object[] { }); if (handles[1] != REG_SUCCESS) { return null; } int[] info = (int[]) regQueryInfoKey.invoke(root, int count = info[0]; // Fix: info[2] was being used here with wrong results. Suggested by davenpcj, confirmed by Petrucio int maxlen = info[3]; // value length max for(int index=0; index<count; index++) { byte[] name = (byte[]) regEnumKeyEx. invoke(root, new Object[] { }); results. add(new String(name ). trim()); } regCloseKey. invoke(root, new Object[] { new Integer(handles [0]) }); return results; } private static int [] createKey (Preferences root, int hkey, String key ) { return (int[]) regCreateKeyEx.invoke(root, } private static void writeStringValue { int[] handles = (int[]) regOpenKey. invoke(root, new Object[] { regSetValueEx.invoke(root, new Integer(handles [0]), toCstr (valueName ), toCstr (value ) }); regCloseKey. invoke(root, new Object[] { new Integer(handles [0]) }); } // utility private static byte[] toCstr (String str ) { byte[] result = new byte[str.length() + 1]; for (int i = 0; i < str.length(); i++) { result[i] = (byte) str.charAt(i); } result[str.length()] = 0; return result; } }
|
|
|
9
|
Programación / Programación C/C++ / Re: Problema Función "OpenProcess"
|
en: 2 Febrero 2013, 23:17 pm
|
Pufff... A ver he utilizado la funcion SetPrivileges para ajustar los privilegios tal como dice la API, pero la funcion LookupPrivilegeValue me devuelve un codigo de error 1313 (ERROR_NO_SUCH_PRIVILEGE) que no tengo ni idea de como resolver... De verdad esto es tan complicado ?
|
|
|
10
|
Programación / Programación C/C++ / Re: Problema Función "OpenProcess"
|
en: 2 Febrero 2013, 20:27 pm
|
Gracias por tu respuesta naderST, estoy intentando abrir un juego, en mi caso el WC3 para leer y modificar la memoria, pero el caso es que el problema se repite con cualquier ventana que quiera leer : Codigo de Error = 5... He leido el enlace que me has facilitado y la verdad es que lo que dicen alli ya lo habia intentado sin exito. He probado cambiando el valor de PROCESS_ALL_ACCESS por PROCESS_VM_READ pero sigue dando el mismo problema... Segun dicen debo habilitar algo de SeDebugPrivilege para lograr obtener privilegios. Mirando sobre como activar o desactivar los privilegios en C he llegado a este enlace pero no acabo de lograrlo : http://msdn.microsoft.com/en-us/library/aa446619.aspxHe utilizado la funcion que especifico en el enlace setPrivileges sin exito...
|
|
|
|
|
|
|