Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1405
  • Last Modified:

procedure ShellExecute called in IDE locks app and IDE

Hi
if I call "ShellExecute" within the IDE (meaning debugging my application) I often (not always) get an "external exception EEFFACE" and the application and the IDE are locked. I have to kill Delphi7-process. Starting the application without IDE this problem newer occurs.

Any idea where the problem is or how I can call the external application not using ShellExecute?

Thanks in advance, Peter
ShellExecute(0, 'open', StrPCopy(zFileName, 'http://SiteToBeCalled'), '','', SW_SHOWMAXIMIZED);

Open in new window

0
formi
Asked:
formi
1 Solution
 
zer0se7enCommented:
I'm not sure the conversion you use is memory safe (because it does not perform any length checking - http://www.freepascal.org/docs-html/rtl/strings/strpcopy.html).

Better use the PChar() conversion routine like this:
ShellExecute(0, 'open', PChar(zFileName), '','', SW_SHOWMAXIMIZED);
or simply input the text as string constant:
ShellExecute(0, 'open', 'http://SiteToBeCalled', '','', SW_SHOWMAXIMIZED);
0
 
MichaelSteinerCommented:
I would recommend:
ShellExecute(Handle, 'open', PChar('http://SiteToBeCalled'), nil,nil, SW_SHOWMAXIMIZED);
 
0

Featured Post

[Webinar On Demand] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now