Microsoft Office Tutorials and References
In Depth Information
Windows API Calls
If numMonitors > 1 Then
Msg = numMonitors & “ display monitors” & vbCrLf
Msg = Msg & “Virtual screen: “ & virtWidth & “ X “
Msg = Msg & virtHeight & vbCrLf & vbCrLf
Msg = Msg & “The video mode on the primary display is: “
Msg = Msg & vidWidth & “ X “ & vidHeight
Msg = Msg & “The video display mode: “
Msg = Msg & vidWidth & “ X “ & vidHeight
End If
MsgBox Msg
End Sub
Figure 11-22 shows the message box returned by this procedure when running on a dual-monitor
Figure 11-22: Using a Windows API call to determine the video display mode.
This example is available on the companion CD-ROM. The filename is video mode.
xlsm .
Adding sound to your applications
The example in this section adds some sound capability to Excel. Specifically, it enables your
application to play WAV or MIDI files. For example, you might like to play a short sound clip
when a dialog box is displayed. Or maybe not. In any case, if you want Excel to play WAV or MIDI
files, this section has what you need.
The examples in this section are available on the companion CD-ROM in a file named
sound.xlsm .
Playing a WAV file
The following example contains the API function declaration plus a simple procedure to play a
sound file called sound.wav , which is presumed to be in the same directory as the workbook:
Search JabSto ::

Custom Search