|
-
Nov 20th, 2004, 07:31 PM
#1
Thread Starter
New Member
Need help opening CHM file
Please bare with me, I am very new to VB. I have a help file named help.chm and this is in the same directory as all of my VB project files. On my main form, I have a command button named cmdHelp that when clicked, I would like it to open the help.chm file. Could someone please let me know what code I need to place in the click event? All help is greatly appreciated!!!
Bryan
-
Nov 20th, 2004, 07:35 PM
#2
Hyperactive Member
Well if you want it to open in something like notepad you can do something like this:
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 cmdHelp_Click()
ShellExecute 0&, vbNullString, "notepad", "C:\Location\Of\File\help.chm", vbNullString, vbNormalFocus
End Sub
If my post was helpful please rate it 
-
Nov 20th, 2004, 07:48 PM
#3
Thread Starter
New Member
I would prefer it not to open in notepad. Id just like it to launch the help file I compiled. Any other ideas?
Bryan
-
Nov 20th, 2004, 08:21 PM
#4
Hyperactive Member
Code:
Private Sub Form_Load()
App.HelpFile = App.Path & "\help.chm"
End Sub
If my post was helpful please rate it 
-
Nov 20th, 2004, 08:22 PM
#5
Thread Starter
New Member
Thanks! That's just what I needed!
Bryan
-
Nov 21st, 2004, 12:28 PM
#6
Software Eng.
Originally posted by boroarke
I would prefer it not to open in notepad. Id just like it to launch the help file I compiled. Any other ideas?
Bryan
You can still use ShellExecute to open it.
Code:
ShellExecute 0&, "open", "file.chm", vbNullString, vbNullString, vbNormalFocus
-
Nov 21st, 2004, 12:32 PM
#7
Thread Starter
New Member
Please excuss my lack of skill, I am brand new. How would I initiate ShellExecute 0&, "open", "file.chm", vbNullString, vbNullString, vbNormalFocus from the click command of my command button? Could someone explain where I place that code and how I get my cmdHelp button to open it?
Thanks a lot!!
Bryan
-
Nov 21st, 2004, 12:37 PM
#8
Software Eng.
Place the code I gave you in a button, that's it.
Make sure you have the following line in the "General" (top) part of your Form.
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
-
Nov 21st, 2004, 12:40 PM
#9
Thread Starter
New Member
okay, once I have that in the top part of the form, how do I call it using my cmdHelp button?
Thanks,
Bryan
-
Nov 21st, 2004, 12:44 PM
#10
Software Eng.
Put the code I gave you in your cmdHelp_Click() event
Code:
ShellExecute 0&, "open", "file.chm", vbNullString, vbNullString, vbNormalFocus
Replace file.chm with the full path of your chm file
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|