【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 ...
随机推荐
- spring缓存Ehcache(入门2)源码解读
Ehcache缓存: 解读: Ehcache缓存是在继承spring缓存核心类CacheManager的基础上实现的. 常用类: EhCacheCacheManager:继承自CacheManager ...
- URL、Session、Cookies、Server.Transfer、Application和跨页面传送,利弊比较
URL.Session.Cookies.Server.Transfer.Application和跨页面传送.-本题考查面试者对ASP.NET中多页面传值的理解是否全面.因为ASP.NET的页面表单提交 ...
- C++调用shell
1.直接采用system() 2.popen http://www.cnblogs.com/xitang/p/4288808.html
- android 弹出的软键盘遮挡住EditText文本框的解决方案
1.android 弹出的软键盘遮挡住EditText文本框的解决方案: 把Activit对应的布局文件filename.xml文件里的控件用比重设置布局.(例如:android:layout_wei ...
- iOS开发——UI基础-UIButton、UIImageView、UILabel的选择
1.UILabel - UILabel的常见属性 @property(nonatomic,copy) NSString *text; 显示的文字 @property(nonatomic,retain) ...
- word20161130
1. even 偶数 [ǒu shù][词典] even; [数] even number;[例句]在本例中,slot A中有奇数个阵列,slot B中有偶数个阵列.In this example, ...
- 剑指Offer 用两个栈实现队列
题目描述 用两个栈来实现一个队列,完成队列的Push和Pop操作. 队列中的元素为int类型. 思路: 入队:将元素进栈A 出队:判断栈B是否为空,如果为空,则将栈A中所有元素pop,并push进 ...
- php preg_库正则匹配
<?php //preg_库提供的正则 preg_match();//进行正则表达式匹配 /* preg_match (pattern , subject, matches) 参数 描述 pat ...
- Ubuntu 虚拟机空间不足增加空间笔记
一开始给虚拟机加空间以为只是需要在虚拟机设置里面添加就行,后面发现还得重新在虚拟机内部增加. 链接: http://pan.baidu.com/s/1c2uVcCo 密码: xid8 这只是第一步,共 ...
- BZOJ 2124: 等差子序列
Sol 线段树+Hash. 首先暴力 等差子序列至少3项就可以了,就枚举中项,枚举公差就可以了,只需要一个数在中项前出现,另一个数在中项前没出现过就可以了.复杂度 \(O(n^2)\) 然后我想了一个 ...