Changeset 93 for trunk/helper.cpp


Ignore:
Timestamp:
Jul 17, 2021, 9:18:29 PM (4 years ago)
Author:
Gregg Young
Message:

Make sure we can get the path to the help file.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/helper.cpp

    r49 r93  
    2525{
    2626    HELPINIT   helpInit;
     27    PPIB    ppib;
     28    char   *ptr;
     29   
     30    // get the Process Information Block
     31    DosGetInfoBlocks(0, &ppib);
     32
     33    // get a pointer to the environment
     34    ptr = ppib->pib_pchenv;
     35
     36    // loop through the environment strings to find
     37    // the null string that terminates it
     38    while (*ptr)
     39        ptr = strchr(ptr, 0) + 1;
     40
     41    // the exe's fully-qualified filename starts at the next character
     42    ptr++;
    2743
    2844    // if we return because of an error, Help will be disabled
     
    4662    helpInit.fShowPanelId        = CMIC_HIDE_PANEL_ID;
    4763
     64    CHAR   fullExeName[CCHMAXPATH];
     65    CHAR   *p;;
     66    strcpy(fullExeName, ptr);
     67    p = strrchr(fullExeName, '\\');
     68    if (p)
     69        *p = 0;
    4870    CHAR   ach[_MAX_FNAME+_MAX_EXT];
    49     sprintf (ach, "%s.hlp", pset->QueryString (SEI_LANGUAGEHELP));
     71    sprintf (ach, "%s\\%s.hlp", fullExeName, pset->QueryString (SEI_LANGUAGEHELP));
    5072    helpInit.pszHelpLibraryName  = PSZ (ach);
    5173
Note: See TracChangeset for help on using the changeset viewer.