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...
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Is it Delphi1?
Sorry, try my second suggestion; declare ExecuteLine as:
ExecuteLine: array[0..128] of Char;
Let me know...
Sorry, try my second suggestion; declare ExecuteLine as:
ExecuteLine: array[0..128] of Char;
Let me know...
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
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
ASKER
that it's an invalid cast. Any ideas?
Thanks...
Nik