Chapter 10. Beyond JavaScript: Interfacing with Dreamweaver Through C


Chapter 10. Beyond JavaScript: Interfacing with Dreamweaver Through C++

Around the time of the Beta release of Dreamweaver 2, Macromedia had begun to realize that the JavaScript extensibility architecture built into Dreamweaver was bumping up against its limits. Developers were asking for features that standard JavaScript simply didn't support, such as access to the local file system on a user 's computer or the Windows Registry. Some developers also had code that they wanted to protect from prying eyes due to trade secrets or other confidentiality needs. Macromedia's development partners , such as Apple and Nokia, needed ways to integrate Dreamweaver with existing proprietary systems, which was out of the reach of the native capabilities of the JavaScript language.

Macromedia could have solved these problems by adding proprietary extensions to the JavaScript language to handle things such as file access, HTTP networking, Design Notes, and so on. Instead, true to form, the Dreamweaver team took the extensible approach ”allowing developers to create their own extensions to JavaScript (called JSExtensions) by writing directly in native C++ code. These new features became natural extensions to JavaScript by manifesting themselves as objects within the JavaScript namespace. For example, if a developer creates a C++ library for file access and calls it DWfile, then a new object named DWfile is suddenly available to all JavaScript developers and Dreamweaver users who install that library in their copy of Dreamweaver.

Using this mechanism opens up entirely new possibilities for Dreamweaver extensions. By creating JavaScript extensions in C++, you can create much more complex user interfaces in modal dialogs, communicate with network-based server machines, read foreign file formats, and even create a C++-based bridge to Java, allowing you to call directly into Java code or JavaBean components . The upside to all of this is tremendous; you are no longer confined to the restrictions that the JavaScript language imposes on extensions. The downside, however, is that because you are using C++, you have to implement your extensions twice if you want to support both Macintosh and Windows versions.

In this chapter, we'll introduce Dreamweaver's C++ extensibility layer and examine some of the standard DLLs that ship with the application. Next, we'll show how to build extensions to Dreamweaver's JavaScript layer by writing C++ DLLs, and how to convert data between the JavaScript and C environments. Finally, we'll build a practical example: a C++ library that provides direct access to the operating system's Clipboard on both Macintosh and Windows.

WARNING

This chapter assumes that you have a working knowledge of C/C++ and is not intended as a primer for those languages.




Joseph Lowery's Beyond Dreamweaver
Joseph Lowerys Beyond Dreamweaver
ISBN: B000H2MWYS
EAN: N/A
Year: 2001
Pages: 87
Authors: Joseph Lowery

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net