Results 1 to 6 of 6

Thread: mnuHelp

  1. #1

    Thread Starter
    Fanatic Member joltremari's Avatar
    Join Date
    Sep 2000
    Location
    Mississippi
    Posts
    674
    I have a Help and Instuctions file created in Notepad for my app. How do I make it accessible from my mnuHelp_Click() event? When I distribute my app how do I make the notepad file go with it?

    Thanks for any help with this!

    JO

  2. #2
    Fanatic Member Dim's Avatar
    Join Date
    Jul 2000
    Posts
    620
    You can have the helpfile ShellExecuted.
    Code:
    Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
    
    Private Sub mnuHelp_Click()
       ShellExecute(app.path "\help.txt")
    End Sub
    And to distribute it you can simply package it with P&DW that is shipped with VB. Simply look through the start menu for it. When packaging it will ask if you would like to add any files...you can select the help file then.


    Gl,
    D!m
    Dim

  3. #3
    Guest
    You could set the Shortcut in the Menu Editor for F1 and put this code in it:

    Code:
    Private Sub mnuHelp_Click()
    Shell "Notepad.exe " & App.Path & "\myhelpfile.txt", vbNormalFocus
    End Sub
    You can also set your Form's KeyPreview property to True and add this:

    Code:
    Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
    Select Case KeyCode
        Case vbKeyF1 'F1 pressed
        Shell "Notepad.exe " & App.Path & "\myhelpfile.txt", vbNormalFocus
        'Loads your txt file with notepad
        'txt file is located in your exe's directory
    End Select
    End Sub
    Both will work.

  4. #4

    Thread Starter
    Fanatic Member joltremari's Avatar
    Join Date
    Sep 2000
    Location
    Mississippi
    Posts
    674
    They all work, Thanks to both of you.

    But what if I don't know the directory the user will choose?

  5. #5
    Guest
    Assuming your help file will be in the exe's directory, you can use App.Path to determine the exe's directory.

    Put this in a form and see for yourself:

    Code:
    Private Sub Form_Load()
    Msgbox App.Path
    End Sub
    You should know where the help file will be placed.

  6. #6

    Thread Starter
    Fanatic Member joltremari's Avatar
    Join Date
    Sep 2000
    Location
    Mississippi
    Posts
    674
    Forgot to say thanks!!!!

    I got it going!

    JO

Posting Permissions

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



Click Here to Expand Forum to Full Width