Dreamweaver 扩展开发: 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/ Tutorial_assets/Extending folder as archives for both the Macintosh and Windows platforms:
- 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.
- 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 make file 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.
Build the DLL in Windows using VS.Net 2003
- Use File > Open, and select 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.
- 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).
Build the DLL in Windows using Microsoft Visual C++
- In Microsoft Visual C++, select File > Open Workspace, and select Sample.mak.
- 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).
Build the shared library on the Macintosh using Metrowerks CodeWarrior 9 or later
- Open Sample.mcp.
- Build the project (Project > Make) to generate a Mach-O Bundle.
When the build operation finishes, the Sample.bundle file appears in the folder that contains Sample.mcp.
Note:The Mach-O Bundle that is generated can only be used in Dreamweaver 8 and later. Earlier versions of Dreamweaver do not recognize it.
Build the shared library on the Macintosh using Apple Xcode 1.5 or later
- Open Sample.xcode.
- Build the project (Build > Build) to generate a Mach-O Bundle.
When the build operation finishes, the Sample.bundle file appears in the build folder that is next to the Sample.xcode file.
Note:The Mach-O Bundle that is generated can only be used in Dreamweaver 8 and later. Earlier versions of Dreamweaver do not recognize it.
Call the computeSum() function from the Insert Horizontal Rule object
- Create a folder called JSExtensions in the Configuration folder within the Dreamweaver application folder.
- Copy Sample.dll (Windows) or Sample.bundle (Macintosh) to the JSExtensions folder.
- In a text editor, open the HR.htm file in the Configuration/Objects/Common folder.
- Add the line alert(Sample.computeSum(2,2)); to the objectTag() function, as shown in the following example:
function objectTag() {
// Return the html tag that should be inserted
alert(Sample.computeSum(2,2));
return "<HR>";
} - Save the file and restart Dreamweaver.
To execute the computeSum() function, select Insert > HTML > Horizontal Rule.
A dialog box that contains the number 4 (the result of computing the sum of 2 plus 2) appears.
标题:Calling a C function from JavaScript
原址:http://helpx.adobe.com/dreamweaver/extend/calling-c-function-javascript.html
Dreamweaver 扩展开发: Calling a C++ function from JavaScript的更多相关文章
- Dreamweaver 扩展开发:C-level extensibility and the JavaScript interpreter
The C code in your library must interact with the Dreamweaver JavaScript interpreter at the followin ...
- Dreamweaver 扩展开发:文档路径等信息的处理
//browseFile(fieldToStoreURL){ //getFullPath(filePathURL){ //getSimpleFileName() { //fixUpPath(docUR ...
- Dreamweaver扩展注意事项
对Dreamweaver扩展做了一些整理. 扩展开发扩展(Extension),是应用程序给用户预留的二次开发接口.Dreamweaver提供了对菜单,插入栏(Insertbar),浮动框等GUI部件 ...
- postgres扩展开发
扩展开发的基本组成 demo--1.0.sql demo.c demo.control Makefile demo.c当中包含了自定义函数的实现,纯C语言,目录下可包含多个.c文件.demo-1.0. ...
- Chrome扩展开发之二——Chrome扩展中脚本的运行机制和通信方式
目录: 0.Chrome扩展开发(Gmail附件管理助手)系列之〇——概述 1.Chrome扩展开发之一——Chrome扩展的文件结构 2.Chrome扩展开发之二——Chrome扩展中脚本的运行机制 ...
- PHP扩展开发相关总结
1.线程安全宏定义 在TSRM/TSRM.h文件中有如下定义 #define TSRMLS_FETCH() void ***tsrm_ls = (void ***) ts_resource_ex(0, ...
- Chrome浏览器扩展开发系列之十四
Chrome浏览器扩展开发系列之十四:本地消息机制Native messaging 时间:2015-10-08 16:17:59 阅读:1361 评论:0 收藏:0 ...
- Chrome扩展开发之三——Chrome扩展中的数据本地存储和下载
目录: 0.Chrome扩展开发(Gmail附件管理助手)系列之〇——概述 1.Chrome扩展开发之一——Chrome扩展的文件结构 2.Chrome扩展开发之二——Chrome扩展中脚本的运行机制 ...
- Chrome扩展开发之四——核心功能的实现思路
目录: 0.Chrome扩展开发(Gmail附件管理助手)系列之〇——概述 1.Chrome扩展开发之一——Chrome扩展的文件结构 2.Chrome扩展开发之二——Chrome扩展中脚本的运行机制 ...
随机推荐
- Android Studio配置 AndroidAnnotations——Hi_博客 Android App 开发笔记
以前用Eclicps 用习惯了现在 想学学 用Android Studio 两天的钻研终于 在我电脑上装了一个Android Studio 并完成了AndroidAnnotations 的配置. An ...
- 【疯狂造轮子-iOS】JSON转Model系列之一
[疯狂造轮子-iOS]JSON转Model系列之一 本文转载请注明出处 —— polobymulberry-博客园 1. 前言 之前一直看别人的源码,虽然对自己提升比较大,但毕竟不是自己写的,很容易遗 ...
- 百度推出新技术 MIP,网页加载更快,广告呢?
我们在2016年年初推出了MIP,帮助移动页面加速(原理).内测数据表明,MIP页面在1s内加载完成.现在已经有十多家网站加入MIP项目,有更多的网站正在加入中.在我们收到的反馈中,大部分都提到了广告 ...
- Win.ini和注册表的读取写入
最近在做打包的工作,应用程序的配置信息可以放在注册表文件中,但是在以前的16位操作系统下,配置信息放在Win.ini文件中.下面介绍一下Win.ini文件的读写方法和注册表的编程. 先介绍下Win.i ...
- IE8/9 JQuery.Ajax 上传文件无效
IE8/9 JQuery.Ajax 上传文件有两个限制: 使用 JQuery.Ajax 无法上传文件(因为无法使用 FormData,FormData 是 HTML5 的一个特性,IE8/9 不支持) ...
- geotrellis使用(二十八)栅格数据色彩渲染(多波段真彩色)
目录 前言 实现过程 总结 一.前言 上一篇文章介绍了如何使用Geotrellis渲染单波段的栅格数据,已然很是头疼,这几天不懈努力之后工作又进了一步,整清楚了如何使用Geotrelli ...
- PHP之用户验证和标签推荐的简单使用
本篇主要是讲解一些最简单的验证知识 效果图 bookmark_fns.php <?php require_once('output_fns.php'); require_once('db_fns ...
- bzoj3932--可持久化线段树
题目大意: 最近实验室正在为其管理的超级计算机编制一套任务管理系统,而你被安排完成其中的查询部分.超级计算机中的 任务用三元组(Si,Ei,Pi)描述,(Si,Ei,Pi)表示任务从第Si秒开始,在第 ...
- GOF23设计模式归类
创建型模式:-单例模式.工厂模式.抽象工厂模式.建造者模式.原型模式结构型模式:-适配器模式.桥接模式.装饰模式.组合模式.外观模式.享元模式.代理模式行为型模式:-模板方法模式.命令模式.迭代器模式 ...
- [原创]Macbook Pro Retina 15吋安装Windows 7和Windows 8.1方法
前言 本以为有Bootcamp神器在手,Macbook装Win系统应该是不在话下,没想到着实折腾了一番.期间因为误操作导致OSX也挂掉进不去只得磁盘全部抹掉网络恢复安装.为了让大家少走弯路,提供个人安 ...