Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2010-03

helphtml example

8 messages · 5 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Andrea Mauri

I would like to add help to my application, I checked the wiki and the example in examples\helphtml (htmlhelp.lpi) but when I run it I got an error: Unable to find html browser.
Lazarus 0.9.29 r23882 FPC 2.4.0 i386-win32-win32/win64 Hints?
Andrea

Reply by email

Mattias Gaertner
to Andrea Mauri
I would like to add help to my application, I checked the wiki and the example in examples\helphtml (htmlhelp.lpi) but when I run it I got an error: Unable to find html browser.

It uses the function FindDefaultBrowser in unit lcl/lclintf.pas.

Lazarus 0.9.29 r23882 FPC 2.4.0 i386-win32-win32/win64 Hints?

The function is very short. Maybe you can find out, why it does not work on your system? Then we can improve it.

Mattias

Reply by email

Andrea Mauri
to Mattias Gaertner

Il 16/03/2010 20.38, Mattias Gaertner ha scritto:

It uses the function FindDefaultBrowser in unit lcl/lclintf.pas.

I checked FindDefaultBrowserFunction.
I have this problem on win32 (xp).

function FindDefaultBrowser(out ABrowser, AParams: String): Boolean;
   function Find(const ShortFilename: String; out ABrowser: String):
Boolean; inline;
   begin
     ABrowser := SearchFileInPath(ShortFilename + GetExeExt, '',
                       GetEnvironmentVariableUTF8('PATH'), PathSeparator,
                       [sffDontSearchInBasePath]);
     Result := ABrowser  '';
   end;
begin
   {$IFDEF MSWindows}
   Find('rundll32', ABrowser);               <-- this function does not
find the browser

The find function looks in PATH, on my pc I have rundll32.exe in windows\system32 but PATH environment variable does not include c:\windows\system32, so find function does not find rundll32

Reply by email

Mattias Gaertner
to Andrea Mauri
Show quoted text 26 lines
Il 16/03/2010 20.38, Mattias Gaertner ha scritto: > It uses the function FindDefaultBrowser in unit lcl/lclintf.pas. I checked FindDefaultBrowserFunction. I have this problem on win32 (xp). function FindDefaultBrowser(out ABrowser, AParams: String): Boolean; function Find(const ShortFilename: String; out ABrowser: String): Boolean; inline; begin ABrowser := SearchFileInPath(ShortFilename + GetExeExt, '', GetEnvironmentVariableUTF8('PATH'), PathSeparator, [sffDontSearchInBasePath]); Result := ABrowser ''; end; begin {$IFDEF MSWindows} Find('rundll32', ABrowser); <-- this function does not find the browser The find function looks in PATH, on my pc I have rundll32.exe in windows\system32 but PATH environment variable does not include c:\windows\system32, so find function does not find rundll32

Any windows user out there who knows how to find the right rundll on all windows platforms?

Mattias

Reply by email

Vincent Snijders
to Mattias Gaertner
Mattias Gaertner wrote 31 lines
On Thu, 18 Mar 2010 11:57:14 +0100 Andrea Mauri wrote: > Il 16/03/2010 20.38, Mattias Gaertner ha scritto: >> It uses the function FindDefaultBrowser in unit lcl/lclintf.pas. > I checked FindDefaultBrowserFunction. > I have this problem on win32 (xp). > > > function FindDefaultBrowser(out ABrowser, AParams: String): Boolean; > > function Find(const ShortFilename: String; out ABrowser: String): > Boolean; inline; > begin > ABrowser := SearchFileInPath(ShortFilename + GetExeExt, '', > GetEnvironmentVariableUTF8('PATH'), PathSeparator, > [sffDontSearchInBasePath]); > Result := ABrowser ''; > end; > > begin > {$IFDEF MSWindows} > Find('rundll32', ABrowser); <-- this function does not > find the browser > > The find function looks in PATH, on my pc I have rundll32.exe in > windows\system32 but PATH environment variable does not include > c:\windows\system32, so find function does not find rundll32 Any windows user out there who knows how to find the right rundll on all windows platforms?

