fix for bug#10810 if Help=Online;url is included in the ini file then the online help is launched with that url

This commit is contained in:
varada%netscape.com 1999-10-26 21:10:39 +00:00
Родитель e6e2c9e39f
Коммит 1eeacb0adb
6 изменённых файлов: 100 добавлений и 15 удалений

Просмотреть файл

@ -6,6 +6,7 @@
#include "ImgDlg.h"
#include "HelpDlg.h"
#include "WizHelp.h"
#include "interpret.h"
#ifdef _DEBUG
#define new DEBUG_NEW
@ -15,7 +16,7 @@ static char THIS_FILE[] = __FILE__;
/////////////////////////////////////////////////////////////////////////////
// CImgDlg dialog
extern CInterpret *theInterpreter;
extern char iniFilePath[MAX_SIZE];
extern char imagesPath[MAX_SIZE];
extern CString iniTracker;
@ -72,8 +73,18 @@ void CImgDlg::OnHelpButton()
// TODO: Add your control notification handler code here
// CWnd Mywnd;
// Mywnd.MessageBox("hello","hello",MB_OK);
CHelpDlg hlpdlg;
int retVal = hlpdlg.DoModal();
CString helpvalue = iniTracker;
CString helpvar = helpvalue.Left(6);
if (helpvar.CompareNoCase("Online")== 0)
{
helpvalue.Delete(0,7);
theInterpreter->OpenBrowser((char*)(LPCTSTR)helpvalue);
}
else
{
CWizHelp hlpdlg;
hlpdlg.DoModal();
}
}

Просмотреть файл

