Ver Mensaje Individual
  #2 (permalink)  
Antiguo 03/03/2015, 00:49
Avatar de vangodp
vangodp
 
Fecha de Ingreso: octubre-2013
Mensajes: 934
Antigüedad: 10 años, 7 meses
Puntos: 38
Respuesta: abrir ficheros con "abrir con"

Debes aprender a editar el registro.
Busque alguna función que te permita modificarlo. No se exactamente como hacer.

Pero para que te funcione como quieres tienes por ejemplo especificar el programa con el que abre, agregar el archivo en el menú abrir con, agregar texto de ayuda etc etc, según lo que vayas hacer hay que editar varias partes del registro.

Para el archivo .txt seria algo asi:

Windows Registry Editor Version 5.00

Código BASH:
Ver original
  1. [-HKEY_CLASSES_ROOT\.txt]
  2.  
  3. [HKEY_CLASSES_ROOT\.txt]
  4. "PerceivedType"="text"
  5. @="txtfile"
  6. "Content Type"="text/plain"
  7.  
  8. [HKEY_CLASSES_ROOT\.txt\PersistentHandler]
  9. @="{5e941d80-bf96-11cd-b579-08002b30bfeb}"
  10.  
  11. [HKEY_CLASSES_ROOT\.txt\ShellNew]
  12. "ItemName"=hex(2):40,00,25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,\
  13.   6f,00,74,00,25,00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,\
  14.   00,6e,00,6f,00,74,00,65,00,70,00,61,00,64,00,2e,00,65,00,78,00,65,00,2c,00,\
  15.   2d,00,34,00,37,00,30,00,00,00
  16. "NullFile"=""
  17.  
  18. [-HKEY_CLASSES_ROOT\txtfile]
  19.  
  20. [HKEY_CLASSES_ROOT\txtfile]
  21. "EditFlags"=dword:00010000
  22. @="Text Document"
  23. "FriendlyTypeName"=hex(2):40,00,25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,\
  24.   00,6f,00,6f,00,74,00,25,00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,\
  25.   32,00,5c,00,6e,00,6f,00,74,00,65,00,70,00,61,00,64,00,2e,00,65,00,78,00,65,\
  26.   00,2c,00,2d,00,34,00,36,00,39,00,00,00
  27.  
  28. [HKEY_CLASSES_ROOT\txtfile\DefaultIcon]
  29. @=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,00,25,\
  30.   00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,69,00,6d,00,\
  31.   61,00,67,00,65,00,72,00,65,00,73,00,2e,00,64,00,6c,00,6c,00,2c,00,2d,00,31,\
  32.   00,30,00,32,00,00,00
  33.  
  34. [HKEY_CLASSES_ROOT\txtfile\shell]
  35.  
  36. [HKEY_CLASSES_ROOT\txtfile\shell\open]
  37.  
  38. [HKEY_CLASSES_ROOT\txtfile\shell\open\command]
  39. @=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,00,25,\
  40.   00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,4e,00,4f,00,\
  41.   54,00,45,00,50,00,41,00,44,00,2e,00,45,00,58,00,45,00,20,00,25,00,31,00,00,\
  42.   00
  43.  
  44. [HKEY_CLASSES_ROOT\txtfile\shell\print]
  45.  
  46. [HKEY_CLASSES_ROOT\txtfile\shell\print\command]
  47. @=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,00,25,\
  48.   00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,4e,00,4f,00,\
  49.   54,00,45,00,50,00,41,00,44,00,2e,00,45,00,58,00,45,00,20,00,2f,00,70,00,20,\
  50.   00,25,00,31,00,00,00
  51.  
  52. [HKEY_CLASSES_ROOT\txtfile\shell\printto]
  53.  
  54. [HKEY_CLASSES_ROOT\txtfile\shell\printto\command]
  55. @=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,00,25,\
  56.   00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,6e,00,6f,00,\
  57.   74,00,65,00,70,00,61,00,64,00,2e,00,65,00,78,00,65,00,20,00,2f,00,70,00,74,\
  58.   00,20,00,22,00,25,00,31,00,22,00,20,00,22,00,25,00,32,00,22,00,20,00,22,00,\
  59.   25,00,33,00,22,00,20,00,22,00,25,00,34,00,22,00,00,00
  60.  
  61. [-HKEY_CLASSES_ROOT\SystemFileAssociations\.txt]
  62.  
  63. [HKEY_CLASSES_ROOT\SystemFileAssociations\.txt]
  64. "PerceivedType"="document"
  65.  
  66. [-HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.txt]
  67.  
  68. [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.txt]
  69.  
  70. [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.txt\OpenWithList]
  71. "a"="NOTEPAD.EXE"
  72. "MRUList"="a"
  73.  
  74. [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.txt\OpenWithProgids]
  75. "txtfile"=hex(0):

Es algo lioso y ademas depende mucho del sistema operativo pero si buscas unos tips de como editar el registro seguro los encuentra. Eso se suele hacer con batchs e de seguro encuentras muchos por la red, aquí dejo una pagina con unos ejemplos para algunos archivos muy conocidos: http://www.techsupportall.com/file-association-fixes/

Básicamente hablando seria agregar la entrada de tu fichero nuevo en el registro o editar los ya existentes como txt, cpp etcetc, para que hagan lo que quieras.

Lo mejor es hacer una copia de seguridad del registro antes de cagarlo por completo. O mejor aun una copia del sistema si vas a estar probando cosas peligrosas. jajaja

Busque como editar el registro en C por Internet que algo sale fijo.
Si alguien sabe alguna forma mejor que lo diga aquí que a mi me interesa también.