| |||
lo mas simple seria que agregues en el registro de windows tu aplicacion en la parte de los menu contextuales, luego debes hacer la asociacion del TxT a tu aplicacion, mediante api.
__________________ Salute !!! RollBack |
| ||||
HKEY_CLASSES_ROOT\txtfile\shell Tenes que crear una clave con el nombre de la acción asociada, otra que diga command y el valor por defecto de esta clave debe ser el ejecutable con los parametros que necesite, con poner "%1" supongo que ira perfecto. Este es un ejemplo (Asociar.cpp):
Código:
#include <windows.h> void main() { HKEY extensionKey = 0; DWORD Result = RegOpenKey(HKEY_CLASSES_ROOT, "txtfile\\shell", &extensionKey); if (Result == ERROR_SUCCESS) { HKEY asociacionKey = 0; Result = RegCreateKey(extensionKey, "WWW", &asociacionKey); RegCloseKey(extensionKey); if (Result == ERROR_SUCCESS) { HKEY commandKey = 0; Result = RegCreateKey(asociacionKey, "command", &commandKey); RegCloseKey(asociacionKey); if (Result == ERROR_SUCCESS) { char ejecutable[] = "notepad \"%1\""; RegSetValue(commandKey, "", REG_SZ, ejecutable, strlen(ejecutable)); RegCloseKey(commandKey); } } } }
__________________ ¡Peron cumple, Evita dignifica! VIVA PERON CARAJO |
| |||
![]() NO ESE CODIGO ES PARA C, ESTE ES PARA VB:
Código:
OJALA TE SIRVA.API's RegOpenKey, RegCreateKey, RegCloseKey, RegSetValueEx CONSTANTES HKEY_CLASSES_ROOT, ERROR_SUCCESS, REG_SZ Sub GuardarRegistro(hkey As Long, Path As String, Value As String, Data As String) Dim ret RegCreateKey hkey, Path, ret RegSetValueEx ret, Value, 0, REG_SZ, ByVal Data, Len(Data) RegCloseKey ret End Sub Sub Registro() GuardarRegistro HKEY_CLASSES_ROOT, "txtfile\shell", "NombreValor", "%SystemRoot%\system32\NOTEPAD.EXE /p %1" ' O NO SE QUE LE PONGAS AQUI End Sub CHAO |
| ||||
Cita: me da error de compilacion con eso, aparte de k con la "comilla" hace que sea un comentario,si se la kito me dice que
Iniciado por RadicalEd
Código:
API's RegOpenKey, RegCreateKey, RegCloseKey, RegSetValueEx RegOpenKey no es valido, que falla? |
| |||
![]() MI QUERIDO AMIGO, CUANGO TE DIGO API's SON UNAS FUNCIONES PROPIAS DEL WINDOZE, NO SE DECLARAN COMO ESTAN AHI, UTILIZA EL VISOR DE TEXTO API, QUE VIENE CON EL VISUAL BASIC Y COLOCAS EL NOMBRE DE LAS API's SON UNAS FUNCIONES PARECIDAS A ESTO
Código:
OJALA TE SIRVA.Private Declare Function RegSetValueEx Lib "user32" Alias "RegSetValueExA" (Byval algo As Long) As Long 'ALGO ASI NO ESTA BIEN CHAO |