Jump to content

F1 key help


Recommended Posts

I have made a GUI program and made it display the help file when the help button is pressed or when F1 is pressed. The problem is, when you press F1 it opens the help file multiple times depending on how long you pressed it. Is there any way to fix this, and here is the code (I left out irrelevant parts)

$GUIWidth = 450
$GUIHeight = 320
$helpmenu = GuiCtrlCreateMenu ("Help")
$helptopics = GUICtrlCreateMenuitem ("Help Topics   F1",$helpmenu)
$dll = DllOpen("user32.dll")
While 1
$msg = GUIGetMsg()
Select
Case $msg = $Helptopics or _IsPressed("70", $dll)
        ShellExecute("help\help.chm","","","",@SW_MAXIMIZE)
EndSelect
WEnd
DllClose($dll)
There are 10 kinds of people, those who understand me and those who don't.
Link to comment
Share on other sites

Thanx man! But I have no Idea :)

Can you show me how to insert the function?

Try the examples in the helpfile, they are really easy if you look at them
Link to comment
Share on other sites

I have made a GUI program and made it display the help file when the help button is pressed or when F1 is pressed. The problem is, when you press F1 it opens the help file multiple times depending on how long you pressed it. Is there any way to fix this, and here is the code (I left out irrelevant parts)

$GUIWidth = 450
$GUIHeight = 320
$helpmenu = GuiCtrlCreateMenu ("Help")
$helptopics = GUICtrlCreateMenuitem ("Help Topics   F1",$helpmenu)
$dll = DllOpen("user32.dll")
While 1
$msg = GUIGetMsg()
Select
Case $msg = $Helptopics or _IsPressed("70", $dll)
        ShellExecute("help\help.chm","","","",@SW_MAXIMIZE)
EndSelect
WEnd
DllClose($dll)

If ProcessExists( "hh.exe" ) < 1 Then
    ShellExecute ...
EndIf
Link to comment
Share on other sites

  • Moderators

akfourtyseven,

Use the builtin Autoit function GUISetHelp - this is what it was designed for!

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • 9 years later...
On 21/02/2009 at 10:41 AM, Melba23 said:

akfourtyseven,

 

Use the builtin Autoit function GUISetHelp - this is what it was designed for!

 

M23

Melba23,
I'm trying to address a context sensitive help. I already found a piece of code on forum that I adapted to my needs but still struggling with call the right CHM index if focus is on an input field or other control.

Here is the function I'm using (it's a quick'n'dirty prototype):
 

; ----------------------------------------
; Calls HTML help file (.CHM), given:
; help file name (only) - defaults to @ScriptName with chm extension
; Help file path (only) - defaults to @ScriptDir
; Opens help file at the givem section if both exist.
; Example: _NavigateCHM("/html/hs41.htm")
; ----------------------------------------
Func _NavCHM($sSection, $sFilePath = @ScriptDir, $sFileName = StringTrimRight(@ScriptName, 3) & "chm")
    
    Local $hWnd = WinWait('[TITLE:' & $sTitle & ' - complementary HTML Help title; CLASS:HH Parent]', "", 5)
    If StringLeft($sSection, 6) <> "/html/" Then $sSection = "/html/" & $sSection
    If StringRight($sSection, 4) <> ".htm" Then $sSection &= ".htm"
    If IsHWnd($hWnd) Then
        ; Help already open
        WinActivate($hWnd)
        Local $oIE = _IEAttach($sTitle & ' - complementary HTML Help title', 'Embedded')
        _IENavigate($oIE, 'mk:@MSITStore:' & $sFilePath & '\' & $sFileName & '::' & $sSection)
    Else
        Run('"' & @WindowsDir & '\' & 'hh.exe" "' & $sFilePath & '\' & $sFileName & '::' & $sSection & '"')
    EndIf
EndFunc   ;==>_NavCHM

As said already, I found this code here but forgot the author(s). I just want to acknowledge their job and I'm grateful they shared their solution.

Back to GUISetHelp(), could it be used with any GUI handle or just that from GUICreate()? Or maybe I should look into HotKeySet() to call _NavCHM with the proper CHM section reference. TIA for any hints.

 

Best,
Euler

Link to comment
Share on other sites

  • Moderators

@Euler G. did you happen to notice this thread is over 9 years old?? Please don't resurrect old threads.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

  • Moderators

Typically, it is better to start your own thread rather than commandeer someone else's yes. And we try to avoid resurrecting very old threads as the language continues to grow and evolve. What may have worked 2 or 3 (or 9) years ago may not work the same today.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

@JLogan3o13 Thanks for your clarification and heads-up. I could start a new post and make a reference to this one (pointed to me by the search engine) but I thought it could be seen as a violation to forum rules. I'll try to be more careful. As Melba23, I'm also old. :)

Best,
Euler

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...