I don't know, but we could try something like
AppendPathDelim(GetEnvironmentVariable('WinDir'))+'system32\rundll.exe' first.

Vincent

Reply by email

waldo kitty
to Mattias Gaertner: On Thu, 18 Mar 2010 11:57:14 +0100 Any windows user out there who knows how to find the…
Mattias Gaertner wrote 8 lines
On Thu, 18 Mar 2010 11:57:14 +0100 Andrea Mauri wrote: > The find function looks in PATH, on my pc I have rundll32.exe in > windows\system32 but PATH environment variable does not include > c:\windows\system32, so find function does not find rundll32 Any windows user out there who knows how to find the right rundll on all windows platforms?

on default installations i find the following...

win9x -> C:\windows\rundll32.exe
w2000 -> C:\WINNT\system32\rundll32.exe
vista -> C:\windows\system32\rundll32.exe
vista64 -> C:\windows\system32\rundll32.exe

i don't have winME, winXP or winCE available to check... i may also not have the capitalization correct...

i'd say to assume (yeah, i know) that it is in $OS_HOME or $OS_HOME\system32 and check to see if it is in there... once found, execute as normal... how to determine what $OS_HOME is is another matter but it, too, should be easy enough to determine... i'm thinking of non-standard installations where someone might have used a custom directory instead of the default for the install of the OS... i know that i've had to do registry work on w2k machines that required a secondary install to another directory so the registry hives on the broken installation could be edited and fixed...

HTH ;)

Reply by email

waldo kitty
to Vincent Snijders: I don't know, but we could try something like…
Vincent Snijders wrote 7 lines
Mattias Gaertner schreef: > Any windows user out there who knows how to find the right rundll on > all windows platforms? I don't know, but we could try something like AppendPathDelim(GetEnvironmentVariable('WinDir'))+'system32\rundll.exe' first.

that should work on NT based versions of windows... however, as i just wrote in another post, win9x installs have rundll32.exe in the "WinDir" so, a test is necessary...

maybe something like

{* winNT style rundll32 location test *}
if exist(AppendPathDelim(GetEnvironmentVariable('WinDir'))+'system32\rundll.exe')

   foo;

else
{* win9x style rundll32 location test *}
if exist(AppendPathDelim(GetEnvironmentVariable('WinDir'))+'rundll.exe')

   bar;

i placed the winNT one first because it is likely the most commonly executed on ;)

HTH

Reply by email

José Mejuto
to Mattias Gaertner: On Thu, 18 Mar 2010 11:57:14 +0100 Any windows user out there who knows how to find the…

Hello Lazarus-List,

you wrote
> The find function looks in PATH, on my pc I have rundll32.exe in > windows\system32 but PATH environment variable does not include > c:\windows\system32, so find function does not find rundll32

MG> Any windows user out there who knows how to find the right rundll on MG> all windows platforms?

GetSystemDirectory() API:

http://msdn.microsoft.com/en-us/library/ms724373%28VS.85%29.aspx

But to get the deafult browser the registry must be read as in this doc:

http://msdn.microsoft.com/en-us/library/dd203067%28VS.85%29.aspx

Browser is at:

HKEY_LOCAL_MACHINE\SOFTWARE\Clients\StartMenuInternet\XXXXXXX\shell\open\command

Where XXXXXXXX is the browser name. The one that appears when reading the key

HKEY_LOCAL_MACHINE\SOFTWARE\Clients\StartMenuInternet\

Usually "IEXPLORER.EXE" is the text that you should use instead XXXXXXXX.

This is the system wide default browser, but the user could override it in its local profile, so first look for user profile registry:

HKEY_CURRENT_USER\SOFTWARE\Clients\StartMenuInternet\

if it gives a name, replace it by XXXXXXXXXX, if not name reported or no key use the system wide defaults.

This does not garantees that trying to open an HTML file, in example, will open that browser, because one thing is the browser for internet shortcuts (ALA http://, ftp://) and other is the browser or program associated with HTML files. Usually they match, but not always.

Best regards, Jos?

Reply by email