Using Windows Calls to Create Dialog Boxes in Word for Windows

Last reviewed: July 30, 1997
Article ID: Q80931
The information in this article applies to:
  • Microsoft Word for Windows, versions 1.0, 1.1, 1.1a, 2.0, 2.0a, 2.0a-CD, 2.0b, 2.0c, 6.0, 6.0a, 6.0c
  • Microsoft Word for Windows 95, version 7.0

SUMMARY

In Microsoft Word for Windows macros, you can use Microsoft Windows calls to create dialog boxes.

MORE INFORMATION

The following is a sample Word for Windows macro that uses Windows calls to display a sample dialog box:

Word 7.0

Declare Function GetFocus Lib "user32" Alias "GetFocus"() As Long
Declare Function MessageBox Lib "user32" Alias "MessageBoxA"(hWndParent \
As Long, lpText As String, lpCaption As String, wType As Long) As Long

Sub MAIN
hWndParent = GetFocus lpText$ = "Example Text" lpCaption$ = "Example Caption" wType = 0 result = MessageBox(hWndParent, lpText$, lpCaption$, wType)
End Sub

Word 6.0, 2.0

Declare Function GetFocus Lib "user"() As Integer
Declare Function MessageBox Lib "user"(hWndParent As Integer, lpText$, \
lpCaption$, wType As Integer) As Integer
Sub MAIN
hWndParent = GetFocus lpText$ = "Example Text" lpCaption$ = "Example Caption" wType = 0 result = MessageBox(hWndParent, lpText$, lpCaption$, wType)
End Sub

For more information on creating dialog boxes using the WordBasic macro language, query on the following in the Microsoft Knowledge Base:

   dialog and box and macro and editor

REFERENCES

"Microsoft Word for Windows and OS/2 Technical Reference" pages 149, 437-438

"Using WordBasic," by WexTech Systems and Microsoft, pages 173, 363-366

Kbcategory: kbusage kbmacro KBSubcategory:


Additional query words: winword2 6.0 6.0a 6.0c winword 7.0 word95
word7 word6 1.0 1.10 1.10a 2.0
Version : 1.x 2.x 6.0 6.0a 6.0c 7.0
Platform : WINDOWS


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: July 30, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.