Using Snagit/32 As A DDE Server
Using Snagit/32 As A DDE Server
SnagIt/32 is a fully functional Windows Dynamic Data Exchange (DDE) server. You can use
SnagIt/32's DDE support to incorporate SnagIt/32 functionality into custom or commercial
Windows programs that support DDE. For example, you could write a Microsoft Excel macro to
print a portion of the screen using SnagIt/32.
Note: Because it creates the connection, the DDE_INITIATE command must be the first
command issued. To release system resources when the channel is no longer required, issue
a DDE_TERMINATE.
1
[DDE_EXECUTE command] set("parameter_value")
With the DDE_EXECUTE set command, the parameter_value may be any one of the
following:
2
0x01 CTRL key
0x02 ALT key
0x04 SHIFT key
0x08 function key, F1-F12
Low byte specifies the key pressed:
0x41-0x5 hotkey’s ASCII value
0x01-0x0c function key F1-F12,
if 0x08 bit is set in high byte
inalert n Enables (n=1) or disables (n=0) the Input Alert.
input client Set the Input parameter to Window Client Area.
input clipboard Set the Input parameter to Clipboard.
input dosscrn Set the Input parameter to Full Screen DOS, i.e.; set Input to
Clipboard and enable the Clipboard Chain option. Note: This
change is only valid for the current user interface settings.
input file Set the Input parameter to graphic file.
input last Set the Input parameter to Last Active Window.
input region Set the Input parameter to Region.
input screen Set the Input parameter to Screen.
input window Set the Input parameter to Entire Window.
Mailsubject text Set the Mail Output subject to "text".
mailtext text Include "text" in the message body for Mail Output.
mailname name Set the Mail Output recipient name. If the "mailaddress" parameter
is not set, "name" must be a valid Mail phonebook name. If the
"mailaddress" parameter is set, "name" may contain the display
name for the mail recipient.
Mailaddress address Set a provider specific Mail Output recipient address. This
parameter is optional if "mailname" specifies a valid Mail
phonebook name.
mode image Set the capture mode to image capture
mode text Set the capture mode to text capture
mode video Set the capture mode to video capture
options nnnn Set options. The nnnn byte specifies the following Options:
0x01 captures mouse cursor
0x02 turns on Automatic File Naming
0x10 turns on Auto Scroll
0x20 turns on Dithered Color Reduction
options scale,nn Set the scale value for non-printer output, where nn is a real
number scale multiplier (e.g., 0.73 or 1.28) applied to the image.
The value of nn must be greater than 0.
outalert n Enables (n=1) or disables (n=0) the Output Alert.
output bmp Set the Output parameter to BMP File.
output cbmp Set the Output parameter to Compressed BMP File.
output clipboard Set the Output parameter to Clipboard.
output file Set the Output parameter to BMP File.
output gif Set the Output parameter to GIF File.
output jpeg[,nn] Set the Output parameter to JPEG File, where n is the desired
image quality from 1-100%. If n is not specified, the current JPEG
image quality is used.
output mail [,DEF] Set the Output parameter to Send Mail. The current file output
configuration is used for the type of attached mail file. If the “DEF”
parameter is included and the mail recipient name or address is
specified by the "mailname" and/or "mailaddress"
parameters, the user will not be prompted for information
3
before the mail message is sent. Otherwise the user will
always be prompted for the mailname and mailaddress
information.
output pcx Set the Output parameter to PCX File.
output printer Set the Output parameter to Printer.
output tiff Set the Output parameter to TIFF Mono File.
preview [1/0] A value of 1 enables the Preview Window mode. A value of 0
disables it.
profile active Use the active SnagIt/32 configuration profile for this DDE session.
This is the same configuration profile used by the SnagIt/32 menus.
This is the profile used for a DDE session if the "profile" parameter
is not used.
profile default Use the SnagIt/32 default configuration profile for this DDE session.
Changes only effect this DDE session and do not effect the active
SnagIt/32 configuration. The "snagkey", "hidekey", and "chain"
parameters are disabled for this profile setting.
profile saved Use the SnagIt/32 configuration profile saved in the system registry
for this DDE session. Configuration changes only effect this DDE
session and do not affect the active SnagIt/32 configuration. The
“snagkey", "hidekey", and "chain" parameters are disabled for this
profile setting.
repeatkey nnnn Set the repeat capture activation hotkey combination to nnnn. The
high byte specifies Control keys:
0x01 CTRL key
0x02 ALT key
0x04 SHIFT key
0x08 function key, F1-F12
Low byte specifies the key pressed:
0x00 if 0x10 bit is set in high byte
0x41-0x5 specifies hotkey’s ASCII value
0x01-0x0c specifies function key F1-F12,
if 0x08 bit is set in high byte
scale auto Set the Printer Scale option to Auto Scale.
scale max Set the Printer Scale option to maximize the image on the printed
page.
scale n Set the Printer Scale value to n, where n is a percentage of the
Proportional scale size (e.g., 50, 200 (50% - half size, 200% -
double size)). The value of n must be greater than or equal to 1.
scale page Set the Printer Scale option to Fit on Page.
scale pro Set the Printer Scale option to Proportional scale.
Snagdir Set the File Output Directory parameter to a valid path.
snagkey nnnn Set activation hotkey combination to nnnn. The high byte specifies
Control keys:
0x01 CTRL key
0x02 ALT key
0x04 SHIFT key
0x08 function key, F1-F12
0x10 PRINT SCREEN key
Low byte specifies the key pressed:
0x00 if 0x10 bit is set in high byte
0x41-0x5 specifies hotkey’s ASCII value
0x01-0x0c specifies function key F1-F12,
if 0x08 bit is set in high byte
snag(repeat) Repeats a capture of the last Snagit/32 Input Area.
timer [ON/OFF] Enables or disables timer-activated captures.
4
window hide Hides the SnagIt/32 window or icon.
window show Displays the SnagIt/32 window or icon.
Examples:
Use DDE_EXECUTE to set the input parameter to clipboard:
[DDE_EXECUTE command] set("input clipboard")
Use DDE_EXECUTE to set the format parameter to Monochrome and the intensity threshold to
85 percent:
[DDE_EXECUTE command] set("format mono,85")
Use DDE_EXECUTE to use the application default configuration profile to obtain a known
configuration and not effect the active application configuration:
[DDE_EXECUTE command] set("profile default")
Use DDE_EXECUTE to send SnagIt/32 output as a compressed BMP file mail attachment:
[DDE_EXECUTE command] set("output cbmp")
Use DDE_EXECUTE to send SnagIt/32 output as a mail attachment with the specified Subject
and Text. The user will be prompted for the mail destination.
[DDE_EXECUTE command] set("output mail")
Use DDE_EXECUTE to send SnagIt/32 output as a mail attachment with the specified Subject to
the specified recipient. The user will not be prompted for any information.
[DDE_EXECUTE command] set("output mail")
With the DDE_POKE command, the parameter and value strings may be one of the following
combinations:
5
blue, and green_nnn for green.
Separate the RGB additive values by commas, with no spaces
before or after the commas.
Obsolete command in version 4.2
Aspect On Maintain image aspect ratio when printing.
Off Do not maintain image aspect ratio when printing.
Autoname Ccccc Set the Filename parameters.
Boost red_nnn, Enable SnagIt/32's Color Boost option (equivalent to selecting
blue_nnn, the "Use Color Boost" checkbox on the Color Boost dialog), and
green_nnn set the RGB color saturation multipliers (the three slider bars on
the Color Boost dialog) to red_nnn for red, blue_nnn for blue,
and green_nnn for green.
Separate the RGB multiplier values by commas, with no spaces
before or after the commas.
Obsolete command in version 4.2
Off Disable SnagIt/32's Color Boost option (equivalent to de-
selecting the "Use Color Boost" checkbox on the Color Boost
dialog).
Obsolete command in version 4.2
Chain Toggle the Clipboard Chain parameter.
Colorsub [Or,Og,Ob, Set the Color Substitution parameters where ;
Sr,Sg,Sb,A] Or,Og,Ob = original color's RGB components
Sr,Sg,Sb = substitute color’s RGB components.
A = color accuracy value
Values should be delimited by commas with no spaces,
e.g.; set(colorsub 10,150,210,100,150,50,75)
Note: This option is not available in the "esnag" DDE command.
Dstmp ON Enables datetime stamp on output image.
OFF Disables datetime stamp on output image
Format color[,n] Set the Format parameter to Color. Set Color Reduction to n
colors, where n is the bit depth 0-8,16,24,32 are valid values (0
specifies no color reduction).
Gray Set the Format parameter to Grayscale.
mono[,n] Set the Format parameter to Monochrome, and the Monochrome
intensity threshold to the value specified as n.
The "mono," portion of the string cannot contain spaces. If you
do not specify a numeric value, SnagIt/32 will use the current
intensity threshold value as the default.
Frequency [nn,mm] Set the timer-activated capture clock frequency. nn = time
value, mm=interval type where [HR/MIN/SEC] are the
valid parameters. (e.g. "FREQUENCY 10,SEC" )
Hidekey Nnnn Set hide/unhide hotkey combination to nnnn. The high byte
specifies Control keys:
0x01 CTRL key
0x02 ALT key
0x04 SHIFT key
0x08 function key, F1-F12
Low byte specifies the key pressed:
0x41-0x5 hotkey’s ASCII value
0x01-0x0c function key F1-F12,
if 0x08 bit is set in high byte
Inalert N Enables (n=1) or disables (n=0) the Input Alert.
Input Client Set the Input parameter to Window Client Area.
6
Clipboard Set the Input parameter to Clipboard.
dosscrn Set the Input parameter to Full Screen DOS, i.e.; set Input to
Clipboard and enable the Clipboard Chain option. Note: This
change is only valid for the current user interface settings.
file Set the Input parameter to graphic File.
last Set the Input parameter to Last Active Window.
region Set the Input parameter to Region.
screen Set the Input parameter to Screen.
window Set the Input parameter to Entire Window.
Mailsubject text Set the Mail Output subject to "text".
Mailtext text Include "text" in the message body for Mail Output.
Mailname name Set the Mail Output recipient name. If the "mailaddress"
parameter is not set, "name" must be a valid Mail phonebook
name. If the "mailaddress" parameter is set, "name" may
contain the display name for the mail recipient.
mailaddress address Set a provider specific Mail Output recipient address. This
parameter is optional if "mailname" specifies a valid Mail
phonebook name.
mode image Set the capture mode to image capture
text Set the capture mode to text capture
video Set the capture mode to video capture
options nnnn Set options. The nnnn byte specifies the following Options:
0x01 captures mouse cursor
0x02 turns on Automatic File Naming
0x10 turns on Auto Scroll
0x20 turns on Dithered Color Reduction
scale,nn Set the scale value for non-printer output, where n is a real
number scale multiplier (e.g., 0.73 or 1.28) applied to the image.
The value of n must be greater than 0.
outalert n Enables (n=1) or disables (n=0) the Output Alert.
output bmp Set the Output parameter to BMP File.
cbmp Set the Output parameter to compressed BMP File.
clipboard Set the Output parameter to Clipboard.
file Set the Output parameter to BMP File.
gif Set the Output parameter to GIF File.
jpeg[,nn] Set the Output parameter to JPEG File, where n is the desired
image quality from 1-100%. If n is not specified, the current
JPEG image quality is used.
Mail [,DEF] Set the Output parameter to Send Mail. The current file output
configuration is used for the type of attached mail file. If the
“DEF” parameter is included and the mail recipient name or
address is specified by the "mailname" and/or
"mailaddress" parameters, the user will not be prompted
for information before the mail message is sent. Otherwise
the user will always be prompted for the “mailname” and
“mailaddress” information.
pcx Set the Output parameter to PCX File.
png Set the Output parameter to PNG File.
printer Set the Output parameter to Printer.
tiff Set the Output parameter to TIFF Mono File.
preview 1 Enable the Preview Window mode.
7
0 Disable the Preview Window mode.
profile active Use the active SnagIt/32 configuration profile for this DDE
session. This is the same configuration profile used by the
SnagIt/32 menus. This is the profile used for a DDE session if
the "profile" parameter is not used.
default Use the SnagIt/32 default configuration profile for this DDE
session. Changes only effect this DDE session and do not effect
the active SnagIt/32 configuration. The "snagkey", "hidekey", and
"chain" parameters are disabled for this profile setting.
saved Use the SnagIt/32 configuration profile saved in the system
registry for this DDE session. Configuration changes only effect
this DDE session and do not effect the active SnagIt/32
configuration. The "snagkey", "hidekey", and "chain" parameters
are disabled for this profile setting.
repeatkey nnnn Set repeat capture activation hotkey combination to nnnn. The
high byte specifies Control keys:
0x01 CTRL key
0x02 ALT key
0x04 SHIFT key
0x08 function key, F1-F12
Low byte specifies the key pressed:
0x00 if 0x10 bit is set in high byte
0x41-0x5 hotkey’s ASCII value
0x01-0x0c function key F1-F12,
if 0x08 bit is set in high byte
scale auto Set the Printer Scaling to Auto Scale.
max Set the Printer Scale to Maximize Image on a Single Page.
n Set the Printer Scale value to n, where n is a percentage of the
Proportional scale size (e.g., 50, 200 (50% - half size, 200% -
double size)). The value of n must be greater than or equal to 1.
page Set the Printer Scale option to Fit on Page.
pro Set the Printer Scale option to Proportional scale.
snagdir ddddd Set File Output Directory parameter.
snagkey Nnnn Set activation hotkey combination to nnnn. The high byte
specifies Control keys:
0x01 CTRL key
0x02 ALT key
0x04 SHIFT key
0x08 function key, F1-F12
0x10 PRINT SCREEN key
Low byte specifies the key pressed:
0x00 if 0x10 bit is set in high byte
0x41-0x5 hotkey’s ASCII value
0x01-0x0c function key F1-F12,
if 0x08 bit is set in high byte
timer ON Enables timer-activated capture mode
OFF Disables timer-activated capture mode
window Hide Hides the SnagIt/32 window or icon.
Show Displays the SnagIt/32 window or icon.
Examples:
Use DDE_POKE to set the input parameter to clipboard:
[DDE_POKE command] "input", "clipboard"
Use DDE_POKE to set the format parameter to Monochrome and the intensity threshold to 85
8
percent:
[DDE_POKE command] "format", "mono,85"
Use DDE_POKE to use the saved application configuration profile to obtain user tailored settings
and not effect the active application configuration:
[DDE_POKE command] set("profile saved")
Use DDE_POKE to send SnagIt/32 output as a mail attachment with the specified Subject and to
a provider specific mail address.
[DDE_POKE command] set("output mail")
Invoking SnagIt/32
SnagIt/32's capture process is invoked with the DDE_EXECUTE snag command.
The general syntax of the DDE_EXECUTE snag command is:
[DDE_EXECUTE command] snag([input_parameter])
With the DDE_EXECUTE snag command, you can specify an input parameter value. If you do,
this input parameter will override SnagIt/32's current input setting. Note that some of the input
parameters available at capture time are not available as pre-set options, either via the
SnagIt/32 menus or with DDE commands.
The input_parameter used with the DDE_EXECUTE snag command may be any one of the
following:
9
(Note that the x,y screen coordinate 0,0 is the point in the
upper left corner of the screen, and that the x coordinate
represents the point on the horizontal axis, and the y
coordinate represents the point on the vertical axis. The value
of the x,y screen coordinate in the bottom right corner of the
screen depends on your screen resolution.)
Client x_nnn y_nnn Capture the Window Client Area containing the point at the x
and y coordinates, specified as x_nnn and y_nnn.
Handle [window_ handle] Capture the Entire Window of the window specified by
window_handle(Windows establishes the window_handle. It is
ascertained by a source other than SnagIt/32.)
Client handle [window_ handle] Capture the Window Client Area of the window specified by
window_handle.
x1_nnn y1_nnn x2_nnn y2_nnn Capture the rectangular area bounded by the first set of xy
coordinates (specified as x1_nnn and y1_nnn) and the second
set of xy coordinates (specified as x2_nnn and y2_nnn). The
result is the same as capturing a Region with SnagIt/32.
Repeat Repeat the last capture using the same parameters.
Killtimer If SnagIt/32 is in timer mode, this will terminated timer-
activated captures.
Exit Terminate SnagIt/32.
Examples:
Capture an image using the current SnagIt/32 input, output, format and other parameters:
[DDE_EXECUTE command] snag()
Capture the bitmapped image stored in the file CAR.BMP, using the current SnagIt/32 output,
format and other parameters:
[DDE_EXECUTE command] snag("c:\windows\car.bmp")
Capture the rectangular screen area bounded by the xy coordinates at 0,0 and 350,500:
[DDE_EXECUTE command] snag("0 0 350 500")
Capture the window client area for the window with handle "0x43B":
[DDE_EXECUTE command] snag("client handle 0x43B")
Note: You can use numbers in either decimal or hexadecimal format in SnagIt/32 DDE
commands. Hex values must begin with "0x".
With the DDE_EXECUTE Esnag command, you can specify input, output, format, scale and
option parameters for a single capture. All parameters will return to saved/default settings after
the capture is performed.
10
Input Parameter Result
DEF Captures the default input .
CLP Captures the Clipboard.
SCR Captures the Screen.
LST Captures the Last Active Window.
BMP Captures a BMP file, where [filename] is an existing Windows
BMP file.
WIN x y Captures the entire window containing the point x y.
CLI x y Captures the Window Client Area containing the point x
y.
WHD h Captures the Entire Window specified by the window handle
h.
CHD h Captures the Window Client Area specified by the window
handle h.
REG xl yl x2 y2 Captures the rectangular area specified by the points x1 y1
and x2 y2.
REP Repeats the last capture using the same parameters.
11
GRY Implements Grayscale format.
Capture the Last Active Window. Here , only the input parameter is specified; all other
parameters use default settings. Therefore, the Esnag command, executed with an input
parameter, behaves like the snag command executed with a specified parameter. (Remember,
the snag command can only use input parameters.)
[DDE_EXECUTE command] Esnag (LST, DEF, DEF, DEF, DEF)
Capture the Screen to a TIF file named SCREEN1.TIF. Now, both the input and output
parameters are specified in the Esnag command line; all other parameters use default settings.
[DDE_EXECUTE command] Esnag (SCR, TIF SCREEN1.TIF, DEF, DEF, DEF)
Capture the Screen to a TIF file name SCREEN1.TIF, this time specifying the format parameter.
In the Esnag command line, the format parameter is set to color is set to Auto Scale, while the
scale and options parameters remain set at their defaults.
[DDE_EXECUTE] Esnag (SCR, TIF SCREEN1.TIF, COL, DEF, DEF)
Capture the screen to a TIF file named SCREEN1.TIF , set the format to Color, set scale to
default, and enable all four options -- Include Cursor, Automatic File Naming, Correct for Aspect
Ratio and Invert Image Colors.
[DDE_EXECUTE] Esnag (SCR, TIF SCREEN1.TIF, COL, DEF, 15)
Note: The Auto File Naming option is overridden by the output setting when it specifies a
filename.
12
Capture the Entire Screen to a TIF file named SCRSHOT1.TIF , set the format to Color , set
scale to default, and invert the image colors:
[DDE_EXECUTE command] Esnag (SCR, TIF SCRSHOT1.TIF, COL, DEF, 9)
Capture the entire screen to a JPEG file, set the format to Color, set scale to default, and include
the mouse cursor:
[DDE_EXECUTE command] Esnag (SCR, JPG, COL, DEF, 0x01)
Capture the entire screen and send it as a compressed BMP file mail attachment, set the format
to Color, set the scale factor to default, and include the mouse cursor:
[DDE_EXECUTE command] Set("output cbmp")
Capture the default input to a BMP file , set the format to Monochrome with an Intensity
Threshold of 40 and enable the Include Cursor and Automatic File Naming options:
[DDE_EXECUTE command] Esnag (DEF, BMP, MON 40, DEF, 3)
Capture the window with handle 0x00010062 to the clipboard, set format to reduce to 256 colors,
default printer scaling (does not apply), and default options. The "Set" command scales the
image down to one half its original size.
[DDE_EXECUTE command] Set("options scale,0.5")
[DDE_EXECUTE command] Esnag (WHD 0x00010062, CLP, COL 256, DEF, DEF)
Capture the window at point 100,200 to the printer, set format to color with no color reduction,
scale the output to fit on a single printer page, set the Auto Scroll option to capture the entire
document in the window.
[DDE_EXECUTE command] Esnag (WIN 100 200, PRN, COL 0, PAGE, 0x10)
13
This macro also illustrates how you can access SnagIt/32 from a commercial application using
DDE calls in a macro.
· Word For Windows 2.0
· Word For Windows 95 And Word For Windows 6.0
· Activating Snagit/32 From Word For Windows
14
4. Select the entire document by choosing Edit, Select All from the menu. Then choose
Edit, Copy from the menu to copy the document to the clipboard.
5. Choose Tools, Macro from the menu.
6. In the Macro dialog box, type "ScreenCapture" in the Macro Name field (with no spaces
between the words), and "Activates SnagIt/32" in the Description field.
7. Press the Create button to open the macro.
8. Choose Edit, Paste from the menu to paste in the body of the SnagIt/32 macro.
9. To assign the SnagIt/32 macro to a MS Word menu item, choose Tools, Customize
from the menu. This will bring up the Customize dialog box.
In the Customize dialog box, do the following:
· Select the Menus folder at the top of the dialog box.
· Choose “Macros” from the Categories list box.
· Select "ScreenCapture" from the Macros list box.
· Select “&Insert” from the Change What Menu drop-down list box.
· Select “(At Bottom)” from the Position on Menu drop-down list box.
· Verify that the text in the Name on Menu field reads "&Screen Capture".
10. Select the Add button, and then the Close button.
11. Choose File, Close from the menus. Word will prompt you to confirm that you want to
keep your changes. Select the Yes button.
12. Choose File, Save All from the menu. When Word prompts you to confirm that you want
to save the global glossary and command changes, select the Yes button.
15