Using Windows Calls to Create Dialog Boxes in Word for Windows

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

Additional query words: winword2 6.0 winword 7.0 word95 word7 word6 1.0 1.10a 2.0

Keywords :
Version : WINDOWS:1.0,1.1,1.1a,2.0,2.0a,2.0a-CD,2.0b,2.0c,6.0,6.0a,6.0c,7.0
Platform : WINDOWS
Issue type :


Last Reviewed: December 23, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.