Ver Mensaje Individual
  #2  
Antiguo 24-06-2008
_cero_ _cero_ is offline
Miembro
 
Registrado: abr 2007
Posts: 147
Reputación: 18
_cero_ Va por buen camino
Wink

Bueno como ya me estoy tardando lo solucione creando la DLL en Delphi y cargándola en C, funciona pero lo hubiera preferido de otro modo, bueno les digo como lo hice por si se le ofrece a alguien más.

Primero escribí la DLL.
Código Delphi [-]
library accesos;
{Ls}

uses
  SysUtils,
  Windows,
  Messages,
  Dialogs,
  ShlObj,
  ComObj,
  ActiveX,
  StdCtrls,
  ShFolder,
  Classes;

{$R *.res}

procedure crearlink(const Rutlink :string);
var
  CDire: array [0..MAX_PATH-1] of char;
  IObject: IUnknown;
  SLink: IShellLink;
  PFile: IPersistFile;
  desk :string;
begin
  SHGetFolderPath(0,CSIDL_DESKTOPDIRECTORY,0,0,CDire);
  desk:=CDire+'\Requerimientos.lnk';
  IObject:=CreateComObject(CLSID_ShellLink);
  SLink:=IObject as IShellLink;
  PFile:=IObject as IPersistFile;
  with SLink do
  begin
    SetArguments(PChar(''));
    SetDescription(PChar('Sistema Requerimientos'));
    SetPath(PChar(Rutlink));
  end;
  PFile.Save(PWChar(WideString(desk)), FALSE);
end;

exports crearlink;
begin
end.

Después, para llamarla desde una aplicación hecha en C.
Código:
void __fastcall TForm1::Button1Click(TObject *Sender)
{
  typedef bool (*TCHA)(char *com1);
  HMODULE hLib = LoadLibrary("accesos.dll");
  if (hLib)
  {
   String olo="C:\\Program Files";
   TCHA createlinkk = (TCHA)GetProcAddress(hLib,"crearlink");
   createlinkk(olo.c_str());
   FreeLibrary(hLib);
  }
}
Bueno nos vemos y gracias.
Responder Con Cita