Ignore:
Timestamp:
Aug 11, 2002, 7:07:59 PM (23 years ago)
Author:
umoeller
Message:

Major work on textview control and dialogs.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/helpers/apps.c

    r196 r201  
    3939
    4040#define INCL_WINPROGRAMLIST     // needed for PROGDETAILS, wppgm.h
     41#define INCL_WINSHELLDATA
    4142#define INCL_WINERRORS
    4243#define INCL_SHLERRORS
     
    11461147 *@@added V0.9.18 (2002-03-27) [umoeller]
    11471148 *@@changed V0.9.19 (2002-03-28) [umoeller]: now allocating contiguous buffer
     1149 *@@changed V0.9.20 (2002-07-03) [umoeller]: fixed Win-OS/2 full screen breakage
     1150 *@@changed V0.9.20 (2002-07-03) [umoeller]: fixed broken bat and cmd files when PROG_DEFAULT was set
    11481151 */
    11491152
     
    11631166
    11641167    if (!pcProgDetails && !ppDetails)
    1165         return (ERROR_INVALID_PARAMETER);
     1168        return ERROR_INVALID_PARAMETER;
    11661169
    11671170    /*
     
    13861389        {
    13871390            if (    (ulIsWinApp)
    1388                  && (    (Details.pszEnvironment == NULL)
    1389                       || (!strlen(Details.pszEnvironment))
     1391                 && (    (!(Details.pszEnvironment))
     1392                      || (!(*Details.pszEnvironment))
    13901393                    )
    13911394               )
     
    17291732
    17301733    if (!pcProgDetails)
    1731         return (ERROR_INVALID_PARAMETER);
     1734        return ERROR_INVALID_PARAMETER;
    17321735
    17331736    if (pszFailingName)
     
    19331936
    19341937    if (!phapp)
    1935         return (ERROR_INVALID_PARAMETER);
     1938        return ERROR_INVALID_PARAMETER;
    19361939
    19371940    if (!(arc = appBuildProgDetails(&pDetails,
     
    20152018/*
    20162019 *@@ appQuickStartApp:
    2017  *      shortcut for simply starting an app and
    2018  *      waiting until it's finished.
     2020 *      shortcut for simply starting an app.
    20192021 *
    20202022 *      On errors, NULLHANDLE is returned.
    20212023 *
    2022  *      If pulReturnCode != NULL, it receives the
    2023  *      return code of the app.
     2024 *      Only if pulExitCode != NULL, we wait for
     2025 *      the app to complete and return the
     2026 *      exit code.
    20242027 *
    20252028 *@@added V0.9.16 (2001-10-19) [umoeller]
     2029 *@@changed V0.9.20 (2002-08-10) [umoeller]: fixed missing destroy window, made wait optional
     2030 *@@changed V0.9.20 (2002-08-10) [umoeller]: added pcszWorkingDir
    20262031 */
    20272032
    20282033HAPP appQuickStartApp(const char *pcszFile,
    2029                       ULONG ulProgType,         // e.g. PROG_PM
    2030                       const char *pcszArgs,
    2031                       PULONG pulExitCode)
     2034                      ULONG ulProgType,             // e.g. PROG_PM
     2035                      const char *pcszArgs,         // in: arguments (can be NULL)
     2036                      const char *pcszWorkingDir,   // in: working dir (can be NULL)
     2037                      PULONG pulExitCode)           // out: exit code; if ptr is NULL, we don't wait
    20322038{
    20332039    PROGDETAILS    pd = {0};
     
    20432049    pd.pszExecutable = (PSZ)pcszFile;
    20442050    pd.pszParameters = (PSZ)pcszArgs;
    2045     if (p = strrchr(pcszFile, '\\'))
     2051
     2052    if (    (!(pd.pszStartupDir = (PSZ)pcszWorkingDir))
     2053         && (p = strrchr(pcszFile, '\\'))
     2054       )
    20462055    {
    20472056        strhncpy0(szDir,
     
    20602069       )
    20612070    {
    2062         if (appWaitForApp(hwndObject,
     2071        if (pulExitCode)
     2072            appWaitForApp(hwndObject,
    20632073                          happ,
    2064                           pulExitCode))
    2065             happReturn = happ;
     2074                          pulExitCode);
     2075
     2076        happReturn = happ;
     2077
     2078        WinDestroyWindow(hwndObject);       // was missing V0.9.20 (2002-08-10) [umoeller]
    20662079    }
    20672080
    20682081    return happReturn;
    20692082}
     2083
     2084/*
     2085 *@@ appOpenURL:
     2086 *      opens the system default browser with the given
     2087 *      URL.
     2088 *
     2089 *@@added V0.9.20 (2002-08-10) [umoeller]
     2090 */
     2091
     2092BOOL appOpenURL(PCSZ pcszURL)
     2093{
     2094    BOOL        brc = FALSE;
     2095
     2096    CHAR        szBrowser[CCHMAXPATH],
     2097                szStartupDir[CCHMAXPATH];
     2098    XSTRING     strParameters;
     2099
     2100    xstrInit(&strParameters, 0);
     2101
     2102    if (PrfQueryProfileString(HINI_USER,
     2103                              "WPURLDEFAULTSETTINGS",
     2104                              "DefaultBrowserExe",
     2105                              "NETSCAPE.EXE",
     2106                              szBrowser,
     2107                              sizeof(szBrowser)))
     2108    {
     2109        PSZ pszDefParams;
     2110
     2111        if (pszDefParams = prfhQueryProfileData(HINI_USER,
     2112                                                "WPURLDEFAULTSETTINGS",
     2113                                                "DefaultParameters",
     2114                                                NULL))
     2115        {
     2116            xstrcpy(&strParameters, pszDefParams, 0);
     2117            xstrcatc(&strParameters, ' ');
     2118            free(pszDefParams);
     2119        }
     2120
     2121        xstrcat(&strParameters, pcszURL, 0);
     2122
     2123        PrfQueryProfileString(HINI_USER,
     2124                              "WPURLDEFAULTSETTINGS",
     2125                              "DefaultWorkingDir",
     2126                              "",
     2127                              szStartupDir,
     2128                              sizeof(szStartupDir));
     2129
     2130
     2131        brc = !!appQuickStartApp(szBrowser,
     2132                                 PROG_DEFAULT,
     2133                                 strParameters.psz,
     2134                                 szStartupDir,
     2135                                 NULL);            // don't wait
     2136    }
     2137
     2138    xstrClear(&strParameters);
     2139
     2140    return brc;
     2141}
Note: See TracChangeset for help on using the changeset viewer.