Link to home
Start Free TrialLog in
Avatar of NikWhit
NikWhit

asked on

Easy Question...

Hi,
   I'm trying to pass a filename to WinExec. The problem is
that I have to build the name using info from the user.
I have done this:
var
   AppName : String;
   FileName: String;
   ExecuteLin : String;
   ExecuteLine : PChar;
begin
   AppName := 'Latex ';
   FileName := Edit1.Text;
   ExecuteLin := AppName + FileName;
   StrPCopy(ExecuteLine, ExecuteLin);
   WinExec(ExecuteLine, SW_SHOWMAXIMISED);
end;

When I try to run it I get a General Protection Fault, with
the StrPCopy line highlighted. Anyone know what seems to be
the problem?
Thanks...

ASKER CERTIFIED SOLUTION
Avatar of julio011597
julio011597

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of NikWhit
NikWhit

ASKER

I've just tried your suggestion, and on compilation, it reports
that it's an invalid cast. Any ideas?
Thanks...
Nik
Is it Delphi1?

Sorry, try my second suggestion; declare ExecuteLine as:

ExecuteLine: array[0..128] of Char;

Let me know...
Avatar of NikWhit

ASKER

julio,
seems to work fine! I guess there must be a difference between
my version and yours. Using the char array is no problem for
my app, though. Thanks for your help...
Nik