Lazarus
Installation => PDAs and Smartphones => Topic started by: leandrojcbh on December 05, 2013, 05:49:51 pm
-
Hello!
I try to use in Lazarus:
uses
shellapi, process, windows;
(CreateProcess(pwidechar('\program files\test\hello.exe'), Nil, Nil, Nil,
False, CREATE_NEW_CONSOLE, Nil, Nil, StartupInfo, ProcessInformation));
Error:
unit1.pas(40,71) Error: Identifier not found "ProcessInformation" !
Help!
-
processinformation afaik is a variable that you must declare. See MSDN
-
But How?
I want do execute a .exe file!
Can you help!
I´m lost!
-
This is my prog:
unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, Forms, Controls, Dialogs, Menus,
StdCtrls, Buttons, ExtCtrls, ComCtrls, DbCtrls, shellapi, process,
windows, winceproc, winceint;
type
{ TForm1 }
TForm1 = class(TForm)
Button1: TButton;
Edit1: TEdit;
procedure Button1Click(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.lfm}
{ TForm1 }
procedure TForm1.Button1Click(Sender: TObject);
var
ProcessInformation:tProcessInformation;
begin
CreateProcess(pwidechar('volume.exe'), Nil, Nil, Nil,
False, CREATE_NEW_CONSOLE, Nil, Nil, StartupInfo, ProcessInformation);
end;
end.
What is wrong?
-
I get it!
Thanks!!!
-
But How?
I want do execute a .exe file!
Can you help!
I´m lost!
if you just want to execute a .exe file, you can use shellExecute for more simplier. For example :
ShellExecute(0, nil, 'notepad.exe', nil, nil, 1);
this function is included in unit shellapi :)