【XLL API 函数】xlAbort
C API 中有 15个 Excel 回调函数只能使用 Excel4、Excel4v、Excel12、Excel12v 函数调用(或间接的使用框架函数 Excel 或 Excel12f 调用)。也就是说,这15个函数只能从 DLL 或 XLL 调用。它们包括:
- xlAbort
- xlCoerce
- xlDefineBinaryName
- xlDisableXLMsgs
- xlEnableXLMsgs
- xlFree
- xlGetBinaryName
- xlGetHwnd
- xlGetInst
- xlGetName
- xlSet
- xlSheetId
- xlSheetNm
- xlStack
- xlUDF
xlAbort 函数
驱使处理器处理系统中的其它任务,检查用户是否按下了 ESC 键想要退出了宏。如果用户在计算期间按下了 ESC,工作表函数中调用此函数就可以检测到。
函数原型
Excel12(xlAbort, LPXLOPER12 pxRes, 1, LPXLOPER12 pxRetain);
参数
pxRetain (xltypeBool)
可选,如果是 FALSE, 函数就会检查中断条件,并清除所有挂起的中断。这可以让用户继续执行操作。如果忽略了这个函数或将参数设置为 TRUE,函数就会检查用户未清除的中止操作。
属性和返回值
如果用户按下了 ESC ,返回 TRUE(xltypeBool)。
备注
需要频繁调用
如果函数和命令将会花费大量时间,就应该频繁通过调用此函数使CPU 可以切换到其它的任务中去。
避免使用一些不好的语句
避免在你的用户接口中使用 “Abort"。应该考虑使用 ”Cancel"、"Halt"、"Break"、"Stop"。
实例
下面的代码,会反复的激活工作表中的单元格,直到 1分钟 过去或按下了 ESC。实例位于 : \SAMPLES\GENERIC\GENERIC.C
int WINAPI fDance(void)
{
DWORD dtickStart;
XLOPER12 xAbort, xConfirm;
int boolSheet;
int col=0;
XCHAR rgch[32];
//
// Check what kind of sheet is active. If it is a worksheet or macro
// sheet, this function will move the selection in a loop to show
// activity. In any case, it will update the status bar with a countdown.
//
// Call xlSheetId; if that fails the current sheet is not a macro sheet or
// worksheet. Next, get the time at which to start. Then start a while
// loop that will run for one minute. During the while loop, check if the
// user has pressed ESC. If true, confirm the abort. If the abort is
// confirmed, clear the message bar and return; if the abort is not
// confirmed, clear the abort state and continue. After checking for an
// abort, move the active cell if on a worksheet or macro. Then
// update the status bar with the time remaining.
//
// This block uses TempActiveCell12(), which creates a temporary XLOPER12.
// The XLOPER12 contains a reference to a single cell on the active sheet.
// This function is part of the framework library.
//
boolSheet = (Excel12f(xlSheetId, 0, 0) == xlretSuccess);
dtickStart = GetTickCount();
while (GetTickCount() < dtickStart + 60000L)
{
Excel12f(xlAbort, &xAbort, 0);
if (xAbort.val.xbool)
{
Excel12f(xlcAlert, &xConfirm, 2,
TempStr12(L"Are you sure you want to cancel this operation?"),
TempNum12(1));
if (xConfirm.val.xbool)
{
Excel12f(xlcMessage, 0, 1, TempBool12(0));
return 1;
}
else
{
Excel12f(xlAbort, 0, 1, TempBool12(0));
}
}
if (boolSheet)
{
Excel12f(xlcSelect, 0, 1,
TempActiveCell12(0,(BYTE)col));
col = (col + 1) & 3;
}
wsprintfW(rgch,L"0:%lu",
(60000 + dtickStart - GetTickCount()) / 1000L);
Excel12f(xlcMessage, 0, 2, TempBool12(1), TempStr12(rgch));
}
Excel12f(xlcMessage, 0, 1, TempBool12(0));
return 1;
}
【XLL API 函数】xlAbort的更多相关文章
- 【XLL API 函数】xlGetHwnd
返回顶层的 Excel 窗口句柄. Excel4(xlGetHwnd, LPXLOPER pxRes, 0); /* returns low part only */ Excel12(xlGetHwn ...
- 【XLL API 函数】xlfUnregister (Form 2)
此函数可以被 Excel 已经载入的 XLL 或 DLL 调用.它等效于宏表函数 UNREGISTER. xlfUnregister 有两种调用形式: 形式1:Unregister 单独的命令或函数 ...
- 【XLL API 函数】xlfUnregister (Form 1)
此函数可以被 Excel 已经载入的 XLL 或 DLL 调用.它等效于宏表函数 UNREGISTER. xlfUnregister 有两种调用形式: 形式1:Unregister 单独的命令或函数 ...
- 【XLL API 函数】xlUDF
调用用户定义函数,这个函数允许DLL 调用 VBA 中的用户定义函数,XLM 宏语言函数,以及在其它 add-ins 中注册的函数. 原型 Excel12(xlUDF, LPXLOPER12 pxRe ...
- 【XLL API 函数】xlStack
查看堆栈区还剩余多少空间 原型 Excel12(xlStack, LPXLOPER12 pxRes, 0); 参数 此函数没有带任何参数 属性值/返回值 返回堆栈区还剩余的字节数 备注 返回最新版本的 ...
- 【XLL API 函数】xlSheetNm
从外部引用包含的工作表ID返回工作表或宏表名称,或是当前表名称. 原型 Excel12(xlSheetNm, LPXLOPER12 pxRes, 1, LPXLOPER12 pxExtref); 参数 ...
- 【XLL API 函数】xlSheetId
查找命名的工作表ID,用于外部引用. 原型 Excel12(xlSheetId, LPXLOPER12 pxRes, 1, LPXLOPER12 pxSheetName); 参数 pxSheetNam ...
- 【XLL API 函数】xlGetName
以字符串格式返回 DLL 文件的长文件名. 原型 Excel12(xlGetName, LPXLOPER12 pxRes, 0); 参数 这个函数没有参数 属性值和返回值 返回文件名和路径 实例 \S ...
- 【XLL API 函数】 xlGetInst
返回正在调用 DLL 的 Excel 实例的实例句柄. 原型 Excel4(xlGetInst, LPXLOPER pxRes, 0); /* returns low part only */ Exc ...
随机推荐
- SQL--表分区
use Test --.创建数据库文件组>>alter database <数据库名> add filegroup <文件组名> ALTER DATABASE TE ...
- 2013nanjignB
B - Poor Warehouse Keeper Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & ...
- SparkSql 不支持Date Format (支持Timestamp)
最近项目中需要用到sparksql ,需要查询sql Date类型, 无奈,官方现阶段 1.6.0 还不支持Date类型,不过支持Timestamp类型,所以问题可以解决了. 1.解析 SimpleD ...
- Jetty安装
下载jetty http://www.eclipse.org/jetty/ 看好jdk 版本 安装 解压压缩包到指定目录,且将其目录路径定义为${JETTY_HOME} 进入${JETTY_HOME ...
- webservice测试实例
webservice测试实例(LR8.1) 接口声明:这个接口是sina的短信服务接口,我只是用来做脚本学习使用,不会对其产生压力:希望读者也只是用来进行录制学习,而不是产生压力. 接口文档:http ...
- leetcode 33. Search in Rotated Sorted Array
Suppose a sorted array is rotated at some pivot unknown to you beforehand. (i.e., 0 1 2 4 5 6 7 migh ...
- SNMP协议入门
SNMP协议入门 1.引言 基于TCP/IP的网络管理包含3个组成部分: 1) 一个管理信息库MIB(Management Information Base).管理信息库包含所有代理进程的所有可被查询 ...
- Activity中UI框架基本概念
Activity中UI框架基本概念 Activity 是应用程序的基本组成部分,提供了可视的界面,UI容器, 与用户进行交互: 具体Acitivity是怎么样显示这些事视图元素以及响应事件交互的. 一 ...
- GitHub访问速度慢的解决方法
# Github 103.245.222.249 github.global.ssl.fastly.net 103.245.222.133 assets-cdn.github.com 23.235.4 ...
- [20160701]DevideByZeroWithoutNoException——from 《Java How To Program (Early Objects), 10th》
//一段优美的例子 import java.util.Scanner; import java.util.InputMismatchException; public class DevideByZe ...