Microsoft KB Archive/86268

{|
 * width="100%"|

HOWTO: Call the Windows Help Search Dialog Box from Application

 * }

Q86268

-

The information in this article applies to:


 * Microsoft Win32 Software Development Kit (SDK)
 * Microsoft Windows Software Development Kit (SDK) 3.1

-

SUMMARY
In the Microsoft Windows environment, an application can invoke the Search dialog box of the Windows Help application independent of the main help window. For example, many applications have an item like &quot;Search for Help on&quot; in their Help menus.

An application can invoke the Search dialog box via the WinHelp function by specifying HELP_PARTIALKEY as the value for the fuCommand parameter and by specifying a pointer to an empty string for the dwData parameter. The following code demonstrates how to call the Windows Help Search dialog box from an application:

  LPSTR lpszDummy, lpszHelpFile;

// Allocate memory for strings. lpszDummy = (LPTSTR)malloc(5); lpszHelpFile = (LPTSTR)malloc(MAX_PATH);

// Initialize an empty string. lstrcpy(lpszDummy,TEXT (&quot;&quot;));

// Initialize the help filename. lstrcpy(lpszHelpFile, TEXT(&quot;c:\\windows\\myhelp.hlp&quot;);

// Call WinHelp function. WinHelp(hWnd, lpszHelpFile, HELP_PARTIALKEY, (DWORD)lpszDummy);

By using the TEXT macro and the LPTSTR declaration for the pointer, both UNICODE and MBCS can be supported. The LPTSTR and TEXT macro resolve to the appropriate type based on the definition (or nondefinition) of the UNICODE precompile symbol. For example, if UNICODE is defined (#define UNICODE), the TEXT macro resolves to the L keyword for UNICODE strings constants and LPTSTR will resolve to wchar_t * (a pointer to a UNICODE string). Without the #define UNICODE statement, LPTSTR resolves to char * and the TEXT macro resolves to a common string.

Additional query words:

Keywords : kbWinHelp kbOSWinNT kbOSWin2000 kbSDKWin32 kbGrpDSUser kbOSWin

Issue type : kbhowto

Technology : kbWin32SDKSearch kbAudDeveloper kbWin3xSearch kbSDKSearch kbWin32sSearch kbWinSDKSearch kbWinSDK310