procedure ShellExecute called in IDE locks app and IDE

Posted on 2009-02-09
Last Modified: 2013-12-03
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

Question by:formi
    LVL 4

    Accepted Solution

    I'm not sure the conversion you use is memory safe (because it does not perform any length checking -

    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);

    Expert Comment

    I would recommend:
    ShellExecute(Handle, 'open', PChar('http://SiteToBeCalled'), nil,nil, SW_SHOWMAXIMIZED);

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    Join & Write a Comment

    This article describes a technique for converting RTF (Rich Text Format) data to HTML and provides C++ source that does it all in just a few lines of code. Although RTF is coming to be considered a "legacy" format, it is still in common use... po…
    After several hours of googling I could not gather any information on this topic. There are several ways of controlling the USB port connected to any storage device. The best example of that is by changing the registry value of "HKEY_LOCAL_MACHINE\S…
    This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA.…
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now