Results 1 to 5 of 5

Thread: OS_ShellExecute "document.chm" - how to close it?

  1. #1
    thinBasic MVPs
    Join Date
    Oct 2012
    Location
    Germany
    Age
    54
    Posts
    1,529
    Rep Power
    170

    OS_ShellExecute "document.chm" - how to close it?

    It seems impossible to shell a help-file-document using OS_Shell.
    If it were possible to shell in ASync-mode then i would have some process-ID.

    Just there is no way to check if the process with the given ID is still running since OS_ProcessIsRunning() awaits a process-name.

    It works to use this for example:
    Uses "OS"
    ' thinBasic-InstallPath has to be "C:\thinBasic\" for this
    
    OS_ShellExecute("open", "thinBasic.chm", "", "C:\thinBasic\Help", %SW_SHOWNORMAL )
    
    but this does not return any process-ID

    How can i determine now if this help-file is already|still open (so not to open another one) ?
    And how can i close it again when my script ends?
    I think there are missing some Forum-sections as beta-testing and support

  2. #2
    thinBasic MVPs
    Join Date
    Oct 2012
    Location
    Germany
    Age
    54
    Posts
    1,529
    Rep Power
    170
    Help!

    How can i shell *.chm-help-files - and close them again when my script ends?
    I think there are missing some Forum-sections as beta-testing and support

  3. #3
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,777
    Rep Power
    10
    Do not shell, use native Windows API

    The following is an abstract on ho I open help when you press F1 over a token.
    Identify the token then pass it to a function similar to the following example.

    The following example is a working thinBasic script using thinBasic.chm file as help and searching for "Dim" keyword.
    You help file must be created with correct topics/keywords in order to search.

    Ciao
    Eros

      Declare Function HtmlHelp Lib "hhctrl.ocx" Alias "HtmlHelpA" ( 
                        ByVal hwndCaller As DWord, 
                        pszFile As Asciiz, 
                        ByVal uCommand As DWord, 
                        ByVal dwData As DWord) As DWord
        
      Type HH_AKLINK
        cbStruct     As Long       ' sizeof this structure
        fReserved    As Long       ' must be FALSE (really!)
        pszKeywords  As Asciiz Ptr ' semi-colon separated keywords
        pszUrl       As Asciiz Ptr ' URL to jump to if no keywords found (may be NULL)
        pszMsgText   As Asciiz Ptr ' Message text to display in MessageBox if pszUrl is NULL and no keyword match
        pszMsgTitle  As Asciiz Ptr ' Message text to display in MessageBox if pszUrl is NULL and no keyword match
        pszWindow    As Asciiz Ptr ' Window to display URL in
        fIndexOnFail As Long       ' Displays index if keyword lookup fails.
      End Type
    
    
      %HH_KEYWORD_LOOKUP       = &H000D
    
    
      '------------------------------------------------------------------------------
      ' Open content sensitive help
      '------------------------------------------------------------------------------
      Function thinBasic_Help(ByVal hParent As Long, ByVal HelpKeyword As String) As Long
        Local link      As HH_AKLINK
        Local sWord     As String
        Local hHlpWnd   As DWord
        Local lCounter  As Long
      
    
    
        sWord =   Ucase$(Trim$(HelpKeyword)) + ";" + _
                  LCase$(Trim$(HelpKeyword)) + ";" + _
                  MCase$(Trim$(HelpKeyword))
    
    
        link.cbStruct     = SizeOf(HH_AKLINK)
        link.fReserved    = %FALSE
        link.pszKeywords  = StrPtr(sWord)
        link.fIndexOnFail = %FALSE            '---We will automatically do this
    
    
        '---thinBasic help file
        hHlpWnd = HtmlHelp(hParent, "c:\thinBasic\Help\thinBasic.chm" + $NUL, %HH_KEYWORD_LOOKUP, VarPtr(link))
        If hHlpWnd <> 0 Then
          'MsgBox 0, "Help found"
        End If
      
      End Function
    
    
    
    
    thinBasic_Help(0, "Dim")
    
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  4. #4
    thinBasic MVPs
    Join Date
    Oct 2012
    Location
    Germany
    Age
    54
    Posts
    1,529
    Rep Power
    170
    yeah- that's one step beyond already... this would be the function for [F1]-key.

    And can i just shell the file too - without to pass any keyword?-

    Edit, nevermid. fIndexOnFail = True does it
    Last edited by ReneMiner; 29-11-2015 at 13:12.
    I think there are missing some Forum-sections as beta-testing and support

  5. #5
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,777
    Rep Power
    10
    Yes exactly.

    I do not go into the index because on fail I need to loop though all user helps installed in thinBasic.
    Researched keyword maybe is a keyword of other help files.
    And only if I end without any keyword found ... I switch into thinBasic index.

    %HH_KEYWORD_LOOKUP command info can be found in Microsoft documentation here: https://msdn.microsoft.com/en-us/lib...(v=vs.85).aspx
    with all other possible commands regarding help.
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

Similar Threads

  1. Forum: added "Auto Youtube Link-Converter" plugin
    By ErosOlmi in forum Web and Forum
    Replies: 0
    Last Post: 07-05-2011, 12:47
  2. Replies: 17
    Last Post: 21-02-2010, 07:45
  3. Uses "File", "Crypto" ... ???
    By marcuslee in forum thinBasic General
    Replies: 3
    Last Post: 01-12-2009, 19:38

Members who have read this thread: 0

There are no members to list at the moment.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •