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扩展中脚本的运行机制 ...
随机推荐
- 试试SQLSERVER2014的内存优化表
试试SQLSERVER2014的内存优化表 SQL Server 2014中的内存引擎(代号为Hekaton)将OLTP提升到了新的高度. 现在,存储引擎已整合进当前的数据库管理系统,而使用先进内存技 ...
- 使用struct处理二进制
有的时候需要用python处理二进制数据,比如,存取文件.socket操作时.这时候,可以使用python的struct模块来完成. struct模块中最重要的三个函数是pack(), unpack( ...
- ASP.NET Core 之 Identity 入门(三)
前言 在上一篇文章中,我们学习了 CookieAuthentication 中间件,本篇的话主要看一下 Identity 本身. 最早2005年 ASP.NET 2.0 的时候开始, Web 应用程序 ...
- premere cs4绿色版 安装 并且 视频导出 讲解
最近室友,开始在玩视频剪辑,用的是 premere cs4 绿色版.让他遇到的最大问题也是我之前遇到的最大问题,就是视频导出. 所以我在这里上传一套自己的一点点经验吧. 接下来,我就总结一下 我是怎么 ...
- ABP文档 - Mvc 视图
文档目录 本节内容: 简介 AbpWebViewPage 基类 简介 ABP通过nuget包Abp.Web.Mvc集成到Mvc视图里,你可以像往常那样创建常规的视图. AbpWebViewPage 基 ...
- python爬取github数据
爬虫流程 在上周写完用scrapy爬去知乎用户信息的爬虫之后,github上star个数一下就在公司小组内部排的上名次了,我还信誓旦旦的跟上级吹牛皮说如果再写一个,都不好意思和你再提star了,怕你们 ...
- android通过webview调起支付宝app支付
webview在加载网页的时候会默认调起手机自带的浏览器加载网页,用户体验不好.但当用户设置浏览器客户端(setWebViewClient)设置这样的监听事件之后,当请求url的时候就不会打开手机自带 ...
- Javascript实现HashTable类
散列算法可以尽快在数据结构中找出指定的一个值,因为可以通过Hash算法求出值的所在位置,存储和插入的时候都按照Hash算法放到指定位置. <script> function HashTab ...
- 深入理解javascript函数定义与函数作用域
最近在学习javascript的函数,函数是javascript的一等对象,想要学好javascript,就必须深刻理解函数.本人把思路整理成文章,一是为了加深自己函数的理解,二是给读者提供学习的途径 ...
- 港真,到底应该选择OA还是BPM?
越来越多企业意识到流程管理的重要性,但是,选择OA还是BPM,却让他们产生了选择困难症. 一方面,企业皆注重流程的高效运转,最好内外部的业务都能用一个系统来解决.所有流程一天就能上线什么的,那就更好啦 ...