
Calling a C function from JavaScript
479
Returns
A Boolean value:
JS_TRUE
indicates success;
JS_FALSE
indicates failure.
Example
char dwConfig = "file:///c:|
P
rogram Files\Macromedia\Dreamweaver
\Configuration\Objects\insertbar.xml";
MM_DeleteConfigFile(dwConfig);
Calling a C function from JavaScript
After you understand how C-level extensibility works in Dreamweaver and its dependency on
certain data types and functions, it’s useful to know how to build a library and call a function.
The following example requires the following five files, located in the Dreamweaver
application folder Samples/Extending as archives for both the Macintosh and Windows:
■
The mm_jsapi.h header file includes definitions for the data types and functions that are
described in
“C-level extensibility and the JavaScript interpreter” on page 459
.
■
The mm_jsapi_environment.h file defines the MM_Environment.h structure.
■
The MMInfo.h file provides access to the Design Notes API.
■
The Sample.c example file defines the
computeSum()
function.
■
The Sample.mak makefile lets you build the Sample.c source file into a DLL with
Microsoft Visual C++; Sample.mcp is the equivalent file for building a Mach-O bundle
with Metrowerks CodeWarrior and Sample.xcode is the equivalent file for Apple Xcode. If
you use another tool, you can create the makefile.
To build the DLL in Windows using VS.Net 2003:
1.
Use File > Open > Sample.mak with Files of type set to All Files (*.*). (VS.Net 2003 does
not open .mak files directly). You are then prompted to verify that you want to convert the
project to the new format.
2.
Select Build > Rebuild Solution.
When the build operation finishes, the Sample.dll file appears in the folder that contains
Sample.mak (or one of its subfolders).
To build the DLL in Windows using Microsoft Visual C++:
1.
In Microsoft Visual C++, select File > Open Workspace, and select Sample.mak.
2.
Select Build > Rebuild All.
When the build operation finishes, the Sample.dll file appears in the folder that contains
Sample.mak (or one of its subfolders).
Summary of Contents for DREAMWEAVER 8-EXTENDING DREAMWEAVER
Page 1: ...Extending Dreamweaver...
Page 8: ...8 Contents...
Page 14: ...14 Introduction...
Page 16: ......
Page 54: ...54 Customizing Dreamweaver...
Page 96: ...96 Customizing Code View...
Page 98: ......
Page 110: ...110 Extending Dreamweaver...
Page 138: ......
Page 166: ...166 Insert Bar Objects...
Page 180: ...180 Commands...
Page 248: ...248 Toolbars...
Page 260: ...260 Reports...
Page 278: ...278 Tag Libraries and Editors...
Page 288: ...288 Property Inspectors...
Page 378: ...378 Server Behaviors...
Page 398: ...398 Data Sources...
Page 432: ...432 Server Models...
Page 456: ...456 Data Translators...
Page 482: ......
Page 492: ...492 The Shared Folder...