home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Windows Shareware GOLD
/
NuclearComputingVol3No1.cdr
/
other
/
f1238
/
fndapp.mcr
< prev
next >
Wrap
Text File
|
1991-04-20
|
3KB
|
65 lines
================================start of document==========================
Use WordBASIC macros to call external programs by snagging Windows
library routines through the Declare statement.
Enter the following macro, call it, say, "ExtPROGMAN":
===========================================================================
Declare Function FindWindow(foo As Long, name$) As Integer Lib "USER"
Declare Sub SetActiveWindow(hwnd As Integer) Lib "USER"
Declare Sub SendMessage(hwnd As Integer, msg As Integer, wp As Integer, \
lp As Long) Lib "user"
Sub MAIN
hwnd = FindWindow(0, "Program Manager")
If hwnd <> 0 Then
SetActiveWindow(hwnd)
SendMessage(hwnd, 274, - 4048, 0)
Else
Shell "PROGMAN"
End If
End Sub
===========================================================================
Now use File-Save All to save your macro.
Now enter the following macro to run one-time only without saving
(unless you want to keep it for future reference. Running it again will
result in an error).
---------------------------------------------------------------------------
Sub MAIN
'Assigns the named macro to Shift+F2
MacroAssignToKey "ExtPROGMAN", .Keycode=625, .Assign
End Sub
---------------------------------------------------------------------------
What you will have is a macro that will search all open apps for the
app title bar you have in the 'hwnd =' line, and if it doesn't find it,
it *starts* it! Then to top it off, you can assign it to a Shift+F2 (a
key assignment you can't get to from the Macro Assign to Key dialog; but
you can bypass the dialog with a WordBASIC macro).
It's handy to name this series of macros "Ext" plus the prefix name of
your application (sans .EXE). You could have ExtWINFILE, ExtMSDOS,
ExtEXCEL, ExtPOWERPNT, all sorts of programs could be called directly by
a single keystroke from inside of Winword.
The codes for Shift+F2 through Shift+F16 are 625-639 for .Keycode. These
assignments will appear on the menu item if you assign ExtPROGMAN to, say,
the Utilities menu.
Note that you can't override either the F1 key or the Shift+F1 combination;
they are reserved for Help and Context-Sensitive Help respectively. They are
specifically hard wired out of reach of WordBASIC and can't be overridden
because they are so fundamental to the interface of Microsoft Windows
applications.
If you have any questions, you can easyplex me at 75140,427.
===============================end of document===============================