Microsoft KB Archive/109826: Difference between revisions

From BetaArchive Wiki
(importing KB archive)
 
m (Text replacement - """ to """)
Line 50: Line 50:
This article describes how to call the Windows Help Search dialog box from within your Microsoft Access application using the WinHelp() and FindWindow() Windows API function calls.<br />
This article describes how to call the Windows Help Search dialog box from within your Microsoft Access application using the WinHelp() and FindWindow() Windows API function calls.<br />
<br />
<br />
This article assumes that you are familiar with Access Basic and with creating Microsoft Access applications using the programming tools provided with Microsoft Access. For more information on Access Basic, please refer to the &quot;Introduction to Programming&quot; manual in Microsoft Access version 1.x, or the &quot;Building Applications&quot; manual, Chapter 3, &quot;Introducing Access Basic,&quot; in version 2.0.
This article assumes that you are familiar with Access Basic and with creating Microsoft Access applications using the programming tools provided with Microsoft Access. For more information on Access Basic, please refer to the "Introduction to Programming" manual in Microsoft Access version 1.x, or the "Building Applications" manual, Chapter 3, "Introducing Access Basic," in version 2.0.


</div>
</div>
Line 66: Line 66:
<pre class="codesample">      Option Explicit
<pre class="codesample">      Option Explicit
       Global Const HELP_PARTIALKEY = &amp;H105
       Global Const HELP_PARTIALKEY = &amp;H105
       Declare Function WinHelp Lib &quot;User&quot; (ByVal hWnd As _
       Declare Function WinHelp Lib "User" (ByVal hWnd As _
         Integer, ByVal lpHelpFile As String, ByVal _
         Integer, ByVal lpHelpFile As String, ByVal _
         wCommand As Integer, ByVal dwData As Any) As Integer
         wCommand As Integer, ByVal dwData As Any) As Integer
       Declare Function HC_FindWindow% Lib &quot;user&quot; Alias &quot;FindWindow&quot; _
       Declare Function HC_FindWindow% Lib "user" Alias "FindWindow" _
         (ByVal lpClassName As Any, ByVal lpCaption As Any)
         (ByVal lpClassName As Any, ByVal lpCaption As Any)
                         </pre></li>
                         </pre></li>
Line 76: Line 76:
<pre class="codesample">      Function OpenHelpSearch ()
<pre class="codesample">      Function OpenHelpSearch ()
         Dim DummyVal$, Temp%
         Dim DummyVal$, Temp%
         DummyVal$ = &quot;&quot;
         DummyVal$ = ""
         Temp% = WinHelp(GetAccessHandle(),_
         Temp% = WinHelp(GetAccessHandle(),_
             &quot;c:\Access\msaccess.hlp&quot;, HELP_PARTIALKEY, DummyVal$)
             "c:\Access\msaccess.hlp", HELP_PARTIALKEY, DummyVal$)
         'For version 2.0, replace Temp% = etc with the following:
         'For version 2.0, replace Temp% = etc with the following:
         'Temp% = WinHelp(GetAccessHandle(),_
         'Temp% = WinHelp(GetAccessHandle(),_
         '  &quot;c:\Acc2\msacc20.hlp&quot;, HELP_PARTIALKEY, DummyVal$)
         '  "c:\Acc2\msacc20.hlp", HELP_PARTIALKEY, DummyVal$)
       End Function
       End Function


       Function GetAccessHandle ()
       Function GetAccessHandle ()
         GetAccessHandle = HC_FindWindow(&quot;Omain&quot;, 0&amp;)
         GetAccessHandle = HC_FindWindow("Omain", 0&amp;)
       End Function
       End Function
                         </pre></li>
                         </pre></li>
Line 101: Line 101:
== REFERENCES ==
== REFERENCES ==


&quot;Programming Windows: The Microsoft Guide to Writing Applications for Windows 3,&quot; Charles Petzold, Microsoft Press, 1990<br />
"Programming Windows: The Microsoft Guide to Writing Applications for Windows 3," Charles Petzold, Microsoft Press, 1990<br />
<br />
<br />
&quot;Programmer's Reference Library: Microsoft Windows 3.1 Guide to Programming Reference,&quot; Volumes 1-6, Microsoft Press, 1992
"Programmer's Reference Library: Microsoft Windows 3.1 Guide to Programming Reference," Volumes 1-6, Microsoft Press, 1992


</div>
</div>

Revision as of 10:41, 20 July 2020

Knowledge Base


ACC: How to Call the Windows Help Search Dialog Box

Article ID: 109826

Article Last Modified on 5/6/2003



APPLIES TO

  • Microsoft Access 1.0 Standard Edition
  • Microsoft Access 1.1 Standard Edition
  • Microsoft Access 2.0 Standard Edition



This article was previously published under Q109826

SUMMARY

Advanced: Requires expert coding, interoperability, and multiuser skills.

This article describes how to call the Windows Help Search dialog box from within your Microsoft Access application using the WinHelp() and FindWindow() Windows API function calls.

This article assumes that you are familiar with Access Basic and with creating Microsoft Access applications using the programming tools provided with Microsoft Access. For more information on Access Basic, please refer to the "Introduction to Programming" manual in Microsoft Access version 1.x, or the "Building Applications" manual, Chapter 3, "Introducing Access Basic," in version 2.0.

MORE INFORMATION

The following example demonstrates how to activate the Search dialog box with a sample Access Basic function called OpenHelpSearch(). This example uses the Microsoft Access Help file:

NOTE: In the following sample code, an underscore (_) is used as a line- continuation character. Remove the underscore from the end of the line when re-creating this code in Access Basic.

  1. Enter the following lines in a new module's Declarations section:

          Option Explicit
          Global Const HELP_PARTIALKEY = &H105
          Declare Function WinHelp Lib "User" (ByVal hWnd As _
             Integer, ByVal lpHelpFile As String, ByVal _
             wCommand As Integer, ByVal dwData As Any) As Integer
          Declare Function HC_FindWindow% Lib "user" Alias "FindWindow" _
             (ByVal lpClassName As Any, ByVal lpCaption As Any)
                            
  2. Create two procedures by entering the following code in the module:

           Function OpenHelpSearch ()
             Dim DummyVal$, Temp%
             DummyVal$ = ""
             Temp% = WinHelp(GetAccessHandle(),_
                "c:\Access\msaccess.hlp", HELP_PARTIALKEY, DummyVal$)
             'For version 2.0, replace Temp% = etc with the following:
             'Temp% = WinHelp(GetAccessHandle(),_
             '   "c:\Acc2\msacc20.hlp", HELP_PARTIALKEY, DummyVal$)
          End Function
    
          Function GetAccessHandle ()
             GetAccessHandle = HC_FindWindow("Omain", 0&)
          End Function
                            
  3. Save the module as Search Help.
  4. From the Run menu, choose Compile All.
  5. Type the following in the module's Immediate window, and then press ENTER:

     ? OpenHelpSearch()

When you call the OpenHelpSearch() function, the Windows API WinHelp() function is called. The OpenHelpSearch() function passes the current Microsoft Access handle, the name of the Help file, the command HELP_PARTIALKEY and a null string to the WinHelp() function. You are then prompted for a topic to search for. Note that you can call the OpenHelpSearch() function from any command button.

REFERENCES

"Programming Windows: The Microsoft Guide to Writing Applications for Windows 3," Charles Petzold, Microsoft Press, 1990

"Programmer's Reference Library: Microsoft Windows 3.1 Guide to Programming Reference," Volumes 1-6, Microsoft Press, 1992

Keywords: kbhowto kbprogramming KB109826