Using ShellExecute with hh.exe and parameters (Delphi 3)

Posted on 2007-10-08
Last Modified: 2008-01-09
I am having problems passing a .CHM file mapID value into a ShellExecute procedure.  Although the .CHM file launches, the context ID (mapID) page does not appear as the default.  Here's the code I'm using...

HelpNullFile: Array[0..128] of Char;
Instance: THandle;


StrPCopy(HelpNullFile, ExtractFilePath(Application.ExeName) + 'help.chm');

Instance := ShellExecute(Application.Handle, 'open', HelpNullFile, PChar('-mapid 5'), nil, SW_SHOWNORMAL      );


If I go to a DOS prompt, and type...

hh.exe -mapID 5 help.chm

... the correct page appears.  How can I get the correct page to appear when launched within Delphi 3?
Question by:Monroe406
    LVL 21

    Expert Comment

    Show me the command line text please.  When I see that I should be able to help.

    Author Comment

    >> Show me the command line text please.

    I had the command line version in my original message:

    hh.exe -mapID 5 help.chm
    LVL 1

    Accepted Solution

    My guess...

    ShellExecute(Handle,'open','hh.exe','-mapid 5 c:\dir\help.chm',nil,SW_SHOWNORMAL)

    Author Comment

    'hh.exe' should be PChar('hh.exe')

    Featured Post

    What Is Threat Intelligence?

    Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

    Join & Write a Comment

    The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
    Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    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

    19 Experts available now in Live!

    Get 1:1 Help Now