[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


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

Posted on 2007-10-08
Medium Priority
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
  • 2
LVL 21

Expert Comment

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

Author Comment

ID: 20035684
>> Show me the command line text please.

I had the command line version in my original message:

hh.exe -mapID 5 help.chm

Accepted Solution

wavget earned 400 total points
ID: 20035954
My guess...

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

Author Comment

ID: 20036024
'hh.exe' should be PChar('hh.exe')

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses
Course of the Month20 days, 4 hours left to enroll

873 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