Macromedia dreamweaver 8-extending dreamweaver User Manual

Page of 504
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 
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).