Page 118 - Open Soource Technologies 304.indd
P. 118
Event Driven Programming
Figure 5.1 Sending Keystrokes to Windows WordPad.
Here is an example showing how to use SendKeys(). Here, we give the Windows WordPad
program the focus with the Visual Basic AppActivate() function, passing it the title of that
program (which appears in its title bar), and send the string—Hello from Visual Basic! to that
program as follows:
AppActivate (“Document - WordPad”)
SendKeys (“Hello from Visual Basic!”)
The result appears in Figure 3.1_now we are able to send keystrokes to another program.
5.2.11 Handling Higher Math
Well, it may have been a mistake taking on that programming job from the astrophysics
department. How do you calculate a hyperbolic cosecant anyway? Can Visual Basic do it?
Yes, although not directly. The built-in Visual Basic math functions.
Visual
Basic Math
functions Calculates This
Function
ABs Absolute value
Atn Arc tangent
112 LOVELY PROFESSIONAL UNIVERSITY