【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 ...
随机推荐
- mysql 总结二(自定义函数)
本质:mysql内置函数的一种扩展,本质上与mysql内置函数一样. 函数必要条件: @1:参数(非必备): @2:返回值: 模板: create function function_name ret ...
- iOS 字符转换
字典或者数组转化为nsstring NSArray *arr = [NSArray arrayWithObject:@"1"]; NSString *str = [arr JSON ...
- HDOJ 3507 Print Article
Print Article Time Limit: 9000/3000 MS (Java/Others) Memory Limit: 131072/65536 K (Java/Others)To ...
- HDOJ 4734 F(x)
数位DP.... F(x) Time Limit: 1000/500 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Tota ...
- Java系列笔记(4) - JVM监控与调优
目录 参数设置收集器搭配启动内存分配监控工具和方法调优方法调优实例 光说不练假把式,学习Java GC机制的目的是为了实用,也就是为了在JVM出现问题时分析原因并解决之.通过学习,我觉得JVM ...
- springmvc之hibernate整合
1.项目结构 2.所需jar包 3.web.xml <?xml version="1.0" encoding="UTF-8"?> <web-a ...
- expert C Programing notes
1.寻常算术转换 在运算中 如果其中一个操作数是long double 则另一个转为long double,其次 如果有一个为double 则另一个转为double,再次 float . unsign ...
- 9.4用WebApi去连接外部认证服务
原文链接:http://www.asp.net/web-api/overview/security/external-authentication-services VS2013和Asp.Net4.5 ...
- Codeforces Round #336 Hamming Distance Sum
题目: http://codeforces.com/contest/608/problem/B 字符串a和字符串b进行比较,以题目中的第一个样例为例,我刚开始的想法是拿01与00.01.11.11从左 ...
- WebStorm设置手机测试服务器-局域网内其他设备访问
前端开发中,经常需要将做好的页面给其他同事预览或手机测试,之前一直用的第三方本地服务器usbwebserver,偶然了解到WebStorm内置服务器也可以满足此需求,来看看如何设置吧~~ 1.端口更改 ...