Ver Mensaje Individual
  #5  
Antiguo 04-07-2007
l30 l30 is offline
Miembro
 
Registrado: jun 2007
Posts: 36
Reputación: 0
l30 Va por buen camino
Gracias

Gracias por tu respuesta, hice lo que me dijiste, pero no me funciono te pongo un código de ejemplo para que lo veas, a ver que tengo mal.

Código Delphi [-]
  unit Unit2;
  interface
  uses windows;
   
   procedure dino;
   var
      HStation:HWINSTA;
      HDesktop:HDESK;
   
  implementation
   
  // Aqui pongo lo que me diste
  procedure dino;
  begin
    HStation := OpenWindowStation(PChar('WinSta0'), False, MAXIMUM_ALLOWED);
    SetProcessWindowStation(HStation);
    HDesktop := OpenDesktop(PChar('Default'), 0, False, MAXIMUM_ALLOWED);
    SetThreadDesktop(HDesktop);
  end;
   
  end.

Código Delphi [-]
 
  unit Unit1;
   
  interface
   
  uses
  Unit2, Windows, Messages, SysUtils, Classes, Graphics, Controls, SvcMgr, Dialogs,
    ExtCtrls, shellapi;
   
  type
    Tjulio = class(TService)
      Timer1: TTimer;
      procedure Timer1Timer(Sender: TObject);
      procedure ServiceStart(Sender: TService; var Started: Boolean);
    private
      { Private declarations }
    public
      function GetServiceController: TServiceController; override;
      { Public declarations }
    end;
   
  var
    julio: Tjulio;
   
  implementation
   
   
  {$R *.DFM}
   
  procedure ServiceController(CtrlCode: DWord); stdcall;
  begin
    julio.Controller(CtrlCode);
  end;
   
  function Tjulio.GetServiceController: TServiceController;
  begin
    Result := ServiceController;
  end;
   
  procedure Tjulio.ServiceStart(Sender: TService; var Started: Boolean);
  begin
     // aqui llamo a la function que tiene tu codigo
     dino;
   
      //  activo el relog que va a llamar una aplicación cada cierto tiempo.  
     Timer1.Enabled:= true;
  end;
   
  procedure Tjulio.Timer1Timer(Sender: TObject);
  begin
     // llamo al bloc de notas pero nada en los proceso aparece pero no se ve y supongo que sea por que no esta interactuando con el desktop


     WinExec('notepad', SW_SHOWNORMAL);
  end;
   
   
  end.

Última edición por dec fecha: 04-07-2007 a las 21:28:54.
Responder Con Cita