![]() |
![]() |
| Paypal | FTP | CCD | Buscar | Trucos | Trabajo | Foros |
|
|||||||
| Registrarse | FAQ | Miembros | Calendario | Guía de estilo | Temas de Hoy |
![]() |
|
|
Herramientas | Buscar en Tema | Desplegado |
|
#1
|
|||
|
|||
|
Como creo un aaceso directo desde C++ Builder 6
Buenas tardes, quiero saber como puedo mediante codigo crear un acceso directo tanto en el escritorio como en el menu inicio en la barra de programas. Gracias.
|
|
#2
|
||||
|
||||
|
Esto es una pregunta típica para buscar en MSDN.
![]()
__________________
Proyectos actuales --> Allegro 5 Pascal ¡y Delphi! - BAScript - Multi Language Scriptable Development Environment |
|
#3
|
||||
|
||||
|
Hola DSK25.
Para crear los accesos directos podes hacer: Código:
#include<shlobj.h>
#include<comobj.hpp>
void CreateShortcut(char *ExeFileName, char *LnkFileName)
{
IUnknown *UInterface;
IShellLink *ISlink;
IPersistFile *IPfile;
OleCheck(CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_ALL,
IID_IUnknown, (void**) &UInterface));
__try {
OleCheck(UInterface->QueryInterface(IID_IShellLink,(void**) &ISlink));
__try {
ISlink->SetPath(ExeFileName);
OleCheck(UInterface->QueryInterface(IID_IPersistFile,(void**) &IPfile));
__try {
IPfile->Save((WideString)LnkFileName, False);
}
__finally {
IPfile->Release();
}
}
__finally {
ISlink->Release();
}
}
__finally {
UInterface->Release();
}
}
Código:
void __fastcall TForm1::Button1Click(TObject *Sender)
}
char PathToShortcut[260];
char *ExeFileName = "C:\\MiPrograma.exe"; // ruta al programa
char *LnkFileName = "MiPrograma.lnk"; // nombre del a. directo
/* componer ruta a escritorio */
wsprintf(PathToShortcut,"%s%s%s", getenv("USERPROFILE"),
"\\Desktop\\", LnkFileName);
/* Crear acceso directo */
CreateShortcut(ExeFileName, PathToShortcut);
/* componer ruta a Menu de inicio */
ZeroMemory(PathToShortcut, sizeof(PathToShortcut));
wsprintf(PathToShortcut,"%s%s%s", getenv("APPDATA"),
"\\Microsoft\\Windows\\Start Menu\\Programs\\", LnkFileName);
/* Crear acceso directo */
CreateShortcut(ExeFileName, PathToShortcut);
}
Project -> Options -> Directories/Conditionals -> Conditional defines, click sobre el boton con puntos suspensivos (...), escribí NO_WIN32_LEAN_AND_MEAN en el cuadro de edición y hace click sobre el botón Add. Saludos.
__________________
Daniel Didriksen Guía de estilo - Uso de las etiquetas - La otra guía de estilo .... Última edición por ecfisa fecha: 10-07-2012 a las 14:28:10. Razón: agregar comentarios |
|
#4
|
|||
|
|||
|
Gracias ecfisa, me funciono perfectamente.
|
![]() |
|
|
Temas Similares
|
||||
| Tema | Autor | Foro | Respuestas | Último mensaje |
| ¿Como creo una tabla desde un fichero .ini? | Thoma | Conexión con bases de datos | 19 | 29-07-2011 16:52:33 |
| ¿Cómo creo una base de datos desde Delphi? | Thoma | Firebird e Interbase | 12 | 27-07-2011 20:27:16 |
| Como ejecutar un archivo .chm desde C++ Builder 5? | mapch | C++ Builder | 1 | 13-08-2004 07:01:47 |
| Crear un acceso directo a una aplicion desde MS-DOS | aram2r | Windows | 2 | 19-05-2004 17:14:59 |
| Como creo, inserto y leo un txt desde delphi? | danytorres | Varios | 5 | 28-11-2003 21:17:17 |
|