Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hello there, I am using the foll

Status
Not open for further replies.

nicasa

Programmer
Feb 3, 2003
54
ES
Hello there,

I am using the following code to invoke a help file in html format when a user clicks BitBtn3. This will work fine if thw user clicks this FIRST before doing anything else BUT if the user does other stuff first and then tries to invoke the help file it DOES NOT work. WHY ??

void __fastcall TForm1::BitBtn3Click(TObject *Sender)
{
ShellExecute(NULL, "open", "HelpFile.htm", 0,0, SW_SHOWNORMAL);
}

THanks,

Steven Matthews
 
So you wrote an HTML help file????

I did the same thing, and I don't know why your code doesn't work, heck I dont even know what it is, but if you want to take the easy way out, create a new form and drop a CppWebBrowser component on it. Use the Navigate2() function of the CppWebBrowser to open the file, and call it in the OnShow of the form. Then just NewForm->ShowModal() when the button is clicked.
Essentially, you are embedding a custom Internet Explorer within your ap.

Sorry I couldn't help your code, but if you need to, try this...

onrdbandit
 
If your program changes the current working directory you may have to change back to the proper directory or give a complete file path.

tomcruz.net
 
Thanks Butthead.

I followed your advice BUT I have no idea how to use the
Navigate2() function to open my help.htm file! There is NO help for this with bcb v5.0. Do you know anything about the mysteries of Navigate2() ??

Thanks,

Steven Matthews
 
I'm using Navigate() and that works. Some code:

char buffer[250];
strcpy(buffer, "file:C/:path/file.htm"); // for file on local disk
WideString url = WideString(buffer);
webbrow->Navigate(url);

Be sure to use full pathnames and WideString.

Success

Henk Stijnen

 
TCppWebBrowser::Navigate2

Navigates to a specified resource.

void __fastcall Navigate2(TVariant *URL, TVariant* Flags=TNoParam(), TVariant* TargetFrameName=TNoParam(), TVariant* PostData=TNoParam(), TVariant* Headers=TNoParam());

Description

Use Navigate2 to locate and download a specific resource. Navigate can send an HTTP message to a specified URL and display the results, display the results of a specified file, or navigate to a resource that can’t be expressed as an URL such as an item identifier list.

URL specifies the UNC path name of a file, the Uniform Resource Locator of an Internet resource, or a pointer to an item identifier list (PIDL).

Flags is a set of values that specify whether to add the resource to the history list, whether to read from or write to the cache, and whether to display the resource in a new window. It can be a sum of zero or more of the following:

Constant Value Meaning

navOpenInNewWindow 1 Open the resource or file in a new window.
navNoHistory 2 Do not add the resource or file to the history list. The new page replaces the current page in the list.
navNoReadFromCache 4 Do not read from the disk cache for this navigation.
navNoWriteToCache 8 Do not write the results of this navigation to the disk cache.
navAllowAutosearch 16 If the navigation fails, the Web browser attempts to navigate common root domains (.com, .edu, and so on). If this still fails, the URL is passed to a search engine.

TargetFrameName is the name of the frame in which the resource will be displayed, or NULL if the resource should not be displayed in a named frame.

PostData contains the data sent to the server when using Navigate to generate an HTTP POST message. If PostData is NULL, Navigate generates an HTTP GET message. PostData is ignored if URL does not specify an HTTP URL.

Headers contains any headers sent to the servers when the URL represents an HTTP URL. HTTP headers specify such things as the intended action required of the server, the type of data, and so on. (See TWebRequest object, whose properties represent many of the more common headers).

It dont quite look the same as in the help files.
 
It could be that you are changing your current directory in the software. When the program starts up, save GetCurrentDir() (it returns an AnsiString) to a variable. Next time you want to run the help file, attach the help file name to the end of this variable and try to open it.

Good luck,
Chris
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top