@ -442,6 +442,13 @@ NODE* CWizardMachineApp::CreateNode(NODE *parentNode, CString iniFile)
NewNode->localVars->wizbut->cancel = parentNode->localVars->wizbut->cancel;
}
GetPrivateProfileString(varSection, "Help", "", buffer, MAX_SIZE, iniFile);
NewNode->localVars->wizbut->help = buffer;
if (NewNode->localVars->wizbut->help == "")
{
NewNode->localVars->wizbut->help = parentNode->localVars->wizbut->help;
}
CString tempPageVar = "";
int index = iniFile.ReverseFind('\\');
@ -607,7 +614,7 @@ void CWizardMachineApp::CreateNode()
GlobalDefaults->localVars->wizbut->back = "<Back";
GlobalDefaults->localVars->wizbut->next = "Next>";
GlobalDefaults->localVars->wizbut->cancel = "Exit";
GlobalDefaults->localVars->wizbut->back = "Help";
GlobalDefaults->localVars->wizbut->help = "Offline";
GlobalDefaults->subPages = NULL;
GlobalDefaults->navControls = NULL;
GlobalDefaults->pageWidgets = NULL;
@ -1599,8 +1606,17 @@ void CWizardMachineApp::GenerateList(CString action, WIDGET* targetWidget, CStri
void CWizardMachineApp::HelpWiz()
{
CWizHelp hlpdlg;
hlpdlg.DoModal();
CString helpvalue = (CurrentNode->localVars->wizbut->help);
CString helpvar = helpvalue.Left(6);
if (helpvar.CompareNoCase("Online")== 0)
{
helpvalue.Delete(0,7);
// AfxMessageBox("online",MB_OK);
theInterpreter->OpenBrowser((char*)(LPCTSTR)helpvalue);
}
else
{
CWizHelp hlpdlg;
hlpdlg.DoModal();
}
}

Просмотреть файл

@ -81,6 +81,7 @@ typedef struct WIZBUT
CString back;
CString next;
CString cancel;
CString help;
}WIZBUT;
typedef struct VARS
@ -138,8 +139,8 @@ typedef int (DLLPROC)(CString parms);
typedef struct DLLINFO
{
CString dllName;
CString procName;
CString *dllName;
CString *procName;
HMODULE hDLL;
DLLPROC *procAddr;
DLLINFO *next;

Просмотреть файл

@ -221,7 +221,7 @@ BOOL CInterpret::Progress()
return TRUE;
}
void CInterpret::ExecuteCommand(char *command, int showflag)
void CInterpret::ExecuteCommand(char *command, int showflag, DWORD wait)
{
STARTUPINFO startupInfo;
PROCESS_INFORMATION processInfo;
@ -238,7 +238,7 @@ void CInterpret::ExecuteCommand(char *command, int showflag)
NORMAL_PRIORITY_CLASS, NULL, NULL,
&startupInfo, &processInfo);
DWORD error = GetLastError();
WaitForSingleObject(processInfo.hProcess, INFINITE);
WaitForSingleObject(processInfo.hProcess, wait);
}
BOOL CInterpret::IterateListBox(char *parms)
@ -276,12 +276,66 @@ BOOL CInterpret::IterateListBox(char *parms)
char *cmd_copy = strdup(cmd);
CString command = replaceVars(cmd_copy, s);
free(cmd_copy);
ExecuteCommand((char *) (LPCSTR) command, showflag);
ExecuteCommand((char *) (LPCSTR) command, showflag,INFINITE);
}
return TRUE;
}
BOOL CInterpret::GetRegistryKey( HKEY key, char *subkey, char *retdata )
{
long retval;
HKEY hkey;
retval = RegOpenKeyEx(key, subkey, 0, KEY_QUERY_VALUE, &hkey);
if(retval == ERROR_SUCCESS)
{
long datasize = MAX_SIZE;
char data[MAX_SIZE];
RegQueryValue(hkey,NULL,(LPSTR)data,&datasize);
lstrcpy(retdata,data);
RegCloseKey(hkey);
}
return retval;
}
BOOL CInterpret::OpenBrowser(const char *url)
{
char key[MAX_SIZE + MAX_SIZE];
BOOL retflag = FALSE;
/* get the .htm regkey and lookup the program */
if(GetRegistryKey(HKEY_CLASSES_ROOT,".htm",key) == ERROR_SUCCESS)
{
lstrcat(key,"\\shell\\open\\command");
if(GetRegistryKey(HKEY_CLASSES_ROOT,key,key) == ERROR_SUCCESS)
{
char *pos;
pos = strstr(key,"\"%1\"");
if(pos == NULL) /* if no quotes */
{
/* now check for %1, without the quotes */
pos = strstr(key,"%1");
if(pos == NULL) /* if no parameter */
pos = key+lstrlen(key)-1;
else
*pos = '\0'; /* remove the parameter */
}
else
*pos = '\0'; /* remove the parameter */
lstrcat(pos," ");
lstrcat(pos,url);
ExecuteCommand(key,SW_SHOW,50);
retflag = TRUE;
}
}
return retflag;
}
CString CInterpret::replaceVars(CString str, char *listval)
{
char *theStr = (char *) (LPCTSTR) str;
@ -451,7 +505,7 @@ BOOL CInterpret::interpret(CString cmds, WIDGET *curWidget)
else if (strcmp(pcmd, "command") == 0)
{
CString p = replaceVars(parms, NULL);
ExecuteCommand((char *) (LPCSTR) p, SW_SHOWDEFAULT);
ExecuteCommand((char *) (LPCSTR) p, SW_SHOWDEFAULT,INFINITE);
}
else if (strcmp(pcmd, "IterateListBox") == 0)
{

Просмотреть файл

@ -37,13 +37,15 @@ public:
BOOL BrowseFile(WIDGET *curWidget);
BOOL BrowseDir(WIDGET *curWidget);
BOOL Progress(); // Not actually used right now
void ExecuteCommand(char *command, int showflag);
void ExecuteCommand(char *command, int showflag,DWORD wait);
BOOL IterateListBox(char *parms);
CString replaceVars(CString str, char *listval);
CString replaceVars(char *str, char *listval);
BOOL CallDLL(char *dll, char *proc, char *parms);
BOOL interpret(char *cmds, WIDGET *curWidget);
BOOL interpret(CString cmds, WIDGET *curWidget);
BOOL CInterpret::GetRegistryKey( HKEY key, char *subkey, char *retdata );
BOOL CInterpret::OpenBrowser(const char *url);
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CWizardMachineApp)

Просмотреть файл

@ -81,6 +81,7 @@ typedef struct WIZBUT
CString back;
CString next;
CString cancel;
CString help;
}WIZBUT;
typedef struct VARS