Subject Re: Help File
From Mervyn Bick <invalid@invalid.invalid>
Date Sun, 28 Jul 2024 11:47:19 +0200
Newsgroups dbase.getting-started
Attachment(s) run_chm.wfmrun_chm.mnu

On 2024/07/27 15:32, Charlie wrote:
> Is there a way of eliminating the cmd screen when running?  I have used:
>
> cmd help.chm
> cmd(false,"help.chm")
> Function doesn't work when true?
>
> Function key F1 works without the cmd screen.
>
> Is there an ascii number you can use for the F1 key?  I have tried several like this..
>
> keyboard chr(xxx)   but none worked.
>
> Thanks for any help.

I assume that you have created help.chm for your program and it's this
file you want to display.

One way to display a .chm file is to use ShellExecuteA() from
Shell32.dll in the Win32 API.  As this is the function behind openURL()
in miscapi.prg in the duFLP, all the heavy lifting has already been
done.  :-)

A little example form is attached.  I've used the BDE API help file as
it happen to be available.  Replace this with your own .chm file.

The menu is "quick and dirty" as I've left the default values (which are
completely meaningless) for the various objects.  The shortcut for the
help file has been set to F1.

Mervyn.







** END HEADER -- do not remove this line
//
// Generated on 2024-07-28
//
parameter bModal
local f
f = new run_chmForm()
if (bModal)
   f.mdi = false // ensure not MDI
   f.readModal()
else
   f.open()
endif

class run_chmForm of FORM
   with (this)
      onOpen = class::FORM_ONOPEN
      onClose = class::FORM_ONCLOSE
      height = 16.0
      left = 31.4286
      top = 2.2727
      width = 40.0
      text = ""
      mdi = false
      menuFile = "run_chm.mnu"
   endwith

   this.PUSHBUTTON1 = new PUSHBUTTON(this)
   with (this.PUSHBUTTON1)
      onClick = class::PUSHBUTTON1_ONCLICK
      height = 1.0909
      left = 11.2857
      top = 6.8182
      width = 15.2857
      text = "Show Help File"
   endwith


   function PUSHBUTTON1_onClick()
     class::show_chm()
      return

   function show_chm
      openUrl("C:\Program Files (x86)\Common Files\Borland\BDE\bde32.hlp")
      return

   function form_onClose()
      close procedure :duflp:miscapi.prg
      return

   function form_onOpen()
      set procedure to :duflp:miscapi.prg
      return

endclass



** END HEADER -- do not remove this line
//
// Generated on 2024-07-28
//
parameter formObj
new RUN_CHMMENU(formObj, "root")

class RUN_CHMMENU(formObj, name) of MENUBAR(formObj, name)
   this.MENU26 = new MENU(this)
   with (this.MENU26)
      text = "File"
   endwith

   this.MENU26.MENU27 = new MENU(this.MENU26)
   with (this.MENU26.MENU27)
      onClick = class::MENU27_ONCLICK
      text = "Close"
   endwith

   this.MENU34 = new MENU(this)
   with (this.MENU34)
      text = "Help"
   endwith

   this.MENU34.MENU35 = new MENU(this.MENU34)
   with (this.MENU34.MENU35)
      onClick = class::MENU35_ONCLICK
      text = "Show Help File"
      shortCut = "F1"
   endwith


   function MENU27_onClick()
      form.close()
      return

   function MENU35_onClick()
      form.show_chm()
      return

endclass