您之前说过,您的系统是XP的,那么那个右键二级菜单根本不适用。
如果是Vista及其以上的系统,倒是可以完美实现。
以下是我在Win7上通过测试的注册表内容
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\AllFilesystemObjects\shell\AddPrefix]
"SubCommands"="Add.Trial;Add.Void"
"MUIVerb"="添加前缀"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\Add.Trial]
@="试用"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\Add.Trial\command]
@="D:\\Test.bat \"Trial\" \"%1\""
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\Add.Void]
@="作废"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\Add.Void\command]
@="D:\\Test.bat \"Void\" \"%1\""
以下是Test.bat,测试脚本的内容
@echo off & title 测试脚本 By 依梦琴瑶
if "%~1"=="" exit
if "%~2"=="" exit
goto :%~1
exit
:Trial
echo (试用)%~nx2
pause
exit
:Void
echo (作废)%~nx2
pause
exit
XP未能测试通过,所以只能贴出代码,来给您看看了!
include
#include
#include
int main(int argc, char *argv[])
{
//OleInitialize(0);
//CoInitialize(0);
QCoreApplication a(argc, argv);
QAxObject *asdfg = new QAxObject("Excel.Application");
return a.exec();
}